ey_rails_wizard 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/ChangeLog.md +8 -0
  2. data/README.md +21 -17
  3. data/Rakefile +21 -6
  4. data/lib/rails_wizard.rb +5 -5
  5. data/lib/rails_wizard/command.rb +29 -23
  6. data/lib/rails_wizard/config.rb +6 -6
  7. data/lib/rails_wizard/{recipe.rb → scroll.rb} +10 -10
  8. data/lib/rails_wizard/{recipes.rb → scrolls.rb} +9 -9
  9. data/lib/rails_wizard/template.rb +23 -23
  10. data/sample.rb +2 -2
  11. data/{recipes → scrolls}/active_admin.rb +1 -1
  12. data/{recipes → scrolls}/activerecord.rb +0 -0
  13. data/{recipes → scrolls}/cancan.rb +0 -0
  14. data/{recipes → scrolls}/capybara.rb +0 -0
  15. data/{recipes → scrolls}/carrierwave.rb +0 -0
  16. data/{recipes → scrolls}/carrierwave_direct.rb +0 -0
  17. data/{recipes → scrolls}/cartographer.rb +0 -0
  18. data/{recipes → scrolls}/cucumber.rb +1 -1
  19. data/scrolls/delayed_job.rb +94 -0
  20. data/{recipes → scrolls}/devise.rb +2 -2
  21. data/{recipes → scrolls}/devise_invitable.rb +0 -0
  22. data/{recipes → scrolls}/env_yaml.rb +0 -0
  23. data/{recipes → scrolls}/event_calendar.rb +0 -0
  24. data/scrolls/eycloud.rb +62 -0
  25. data/{recipes → scrolls}/eycloud_recipes_on_deploy.rb +1 -1
  26. data/{recipes → scrolls}/factory_girl.rb +1 -1
  27. data/{recipes → scrolls}/ffaker.rb +0 -0
  28. data/{recipes → scrolls}/fixture_builder.rb +0 -0
  29. data/{recipes → scrolls}/forgery.rb +0 -0
  30. data/{recipes → scrolls}/git.rb +0 -0
  31. data/scrolls/github.rb +31 -0
  32. data/{recipes → scrolls}/haml.rb +0 -0
  33. data/{recipes → scrolls}/heroku.rb +0 -0
  34. data/{recipes → scrolls}/hoptoad.rb +1 -1
  35. data/{recipes → scrolls}/inherited_resources.rb +0 -0
  36. data/scrolls/intercom.rb +35 -0
  37. data/{recipes → scrolls}/jammit.rb +0 -0
  38. data/{recipes → scrolls}/jasmine.rb +0 -0
  39. data/{recipes → scrolls}/jquery.rb +0 -0
  40. data/{recipes → scrolls}/mini_magick.rb +0 -0
  41. data/{recipes → scrolls}/mongo_mapper.rb +0 -0
  42. data/{recipes → scrolls}/mongohq.rb +2 -2
  43. data/{recipes → scrolls}/mongoid.rb +0 -0
  44. data/{recipes → scrolls}/mootools.rb +0 -0
  45. data/{recipes → scrolls}/mysql.rb +12 -2
  46. data/scrolls/newrelic.rb +11 -0
  47. data/{recipes → scrolls}/nifty_generators.rb +1 -1
  48. data/{recipes → scrolls}/oa_oauth.rb +0 -0
  49. data/{recipes → scrolls}/omniauth.rb +0 -0
  50. data/{recipes → scrolls}/paper_trail.rb +0 -0
  51. data/{recipes → scrolls}/pow.rb +0 -0
  52. data/{recipes → scrolls}/prototype.rb +0 -0
  53. data/{recipes → scrolls}/puma.rb +0 -0
  54. data/{recipes → scrolls}/rails_admin.rb +0 -0
  55. data/{recipes → scrolls}/rails_basics.rb +9 -4
  56. data/{recipes → scrolls}/rails_dev_tweaks.rb +0 -0
  57. data/{recipes → scrolls}/rails_erd.rb +0 -0
  58. data/{recipes → scrolls}/rails_footnotes.rb +0 -0
  59. data/{recipes → scrolls}/ransack.rb +0 -0
  60. data/{recipes → scrolls}/redis.rb +4 -0
  61. data/scrolls/resque.rb +70 -0
  62. data/{recipes → scrolls}/rmagick.rb +0 -0
  63. data/{recipes → scrolls}/rspec.rb +0 -0
  64. data/{recipes → scrolls}/sass.rb +1 -1
  65. data/{recipes → scrolls}/sequel.rb +0 -0
  66. data/{recipes → scrolls}/settingslogic.rb +0 -0
  67. data/{recipes → scrolls}/shoulda_matchers.rb +0 -0
  68. data/scrolls/sidekiq.rb +23 -0
  69. data/{recipes → scrolls}/simple_form.rb +1 -1
  70. data/{recipes → scrolls}/slim.rb +0 -0
  71. data/{recipes → scrolls}/sqlite3.rb +0 -0
  72. data/{recipes → scrolls}/test_unit.rb +0 -0
  73. data/{recipes → scrolls}/thin.rb +0 -0
  74. data/{recipes → scrolls}/thinking_sphinx.rb +0 -0
  75. data/{recipes → scrolls}/twitter_bootstrap_rails.rb +1 -1
  76. data/{recipes → scrolls}/unicorn.rb +0 -0
  77. data/spec/rails_wizard/config_spec.rb +6 -6
  78. data/spec/rails_wizard/recipe_spec.rb +16 -16
  79. data/spec/rails_wizard/recipes/sanity_spec.rb +13 -13
  80. data/spec/rails_wizard/recipes_spec.rb +9 -9
  81. data/spec/rails_wizard/template_spec.rb +15 -15
  82. data/templates/helpers.erb +9 -9
  83. data/templates/layout.erb +7 -7
  84. data/templates/new_scroll.erb +20 -0
  85. data/templates/{recipe.erb → scroll.erb} +3 -3
  86. data/version.rb +1 -1
  87. metadata +88 -83
  88. data/recipes/delayed_job.rb +0 -16
  89. data/recipes/eycloud.rb +0 -30
  90. data/recipes/resque.rb +0 -37
