Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
polimorfico committed Nov 15, 2010
1 parent 157d455 commit a3a475d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 42 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Usage
=====
`rails new app_name -J -m http://github.com/recrea/rails3-templates/main.rb`
In order to use these templates, you should clone the repo and refer to the templates from your local file system:

`rails new app_name -J -m rails3-templates/main.rb`

Gems
====
Expand Down
6 changes: 3 additions & 3 deletions capistrano.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
run "bundle install"
capify!

app_name = ask "\r\n\r\nEnter the application name:"
server = ask "\r\n\r\nEnter the servername or IP:"
git_repo = ask "\r\n\r\nEnter the git repo URL, e.g. [email protected]:recrea/app.git :"
app_name = ask "\r\nnEnter the application name:"
server = ask "\r\nnEnter the servername or IP:"
git_repo = ask "\r\nnEnter the git repo URL, e.g. [email protected]:recrea/app.git :"

file 'config/deploy.rb', <<-FILE
# Bundler Integration
Expand Down
2 changes: 1 addition & 1 deletion devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
generate "devise:install"

git :add => '.'
git :commit => 'm "Devise"'
git :commit => '-m "devise"'
72 changes: 36 additions & 36 deletions main.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
puts '\r\n\r\n*****************************************************************************************************'
puts 'Let me ask you a few questions before I start bootstrapping your app'
puts '*****************************************************************************************************'
puts "\r\n\r\n*****************************************************************************************************"
puts "Let me ask you a few questions before I start bootstrapping your app"
puts "*****************************************************************************************************"

auth_option = ask('\r\n\r\nWhat authentication framework do you want to use?\r\n\r\n(1) Devise\r\n(2) Authlogic\r\n(3) Omniauth\r\nPress Enter to skip')
deploy_option = ask('\r\n\r\nWhat deploy method do you want to use?\r\n\r\n(1) Capistrano\r\n(2) Inploy\r\nPress Enter to skip')
locale_str = ask('Enter a list of locales you want to use separated by commas (e.g. 'es, de, fr'). For a reference list visit http://github.com/svenfuchs/rails-i18n/tree/master/rails/locale/. Press enter to skip: ')
exceptions_option = ask('\r\n\r\nWhat exceptions tracker do you want to use?\r\n\r\n(1) Exceptional\r\n(2) Hoptoad\r\nPress Enter to skip')
auth_option = ask("\r\n\r\nWhat authentication framework do you want to use?\r\n(1) Devise\r\n(2) Authlogic\r\n(3) Omniauth\r\nPress Enter to skip")
deploy_option = ask("\r\n\r\nWhat deploy method do you want to use?\r\n(1) Capistrano\r\n(2) Inploy\r\nPress Enter to skip")
locale_str = ask("\r\n\r\nEnter a list of locales you want to use separated by commas (e.g. 'es, de, fr'). For a reference list visit http://github.com/svenfuchs/rails-i18n/tree/master/rails/locale/. Press enter to skip: ")
exceptions_option = ask("\r\n\r\nWhat exceptions tracker do you want to use?\r\n(1) Exceptional\r\n(2) Hoptoad\r\nPress Enter to skip")

if ['1', '2', '3'].include?(auth_option)
auth = 'devise' if auth_option=='1'
Expand All @@ -23,15 +23,16 @@
end

if ['1', '2'].include?(exceptions_option)
exceptions_tracker = 'exceptional' if css_framework_option=='1'
exceptions_tracker = 'hoptoad' if css_framework_option=='2'
exceptions_tracker = 'exceptional' if exceptions_option=='1'
exceptions_tracker = 'hoptoad' if exceptions_option=='2'
exceptions_key = ask("\r\n\r\nWhat is your API key for your exceptions tracker?")
else
exceptions_tracker = nil
end

puts '\r\n\r\n*****************************************************************************************************'
puts 'All set. Bootstrapping your app!!'
puts '*****************************************************************************************************\r\n\r\n'
puts "\r\n\r\n*****************************************************************************************************"
puts "All set. Bootstrapping your app!!"
puts "*****************************************************************************************************"

# GO!
run 'rm -Rf .gitignore README public/index.html public/images/rails.png public/javascripts/* app/views/layouts/*'
Expand Down Expand Up @@ -79,14 +80,14 @@
gem 'hoptoad_notifier', '~> 2.3.6'
initializer 'hoptoad.rb', <<-FILE
HoptoadNotifier.configure do |config|
config.api_key = '#{hoptoad_key}'
config.api_key = #{exceptions_key}
end
FILE
end

