rails3_devise_wizard 0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. data/README.textile +135 -0
  2. data/bin/rails3_devise_wizard +7 -0
  3. data/lib/rails_wizard/command.rb +79 -0
  4. data/lib/rails_wizard/config.rb +86 -0
  5. data/lib/rails_wizard/recipe.rb +106 -0
  6. data/lib/rails_wizard/recipes.rb +38 -0
  7. data/lib/rails_wizard/template.rb +58 -0
  8. data/lib/rails_wizard.rb +10 -0
  9. data/recipes/action_mailer.rb +41 -0
  10. data/recipes/activerecord.rb +37 -0
  11. data/recipes/add_user_name.rb +75 -0
  12. data/recipes/application_layout.rb +43 -0
  13. data/recipes/ban_spiders.rb +19 -0
  14. data/recipes/capybara.rb +34 -0
  15. data/recipes/cleanup.rb +34 -0
  16. data/recipes/css_setup.rb +40 -0
  17. data/recipes/cucumber.rb +69 -0
  18. data/recipes/devise.rb +35 -0
  19. data/recipes/devise_navigation.rb +95 -0
  20. data/recipes/env_yaml.rb +54 -0
  21. data/recipes/git.rb +26 -0
  22. data/recipes/haml.rb +14 -0
  23. data/recipes/heroku.rb +58 -0
  24. data/recipes/home_page.rb +43 -0
  25. data/recipes/home_page_users.rb +50 -0
  26. data/recipes/hoptoad.rb +34 -0
  27. data/recipes/jammit.rb +43 -0
  28. data/recipes/jquery.rb +44 -0
  29. data/recipes/less.rb +12 -0
  30. data/recipes/mongo_mapper.rb +18 -0
  31. data/recipes/mongohq.rb +59 -0
  32. data/recipes/mongoid.rb +30 -0
  33. data/recipes/mootools.rb +23 -0
  34. data/recipes/omniauth.rb +15 -0
  35. data/recipes/pow.rb +12 -0
  36. data/recipes/prototype.rb +11 -0
  37. data/recipes/rails_admin.rb +21 -0
  38. data/recipes/redis.rb +17 -0
  39. data/recipes/redistogo.rb +40 -0
  40. data/recipes/rightjs.rb +17 -0
  41. data/recipes/rspec.rb +89 -0
  42. data/recipes/sass.rb +13 -0
  43. data/recipes/seed_database.rb +35 -0
  44. data/recipes/sequel.rb +13 -0
  45. data/recipes/settingslogic.rb +43 -0
  46. data/recipes/slim.rb +11 -0
  47. data/recipes/test_unit.rb +11 -0
  48. data/recipes/users_page.rb +103 -0
  49. data/spec/rails_wizard/config_spec.rb +99 -0
  50. data/spec/rails_wizard/recipe_spec.rb +103 -0
  51. data/spec/rails_wizard/recipes/sanity_spec.rb +30 -0
  52. data/spec/rails_wizard/recipes_spec.rb +24 -0
  53. data/spec/rails_wizard/template_spec.rb +48 -0
  54. data/spec/spec_helper.rb +11 -0
  55. data/spec/support/rails_directory.rb +17 -0
  56. data/spec/support/template_runner.rb +28 -0
  57. data/templates/helpers.erb +45 -0
  58. data/templates/layout.erb +46 -0
  59. data/templates/recipe.erb +10 -0
  60. data/version.rb +3 -0
  61. metadata +205 -0