File without changes
@@ -24,17 +24,20 @@ ey deploy
24
24
 
25
25
  The original scaffold for this application was created by [Engine Yard Rails Wizard](http://railswizard.engineyard.com).
26
26
 
27
- The project was created with the following recipes:
27
+ The project was created with the following scrolls:
28
28
 
29
- #{ recipes.map {|r| "* #{r}"}.join("\n")}
29
+ #{ scrolls.map {|r| "* #{r}"}.join("\n")}
30
30
 
31
31
  README
32
32
 
33
- if recipes.include? 'git'
33
+ if scrolls.include? 'git'
34
34
  append_file ".gitignore", "\nconfig/database.yml"
35
- append_file ".gitignore", "\public/system"
35
+ append_file ".gitignore", "\npublic/system"
36
36
  end
37
37
 
38
+ end
39
+
40
+ after_everything do
38
41
  rake "db:migrate"
39
42
  end
40
43
 
@@ -43,3 +46,5 @@ __END__
43
46
  name: Rails Basics
44
47
  description: Best practices for new Rails apps
45
48
  author: drnic
49
+
50
+ run_before: [git]
File without changes
File without changes
File without changes
File without changes
@@ -4,6 +4,10 @@ initializer "redis.rb", <<-RUBY
4
4
  REDIS = Redis.new
5
5
  RUBY
6
6
 
7
+ if scroll? "eycloud_recipes_on_deploy"
8
+ gem 'eycloud-recipe-redis', :group => :eycloud
9
+ end
10
+
7
11
  __END__
8
12
 
9
13
  name: Redis
data/scrolls/resque.rb ADDED
@@ -0,0 +1,70 @@
1
+ gem 'resque'
2
+
3
+ say_wizard 'Applying fix suggested in https://github.com/defunkt/resque/pull/403...'
4
+ append_file "Rakefile", "\ntask 'resque:setup' => :environment # for https://github.com/defunkt/resque/pull/403\n"
5
+
6
+ if scroll? "eycloud_recipes_on_deploy"
7
+ gem 'eycloud-scroll-resque', :group => :eycloud
8
+
9
+
10
+ create_file "config/initializers/resque.rb", <<-RUBY
11
+ resque_yml = File.expand_path('../../resque.yml', __FILE__)
12
+ if File.exist?(resque_yml)
13
+ Resque.redis = YAML.load_file(resque_yml)["redis_uri"]
14
+ end
15
+ RUBY
16
+ end
17
+
18
+ after_bundler do
19
+ say_wizard 'Adding resque.rake task to lib/tasks'
20
+ create_file "lib/tasks/resque.rake", <<-RAKE
21
+ require 'resque/tasks'
22
+ RAKE
23
+
24
+ unless config['admin_secret'].blank?
25
+ route <<-ROUTE
26
+ require "resque/server"
27
+ mount Resque::Server.new, :at => "/resque/#{config['admin_secret']}"
28
+ ROUTE
29
+
30
+ end
31
+ if scroll? "eycloud_recipes_on_deploy"
32
+
33
+ say_wizard 'Installing deploy hooks to restart resque after deploys'
34
+ run "touch deploy/before_restart.rb"
35
+ append_file "deploy/before_restart.rb", <<-RUBY
36
+ on_app_servers_and_utilities do
37
+ node[:applications].each do |app_name, data|
38
+ sudo 'echo "sleep 20 && monit -g \#{app_name}_resque restart all" | at now'
39
+ end
40
+ end
41
+ RUBY
42
+
43
+ append_file "deploy/cookbooks/main/scrolls/default.rb", "\nrequire_scroll 'resque'\n"
44
+ end
45
+
46
+ end
47
+
48
+ __END__
49
+
50
+ name: Resque
51
+ description: Add Resque to handle background jobs
52
+ author: drnic
53
+ website: https://github.com/defunkt/resque
54
+
55
+ requires: [redis]
56
+ run_after: [redis, eycloud_recipes_on_deploy]
57
+
58
+ category: worker
59
+ tags: [background, worker]
60
+ exclusive: worker
61
+
62
+ config:
63
+ - admin:
64
+ type: boolean
65
+ prompt: "Install the great admin interface to Resque?"
66
+
67
+ - admin_secret:
68
+ type: string
69
+ prompt: "Enter a secret string for the route /resque/YOUR-SECRET-STRING:"
70
+ if: admin
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- unless recipes.include? 'haml'
1
+ unless scrolls.include? 'haml'
2
2
  gem 'haml', '>= 3.0.0'
3
3
  end
4
4
 
File without changes
File without changes
File without changes
@@ -0,0 +1,23 @@
1
+ gem "sidekiq"
2
+
3
+ if scroll? "eycloud_recipes_on_deploy"
4
+ gem "eycloud-recipe-sidekiq", :group => :eycloud
5
+
6
+ append_file "deploy/cookbooks/main/recipes/default.rb", <<-RUBY
7
+
8
+ require_recipe "sidekiq"
9
+ RUBY
10
+ end
11
+
12
+ __END__
13
+
14
+ name: Sidekiq
15
+ description: Simple, efficient message processing for your Rails 3 application
16
+ author: drnic
17
+
18
+ exclusive: worker
19
+ category: worker
20
+ tags: [worker,background-tasks]
21
+
22
+ requires: [redis]
23
+ run_after: [redis, eycloud_recipes_on_deploy]
@@ -1,7 +1,7 @@
1
1
  gem 'simple_form'
2
2
 
3
3
  after_bundler do
4
- if recipe? "twitter_bootstrap_rails"
4
+ if scroll? "twitter_bootstrap_rails"
5
5
  generate "simple_form:install --bootstrap"
6
6
  else
7
7
  generate "simple_form:install"
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -137,6 +137,6 @@ config:
137
137
  - use_simple_form:
138
138
  type: boolean
139
139
  prompt: "Using Simple Form?"
140
- if_recipe: simple_form
140
+ if_scroll: simple_form
141
141
 
142
142
 
File without changes
@@ -45,11 +45,11 @@ describe RailsWizard::Config do
45
45
  type: boolean
46
46
  prompt: Yes or no?
47
47
  unless: is_false
48
- if_recipe: awesome
48
+ if_scroll: awesome
49
49
  - multiple_choice:
50
50
  type: multiple_choice
51
51
  choices: [[ABC, abc], [DEF, def]]
52
- unless_recipe: awesome
52
+ unless_scroll: awesome
53
53
  YAML
54
54
  end
55
55
 
@@ -65,12 +65,12 @@ describe RailsWizard::Config do
65
65
  lines[2].should be_include("!config['is_false']")
66
66
  end
67
67
 
68
- it 'should handle "if_recipe"' do
69
- lines[2].should be_include("recipe?('awesome')")
68
+ it 'should handle "if_scroll"' do
69
+ lines[2].should be_include("scroll?('awesome')")
70
70
  end
71
71
 
72
- it 'should handle "unelss_recipe"' do
73
- lines[3].should be_include("!recipe?('awesome')")
72
+ it 'should handle "unelss_scroll"' do
73
+ lines[3].should be_include("!scroll?('awesome')")
74
74
  end
75
75
  end
76
76
 
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe RailsWizard::Recipe do
4
- context "with a generated recipe" do
5
- subject{ RailsWizard::Recipe.generate('recipe_example', "# this is a test", :category => 'example', :name => "RailsWizard Example") }
3
+ describe RailsWizard::Scroll do
4
+ context "with a generated scroll" do
5
+ subject{ RailsWizard::Scroll.generate('scroll_example', "# this is a test", :category => 'example', :name => "RailsWizard Example") }
6
6
 
7
7
  context 'string setter methods' do
8
- (RailsWizard::Recipe::ATTRIBUTES - ['config']).each do |setter|
8
+ (RailsWizard::Scroll::ATTRIBUTES - ['config']).each do |setter|
9
9
  it "should be able to set #{setter} with an argument" do
10
10
  subject.send(setter + '=', "test")
11
11
  subject.send(setter).should == 'test'
@@ -26,8 +26,8 @@ describe RailsWizard::Recipe do
26
26
 
27
27
  describe '.generate' do
28
28
  it 'should work with a string and hash as arguments' do
29
- recipe = RailsWizard::Recipe.generate('some_key', '# some code', :name => "Example")
30
- recipe.superclass.should == RailsWizard::Recipe
29
+ scroll = RailsWizard::Scroll.generate('some_key', '# some code', :name => "Example")
30
+ scroll.superclass.should == RailsWizard::Scroll
31
31
  end
32
32
 
33
33
  it 'should work with an IO object' do
@@ -40,24 +40,24 @@ category: example
40
40
  name: This is an Example
41
41
  description: You know it's an exmaple.
42
42
  RUBY
43
- recipe = RailsWizard::Recipe.generate('just_a_test', file)
44
- recipe.template.should == '# this is an example'
45
- recipe.category.should == 'example'
46
- recipe.name.should == 'This is an Example'
43
+ scroll = RailsWizard::Scroll.generate('just_a_test', file)
44
+ scroll.template.should == '# this is an example'
45
+ scroll.category.should == 'example'
46
+ scroll.name.should == 'This is an Example'
47
47
  end
48
48
 
49
49
  it 'should raise an exception if the file is incorrectly formatted' do
50
50
  file = StringIO.new <<-RUBY
51
51
  # just ruby, no YAML
52
52
  RUBY
53
- lambda{RailsWizard::Recipe.generate('testing',file)}.should raise_error(ArgumentError)
53
+ lambda{RailsWizard::Scroll.generate('testing',file)}.should raise_error(ArgumentError)
54
54
  end
55
55
  end
56
56
 
57
57
  describe '#compile' do
58
58
  it 'should say the name' do
59
59
  subject.name = "Awesome Sauce"
60
- subject.new.compile.should be_include("say_recipe 'Awesome Sauce'")
60
+ subject.new.compile.should be_include("say_scroll 'Awesome Sauce'")
61
61
  end
62
62
 
63
63
  it 'should include the template' do
@@ -68,15 +68,15 @@ RUBY
68
68
  end
69
69
 
70
70
  it 'should set default attributes' do
71
- recipe = RailsWizard::Recipe.generate('abc','# test')
71
+ scroll = RailsWizard::Scroll.generate('abc','# test')
72
72
 
73
- RailsWizard::Recipe::DEFAULT_ATTRIBUTES.each_pair do |k,v|
74
- recipe.send(k).should == v
73
+ RailsWizard::Scroll::DEFAULT_ATTRIBUTES.each_pair do |k,v|
74
+ scroll.send(k).should == v
75
75
  end
76
76
  end
77
77
 
78
78
  context 'Comparable' do
79
- subject{ RailsWizard::Recipe }
79
+ subject{ RailsWizard::Scroll }
80
80
  it 'a < b.run_after(a)' do
81
81
  A = subject.generate('a', '#')
82
82
  B = subject.generate('b', '#', :run_after => ['a'])
@@ -1,30 +1,30 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  # This is a simple set of tests to make sure that
4
- # all of the recipes conform to the base requirements.
4
+ # all of the scrolls conform to the base requirements.
5
5
 
6
- RailsWizard::Recipes.list_classes.each do |recipe|
7
- describe recipe do
8
- it("should have a name"){ recipe.name.should be_kind_of(String) }
9
- it("should have a description"){ recipe.description.should be_kind_of(String) }
10
- it("should have a template"){ recipe.template.should be_kind_of(String) }
11
- it("should be able to compile"){ recipe.new.compile.should be_kind_of(String) }
6
+ RailsWizard::Scrolls.list_classes.each do |scroll|
7
+ describe scroll do
8
+ it("should have a name"){ scroll.name.should be_kind_of(String) }
9
+ it("should have a description"){ scroll.description.should be_kind_of(String) }
10
+ it("should have a template"){ scroll.template.should be_kind_of(String) }
11
+ it("should be able to compile"){ scroll.new.compile.should be_kind_of(String) }
12
12
 
13
13
  it "should have a string or nil category" do
14
- if recipe.category
15
- recipe.category.should be_kind_of(String)
14
+ if scroll.category
15
+ scroll.category.should be_kind_of(String)
16
16
  end
17
17
  end
18
18
 
19
19
  it "should have a Config or nil config" do
20
- if recipe.config
21
- recipe.config.should be_kind_of(RailsWizard::Config)
20
+ if scroll.config
21
+ scroll.config.should be_kind_of(RailsWizard::Config)
22
22
  end
23
23
  end
24
24
 
25
25
  it "should be in the list" do
26
- RailsWizard::Recipes.list_classes.should be_include(recipe)
27
- RailsWizard::Recipes.list.should be_include(recipe.key)
26
+ RailsWizard::Scrolls.list_classes.should be_include(scroll)
27
+ RailsWizard::Scrolls.list.should be_include(scroll.key)
28
28
  end
29
29
  end
30
30
  end
@@ -1,24 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe RailsWizard::Recipes do
4
- subject{ RailsWizard::Recipes }
5
- let(:recipe){ RailsWizard::Recipe.generate("recipe_test", "# Testing", :name => "Test Recipe", :category => "test", :description => "Just a test.")}
3
+ describe RailsWizard::Scrolls do
4
+ subject{ RailsWizard::Scrolls }
5
+ let(:scroll){ RailsWizard::Scroll.generate("scroll_test", "# Testing", :name => "Test Scroll", :category => "test", :description => "Just a test.")}
6
6
 
7
7
  before(:all) do
8
- RailsWizard::Recipes.add(recipe)
8
+ RailsWizard::Scrolls.add(scroll)
9
9
  end
10
10
 
11
- it '.list_classes should include recipe classes' do
12
- subject.list_classes.should be_include(recipe)
11
+ it '.list_classes should include scroll classes' do
12
+ subject.list_classes.should be_include(scroll)
13
13
  end
14
14
 
15
- it '.list should include recipe keys' do
16
- subject.list.should be_include('recipe_test')
15
+ it '.list should include scroll keys' do
16
+ subject.list.should be_include('scroll_test')
17
17
  end
18
18
 
19
19
  describe '.for' do
20
20
  it 'should find for a given category' do
21
- RailsWizard::Recipes.for('test').should be_include('recipe_test')
21
+ RailsWizard::Scrolls.for('test').should be_include('scroll_test')
22
22
  end
23
23
  end
24
24
  end
@@ -2,47 +2,47 @@ require 'spec_helper'
2
2
 
3
3
  describe RailsWizard::Template do
4
4
  subject{ RailsWizard::Template }
5
- let(:recipe){ RailsWizard::Recipe.generate('name','# test') }
5
+ let(:scroll){ RailsWizard::Scroll.generate('name','# test') }
6
6
 
7
7
  describe '#initialize' do
8
8
  it 'should work with classes' do
9
- subject.new([recipe]).recipes.should == [recipe]
9
+ subject.new([scroll]).scrolls.should == [scroll]
10
10
  end
11
11
  end
12
12
 
13
- describe '#recipes_with_dependencies' do
13
+ describe '#scrolls_with_dependencies' do
14
14
  def r(*deps)
15
- mock(:Class, :requires => deps, :superclass => RailsWizard::Recipe)
15
+ mock(:Class, :requires => deps, :superclass => RailsWizard::Scroll)
16
16
  end
17
17
 
18
18
  subject do
19
19
  @template = RailsWizard::Template.new([])
20
- @template.stub!(:recipes).and_return(@recipes)
21
- @template.stub!(:recipe_classes).and_return(@recipes)
20
+ @template.stub!(:scrolls).and_return(@scrolls)
21
+ @template.stub!(:scroll_classes).and_return(@scrolls)
22
22
  @template
23
23
  end
24
24
 
25
- it 'should return the same number recipes if none have dependencies' do
26
- @recipes = [r, r]
27
- subject.recipes_with_dependencies.size.should == 2
25
+ it 'should return the same number scrolls if none have dependencies' do
26
+ @scrolls = [r, r]
27
+ subject.scrolls_with_dependencies.size.should == 2
28
28
  end
29
29
 
30
30
  it 'should handle simple dependencies' do
31
- @recipes = [r(r, r), r(r)]
32
- subject.recipes_with_dependencies.size.should == 5
31
+ @scrolls = [r(r, r), r(r)]
32
+ subject.scrolls_with_dependencies.size.should == 5
33
33
  end
34
34
 
35
35
  it 'should handle multi-level dependencies' do
36
- @recipes = [r(r(r))]
37
- subject.recipes_with_dependencies.size.should == 3
36
+ @scrolls = [r(r(r))]
37
+ subject.scrolls_with_dependencies.size.should == 3
38
38
  end
39
39
 
40
40
  it 'should uniqify' do
41
41
  a = r
42
42
  b = r(a)
43
43
  c = r(r, a, b)
44
- @recipes = [a,b,c]
45
- subject.recipes_with_dependencies.size.should == 4
44
+ @scrolls = [a,b,c]
45
+ subject.scrolls_with_dependencies.size.should == 4
46
46
  end
47
47
  end
48
48
  end