if exceptions_tracker == 'exceptional'
gem 'exceptional'
exceptional install exceptional_key
run "exceptional install #{exceptions_key}"
end

run 'bundle install'
Expand All @@ -96,21 +97,21 @@

# generators
application <<-GENERATORS
config.generators do |g|
g.orm :active_record
g.stylesheets false
g.template_engine :haml
g.test_framework :shoulda, :fixture_replacement => :factory_girl
g.fallbacks[:shoulda] = :test_unit
g.integration_tool :cucumber
g.helper false
end
config.generators do |g|
g.orm :active_record
g.stylesheets false
g.template_engine :haml
g.test_framework :shoulda, :fixture_replacement => :factory_girl
g.fallbacks[:shoulda] = :test_unit
g.integration_tool :cucumber
g.helper false
end
GENERATORS

# configure cucumber
generate 'cucumber:install --capybara --testunit --spork'
generate 'pickle --path --email'
get 'http://github.com/recrea/rails3-templates/raw/master/within_steps.rb' ,'features/step_definitions/within_steps.rb'
get 'https://github.com/recrea/rails3-templates/raw/master/within_steps.rb' ,'features/step_definitions/within_steps.rb'

# configure other gems
generate 'friendly_id'
Expand All @@ -125,14 +126,14 @@
== \#{link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) } | \#{ link_to 'Back', <%= plural_name %>_path }
FILE
run 'wheneverize .'
run 'rails g backup'

# configure compass
run 'gem install compass'
run 'compass init --using blueprint --app rails --css-dir public/stylesheets'
run 'compass init rails . --quiet --sass-dir app/stylesheets --css-dir public/stylesheets'
create_file 'app/stylesheets/partials/_colors.scss'
get 'http://github.com/recrea/rails3-templates/raw/master/handheld.scss' ,'app/stylesheets/handheld.scss'
get 'https://github.com/recrea/rails3-templates/raw/master/handheld.scss' ,'app/stylesheets/handheld.scss'

get 'http://github.com/recrea/rails3-templates/raw/master/application.html.haml', 'app/views/layouts/application.html.haml'
get 'https://github.com/recrea/rails3-templates/raw/master/application.html.haml', 'app/views/layouts/application.html.haml'
file 'config/asset_packages.yml', <<-FILE
---
javascripts:
Expand All @@ -148,7 +149,6 @@
- handheld:
- handheld
FILE
end

# get locales
unless locale_str.empty?
Expand All @@ -159,11 +159,11 @@
end

# get jquery
get 'http://github.com/rails/jquery-ujs/raw/master/src/rails.js', 'public/javascripts/jquery.rails.js'
get 'https://github.com/rails/jquery-ujs/raw/master/src/rails.js', 'public/javascripts/jquery.rails.js'

# other stuff
get 'http://github.com/recrea/rails3-templates/raw/master/gitignore' ,'.gitignore'
get 'http://github.com/recrea/rails3-templates/raw/master/build.rake', 'lib/tasks/build.rake'
get 'https://github.com/recrea/rails3-templates/raw/master/gitignore' ,'.gitignore'
get 'https://github.com/recrea/rails3-templates/raw/master/build.rake', 'lib/tasks/build.rake'

append_file 'Rakefile', <<-METRIC_FU
MetricFu::Configuration.run do |config|
Expand All @@ -173,9 +173,9 @@

git :init
git :add => '.'
git :commit => '-am 'Initial commit''
git :commit => '-am \'Initial commit\''

apply 'http://github.com/recrea/rails3-templates/raw/master/#{auth}.rb' unless auth.blank?
apply 'http://github.com/recrea/rails3-templates/raw/master/#{deploy}.rb' unless deploy.blank?
apply "https://github.com/recrea/rails3-templates/raw/master/#{auth}.rb" unless auth.blank?
apply "https://github.com/recrea/rails3-templates/raw/master/#{deploy}.rb" unless deploy.blank?

puts 'SUCCESS!'
puts "SUCCESS!"
2 changes: 1 addition & 1 deletion omniauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
get "http://github.com/aentos/rails3-templates/raw/master/omniauth/application_controller.rb", "app/controllers/application_controller.rb"

git :add => '.'
git :commit => '-m "Ominauth"'
git :commit => '-m "ominauth"'

0 comments on commit a3a475d

Please sign in to comment.