data/recipes/jquery.rb ADDED
@@ -0,0 +1,44 @@
1
+ # Application template recipe for the rails3_devise_wizard. Check for a newer version here:
2
+ # https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/jquery.rb
3
+
4
+ after_bundler do
5
+ # remove the Prototype adapter file
6
+ remove_file 'public/javascripts/rails.js'
7
+ # remove the Prototype files (if they exist)
8
+ remove_file 'public/javascripts/controls.js'
9
+ remove_file 'public/javascripts/dragdrop.js'
10
+ remove_file 'public/javascripts/effects.js'
11
+ remove_file 'public/javascripts/prototype.js'
12
+ # add jQuery files
13
+ inside "public/javascripts" do
14
+ get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "rails.js"
15
+ get "https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js", "jquery.js"
16
+ if config['ui']
17
+ get "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js", "jqueryui.js"
18
+ end
19
+ end
20
+ # adjust the Javascript defaults
21
+ if config['ui']
22
+ inject_into_file 'config/application.rb', "config.action_view.javascript_expansions[:defaults] = %w(jquery jqueryui rails)\n", :after => "config.action_view.javascript_expansions[:defaults] = %w()\n", :verbose => false
23
+ else
24
+ inject_into_file 'config/application.rb', "config.action_view.javascript_expansions[:defaults] = %w(jquery rails)\n", :after => "config.action_view.javascript_expansions[:defaults] = %w()\n", :verbose => false
25
+ end
26
+ gsub_file "config/application.rb", /config.action_view.javascript_expansions\[:defaults\] = \%w\(\)\n/, ""
27
+ end
28
+
29
+ __END__
30
+
31
+ name: jQuery
32
+ description: "Adds the latest jQuery and Rails UJS helpers for jQuery."
33
+ author: fortuity
34
+
35
+ exclusive: javascript_framework
36
+ category: assets
37
+ tags: [javascript, framework]
38
+
39
+ args: ["-J"]
40
+
41
+ config:
42
+ - ui:
43
+ type: boolean
44
+ prompt: Install jQuery UI?
data/recipes/less.rb ADDED
@@ -0,0 +1,12 @@
1
+ gem 'less'
2
+ plugin 'more', :git => 'git://github.com/cloudhead/more.git'
3
+
4
+ __END__
5
+
6
+ name: Less CSS
7
+ description: "Utilize Less CSS for CSS generation utilizing the \"more\" plugin for Rails."
8
+ author: mbleigh
9
+
10
+ exclusive: css_replacement
11
+ category: assets
12
+ tags: [css]
@@ -0,0 +1,18 @@
1
+ gem 'bson_ext'
2
+ gem 'mongo_mapper', :git => 'git://github.com/jnunemaker/mongomapper.git', :branch => 'rails3'
3
+
4
+ after_bundler do
5
+ generate 'mongo_mapper:config'
6
+ end
7
+
8
+ __END__
9
+
10
+ name: MongoMapper
11
+ description: "Use MongoDB with MongoMapper as your primary datastore."
12
+ author: mbleigh
13
+
14
+ exclusive: orm
15
+ category: persistence
16
+ tags: [mongodb, orm]
17
+
18
+ args: ["-O"]
@@ -0,0 +1,59 @@
1
+ if config['use_heroku']
2
+
3
+ header = <<-YAML
4
+ <% if ENV['MONGOHQ_URL'] %>
5
+ <% mongohq = URI.parse(ENV['MONGOHQ_URL']) %>
6
+ mongohq:
7
+ host: <%= mongohq.host %>
8
+ port: <%= mongohq.port %>
9
+ database: <%= mongohq.path.sub '/', '' %>
10
+ username: <%= mongohq.user %>
11
+ password: <%= mongohq.password %>
12
+ <% end %>
13
+ YAML
14
+
15
+ after_everything do
16
+ say_wizard 'Adding mongohq:free addon (you can always upgrade later)'
17
+ system 'heroku addons:add mongohq:free'
18
+ end
19
+ else
20
+ mongohq = URI.parse(config['uri'])
21
+
22
+ header = <<-YAML
23
+ mongohq:
24
+ host: #{mongohq.host}
25
+ port: #{mongohq.port}
26
+ database: #{mongohq.path.sub '/',''}
27
+ username: #{mongohq.user}
28
+ password: #{mongohq.password}
29
+ YAML
30
+ end
31
+
32
+ after_bundler do
33
+ mongo_yml = "config/mongo#{'id' if recipe?('mongoid')}.yml"
34
+
35
+ prepend_file mongo_yml, header
36
+ inject_into_file mongo_yml, " <<: *mongohq\n", :after => "production:\n <<: *defaults\n"
37
+ end
38
+
39
+ __END__
40
+
41
+ name: MongoHQ
42
+ description: "Utilize MongoHQ as the production data host for your application."
43
+ author: mbleigh
44
+
45
+ requires_any: [mongo_mapper, mongoid]
46
+ run_after: [mongo_mapper, mongoid, heroku]
47
+ exclusive: mongodb_host
48
+ category: services
49
+ tags: [mongodb]
50
+
51
+ config:
52
+ - use_heroku:
53
+ type: boolean
54
+ prompt: "Use the MongoHQ Heroku addon?"
55
+ if_recipe: heroku
56
+ - uri:
57
+ type: string
58
+ prompt: "Enter your MongoHQ URI:"
59
+ unless: use_heroku
@@ -0,0 +1,30 @@
1
+ # Application template recipe for the rails3_devise_wizard. Check for a newer version here:
2
+ # https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/mongoid.rb
3
+
4
+ gem 'bson_ext', '>= 1.3.0'
5
+ gem 'mongoid', '>= 2.0.1'
6
+
7
+ after_bundler do
8
+
9
+ generate 'mongoid:config'
10
+
11
+ # note: the mongoid generator automatically modifies the config/application.rb file
12
+ # to remove the ActiveRecord dependency by commenting out "require active_record/railtie'"
13
+
14
+ # remove the unnecessary 'config/database.yml' file
15
+ remove_file 'config/database.yml'
16
+
17
+ end
18
+
19
+ __END__
20
+
21
+ name: Mongoid
22
+ description: "Utilize MongoDB with Mongoid as the ORM."
23
+ author: fortuity
24
+
25
+ category: persistence
26
+ exclusive: orm
27
+ tags: [orm, mongodb]
28
+
29
+ args: ["-O"]
30
+
@@ -0,0 +1,23 @@
1
+ inside "public/javascripts" do
2
+ get "https://github.com/kevinvaldek/mootools-ujs/raw/master/Source/rails.js", "rails.js"
3
+ get "http://ajax.googleapis.com/ajax/libs/mootools/1.3.1/mootools-yui-compressed.js", "mootools.min.js"
4
+ end
5
+
6
+ gsub_file "config/application.rb", /# JavaScript.*\n/, ""
7
+ gsub_file "config/application.rb", /# config\.action_view\.javascript.*\n/, ""
8
+
9
+ application do
10
+ "\n config.action_view.javascript_expansions[:defaults] = %w(mootools.min rails)\n"
11
+ end
12
+
13
+ __END__
14
+
15
+ name: MooTools
16
+ description: "Adds MooTools and MooTools-compatible UJS helpers."
17
+ author: mbleigh
18
+
19
+ exclusive: javascript_framework
20
+ category: assets
21
+ tags: [javascript, framework]
22
+
23
+ args: ["-J"]
@@ -0,0 +1,15 @@
1
+ gem 'omniauth', '~> 0.2.0'
2
+
3
+ after_bundler do
4
+ file 'app/controllers/sessions_controller.rb', "class SessionsController < ApplicationController\n def callback\n auth # Do what you want with the auth hash!\n end\n\n def auth; request.env['omniauth.auth'] end\nend"
5
+ route "match '/auth/:provider/callback', :to => 'sessions#callback'"
6
+ end
7
+
8
+ __END__
9
+
10
+ name: OmniAuth
11
+ description: "A basic setup of OmniAuth with a SessionsController to handle the request and callback phases."
12
+ author: mbleigh
13
+
14
+ exclusive: authentication
15
+ category: authentication
data/recipes/pow.rb ADDED
@@ -0,0 +1,12 @@
1
+ run "ln -s #{destination_root} ~/.pow/#{app_name}"
2
+ say_wizard "App is available at http://#{app_name}.dev/"
3
+
4
+ __END__
5
+
6
+ name: Pow
7
+ description: "Automatically create a symlink for Pow."
8
+ author: mbleigh
9
+
10
+ category: other
11
+ tags: [dev]
12
+
@@ -0,0 +1,11 @@
1
+ # No extra code required.
2
+
3
+ __END__
4
+
5
+ name: Prototype
6
+ description: "Use the default Javascript libraries and helpers."
7
+ author: mbleigh
8
+
9
+ exclusive: javascript_framework
10
+ category: assets
11
+ tags: [javascript, framework, defaults]
@@ -0,0 +1,21 @@
1
+ gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
2
+
3
+ after_bundler do
4
+ generate 'rails_admin:install_admin'
5
+ rake 'admin:copy_assets'
6
+ rake 'admin:ckeditor_download' if config['ckeditor']
7
+ end
8
+
9
+ __END__
10
+
11
+ name: RailsAdmin
12
+ description: "Install RailsAdmin to manage data in your application"
13
+ author: alno
14
+
15
+ category: other
16
+
17
+ config:
18
+ - ckeditor:
19
+ type: boolean
20
+ prompt: Install CKEditor?
21
+
data/recipes/redis.rb ADDED
@@ -0,0 +1,17 @@
1
+ gem 'redis'
2
+
3
+ say_wizard "Generating Redis initializer..."
4
+
5
+ initializer "redis.rb", <<-RUBY
6
+ REDIS = Redis.new
7
+ RUBY
8
+
9
+ __END__
10
+
11
+ name: Redis
12
+ description: "Add Redis as a persistence engine to your application."
13
+ author: mbleigh
14
+
15
+ exclusive: key_value
16
+ category: persistence
17
+ tags: [key_value, cache, session_store]
@@ -0,0 +1,40 @@
1
+ prepend_file "config/initializers/redis.rb", <<-RUBY
2
+ uri = URI.parse(ENV['REDISTOGO_URL'])
3
+
4
+ RUBY
5
+
6
+ inject_into_file "config/initializers/redis.rb", :after => "Redis.new" do
7
+ "(:host => uri.host, :port => uri.port, :password => uri.password)"
8
+ end
9
+
10
+ env("REDISTOGO_URL", "redis://localhost:6379")
11
+
12
+ after_everything do
13
+ if config['use_heroku']
14
+ say_wizard "Adding redistogo:nano Heroku addon, you can always upgrade later."
15
+ run "heroku addons:add redistogo:nano"
16
+ else
17
+ env("REDISTOGO_URL", config['url'], 'production') if config['url']
18
+ end
19
+ end
20
+
21
+ __END__
22
+
23
+ name: RedisToGo
24
+ description: "Use RedisToGo hosting for this app's Redis."
25
+ author: mbleigh
26
+
27
+ requires: [redis, env_yaml]
28
+ run_after: [redis, env_yaml]
29
+ category: services
30
+
31
+ config:
32
+ - use_heroku:
33
+ type: boolean
34
+ prompt: "Use the RedisToGo Heroku addon?"
35
+ if_recipe: heroku
36
+ - url:
37
+ type: string
38
+ prompt: "Enter your RedisToGo URL:"
39
+ unless: use_heroku
40
+
@@ -0,0 +1,17 @@
1
+ gem 'right-rails'
2
+
3
+ after_bundler do
4
+ generate 'right_rails'
5
+ end
6
+
7
+ __END__
8
+
9
+ name: RightJS
10
+ description: "Use RightJS in place of Prototype for this application."
11
+ author: mbleigh
12
+
13
+ exclusive: javascript_framework
14
+ category: assets
15
+ tags: [javascript, framework]
16
+
17
+ args: ["-J"]
data/recipes/rspec.rb ADDED
@@ -0,0 +1,89 @@
1
+ # Application template recipe for the rails3_devise_wizard. Check for a newer version here:
2
+ # https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/rspec.rb
3
+
4
+ gem 'rspec-rails', '>= 2.5.0', :group => [:development, :test]
5
+ if recipes.include? 'mongoid'
6
+ # use the database_cleaner gem to reset the test database
7
+ gem 'database_cleaner', '>= 0.6.6', :group => :test
8
+ # include RSpec matchers from the mongoid-rspec gem
9
+ gem 'mongoid-rspec', ">= 1.4.1", :group => :test
10
+ end
11
+ if config['factory_girl']
12
+ # use the factory_girl gem for test fixtures
13
+ gem 'factory_girl_rails', ">= 1.1.beta1", :group => :test
14
+ end
15
+
16
+ # note: there is no need to specify the RSpec generator in the config/application.rb file
17
+
18
+ after_bundler do
19
+ generate 'rspec:install'
20
+
21
+ # remove ActiveRecord artifacts
22
+ gsub_file 'spec/spec_helper.rb', /config.fixture_path/, '# config.fixture_path'
23
+ gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures/, '# config.use_transactional_fixtures'
24
+
25
+ if recipes.include? 'mongoid'
26
+ # reset your application database to a pristine state during testing
27
+ inject_into_file 'spec/spec_helper.rb', :before => "\nend" do
28
+ <<-RUBY
29
+ \n
30
+ # Clean up the database
31
+ require 'database_cleaner'
32
+ config.before(:suite) do
33
+ DatabaseCleaner.strategy = :truncation
34
+ DatabaseCleaner.orm = "mongoid"
35
+ end
36
+
37
+ config.before(:each) do
38
+ DatabaseCleaner.clean
39
+ end
40
+ RUBY
41
+ end
42
+ end
43
+
44
+ # remove either possible occurrence of "require rails/test_unit/railtie"
45
+ gsub_file 'config/application.rb', /require 'rails\/test_unit\/railtie'/, '# require "rails/test_unit/railtie"'
46
+ gsub_file 'config/application.rb', /require "rails\/test_unit\/railtie"/, '# require "rails/test_unit/railtie"'
47
+
48
+ say_wizard "Removing test folder (not needed for RSpec)"
49
+ run 'rm -rf test/'
50
+
51
+ if recipes.include? 'mongoid'
52
+ # configure RSpec to use matchers from the mongoid-rspec gem
53
+ create_file 'spec/support/mongoid.rb' do
54
+ <<-RUBY
55
+ RSpec.configure do |config|
56
+ config.include Mongoid::Matchers
57
+ end
58
+ RUBY
59
+ end
60
+ end
61
+
62
+ if recipes.include? 'devise'
63
+ # add Devise test helpers
64
+ create_file 'spec/support/devise.rb' do
65
+ <<-RUBY
66
+ RSpec.configure do |config|
67
+ config.include Devise::TestHelpers, :type => :controller
68
+ end
69
+ RUBY
70
+ end
71
+ end
72
+
73
+ end
74
+
75
+ __END__
76
+
77
+ name: RSpec
78
+ description: "Use RSpec for unit testing for this Rails app."
79
+ author: fortuity
80
+
81
+ exclusive: unit_testing
82
+ category: testing
83
+
84
+ args: ["-T"]
85
+
86
+ config:
87
+ - factory_girl:
88
+ type: boolean
89
+ prompt: Install the factory_girl gem for test fixtures?
data/recipes/sass.rb ADDED
@@ -0,0 +1,13 @@
1
+ unless recipes.include? 'haml'
2
+ gem 'haml', '>= 3.0.0'
3
+ end
4
+
5
+ __END__
6
+
7
+ name: SASS
8
+ description: "Utilize SASS (through the HAML gem) for really awesome stylesheets!"
9
+ author: mbleigh
10
+
11
+ exclusive: css_replacement
12
+ category: assets
13
+ tags: [css]