ey_rails_wizard 0.3.1 → 0.4.0
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.
- data/ChangeLog.md +8 -0
- data/README.md +21 -17
- data/Rakefile +21 -6
- data/lib/rails_wizard.rb +5 -5
- data/lib/rails_wizard/command.rb +29 -23
- data/lib/rails_wizard/config.rb +6 -6
- data/lib/rails_wizard/{recipe.rb → scroll.rb} +10 -10
- data/lib/rails_wizard/{recipes.rb → scrolls.rb} +9 -9
- data/lib/rails_wizard/template.rb +23 -23
- data/sample.rb +2 -2
- data/{recipes → scrolls}/active_admin.rb +1 -1
- data/{recipes → scrolls}/activerecord.rb +0 -0
- data/{recipes → scrolls}/cancan.rb +0 -0
- data/{recipes → scrolls}/capybara.rb +0 -0
- data/{recipes → scrolls}/carrierwave.rb +0 -0
- data/{recipes → scrolls}/carrierwave_direct.rb +0 -0
- data/{recipes → scrolls}/cartographer.rb +0 -0
- data/{recipes → scrolls}/cucumber.rb +1 -1
- data/scrolls/delayed_job.rb +94 -0
- data/{recipes → scrolls}/devise.rb +2 -2
- data/{recipes → scrolls}/devise_invitable.rb +0 -0
- data/{recipes → scrolls}/env_yaml.rb +0 -0
- data/{recipes → scrolls}/event_calendar.rb +0 -0
- data/scrolls/eycloud.rb +62 -0
- data/{recipes → scrolls}/eycloud_recipes_on_deploy.rb +1 -1
- data/{recipes → scrolls}/factory_girl.rb +1 -1
- data/{recipes → scrolls}/ffaker.rb +0 -0
- data/{recipes → scrolls}/fixture_builder.rb +0 -0
- data/{recipes → scrolls}/forgery.rb +0 -0
- data/{recipes → scrolls}/git.rb +0 -0
- data/scrolls/github.rb +31 -0
- data/{recipes → scrolls}/haml.rb +0 -0
- data/{recipes → scrolls}/heroku.rb +0 -0
- data/{recipes → scrolls}/hoptoad.rb +1 -1
- data/{recipes → scrolls}/inherited_resources.rb +0 -0
- data/scrolls/intercom.rb +35 -0
- data/{recipes → scrolls}/jammit.rb +0 -0
- data/{recipes → scrolls}/jasmine.rb +0 -0
- data/{recipes → scrolls}/jquery.rb +0 -0
- data/{recipes → scrolls}/mini_magick.rb +0 -0
- data/{recipes → scrolls}/mongo_mapper.rb +0 -0
- data/{recipes → scrolls}/mongohq.rb +2 -2
- data/{recipes → scrolls}/mongoid.rb +0 -0
- data/{recipes → scrolls}/mootools.rb +0 -0
- data/{recipes → scrolls}/mysql.rb +12 -2
- data/scrolls/newrelic.rb +11 -0
- data/{recipes → scrolls}/nifty_generators.rb +1 -1
- data/{recipes → scrolls}/oa_oauth.rb +0 -0
- data/{recipes → scrolls}/omniauth.rb +0 -0
- data/{recipes → scrolls}/paper_trail.rb +0 -0
- data/{recipes → scrolls}/pow.rb +0 -0
- data/{recipes → scrolls}/prototype.rb +0 -0
- data/{recipes → scrolls}/puma.rb +0 -0
- data/{recipes → scrolls}/rails_admin.rb +0 -0
- data/{recipes → scrolls}/rails_basics.rb +9 -4
- data/{recipes → scrolls}/rails_dev_tweaks.rb +0 -0
- data/{recipes → scrolls}/rails_erd.rb +0 -0
- data/{recipes → scrolls}/rails_footnotes.rb +0 -0
- data/{recipes → scrolls}/ransack.rb +0 -0
- data/{recipes → scrolls}/redis.rb +4 -0
- data/scrolls/resque.rb +70 -0
- data/{recipes → scrolls}/rmagick.rb +0 -0
- data/{recipes → scrolls}/rspec.rb +0 -0
- data/{recipes → scrolls}/sass.rb +1 -1
- data/{recipes → scrolls}/sequel.rb +0 -0
- data/{recipes → scrolls}/settingslogic.rb +0 -0
- data/{recipes → scrolls}/shoulda_matchers.rb +0 -0
- data/scrolls/sidekiq.rb +23 -0
- data/{recipes → scrolls}/simple_form.rb +1 -1
- data/{recipes → scrolls}/slim.rb +0 -0
- data/{recipes → scrolls}/sqlite3.rb +0 -0
- data/{recipes → scrolls}/test_unit.rb +0 -0
- data/{recipes → scrolls}/thin.rb +0 -0
- data/{recipes → scrolls}/thinking_sphinx.rb +0 -0
- data/{recipes → scrolls}/twitter_bootstrap_rails.rb +1 -1
- data/{recipes → scrolls}/unicorn.rb +0 -0
- data/spec/rails_wizard/config_spec.rb +6 -6
- data/spec/rails_wizard/recipe_spec.rb +16 -16
- data/spec/rails_wizard/recipes/sanity_spec.rb +13 -13
- data/spec/rails_wizard/recipes_spec.rb +9 -9
- data/spec/rails_wizard/template_spec.rb +15 -15
- data/templates/helpers.erb +9 -9
- data/templates/layout.erb +7 -7
- data/templates/new_scroll.erb +20 -0
- data/templates/{recipe.erb → scroll.erb} +3 -3
- data/version.rb +1 -1
- metadata +88 -83
- data/recipes/delayed_job.rb +0 -16
- data/recipes/eycloud.rb +0 -30
- 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
|
27
|
+
The project was created with the following scrolls:
|
28
28
|
|
29
|
-
#{
|
29
|
+
#{ scrolls.map {|r| "* #{r}"}.join("\n")}
|
30
30
|
|
31
31
|
README
|
32
32
|
|
33
|
-
if
|
33
|
+
if scrolls.include? 'git'
|
34
34
|
append_file ".gitignore", "\nconfig/database.yml"
|
35
|
-
append_file ".gitignore", "\
|
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
|
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
|
data/{recipes → scrolls}/sass.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
data/scrolls/sidekiq.rb
ADDED
@@ -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]
|
data/{recipes → scrolls}/slim.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
data/{recipes → scrolls}/thin.rb
RENAMED
File without changes
|
File without changes
|
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
|
-
|
48
|
+
if_scroll: awesome
|
49
49
|
- multiple_choice:
|
50
50
|
type: multiple_choice
|
51
51
|
choices: [[ABC, abc], [DEF, def]]
|
52
|
-
|
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 "
|
69
|
-
lines[2].should be_include("
|
68
|
+
it 'should handle "if_scroll"' do
|
69
|
+
lines[2].should be_include("scroll?('awesome')")
|
70
70
|
end
|
71
71
|
|
72
|
-
it 'should handle "
|
73
|
-
lines[3].should be_include("!
|
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::
|
4
|
-
context "with a generated
|
5
|
-
subject{ RailsWizard::
|
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::
|
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
|
-
|
30
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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::
|
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("
|
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
|
-
|
71
|
+
scroll = RailsWizard::Scroll.generate('abc','# test')
|
72
72
|
|
73
|
-
RailsWizard::
|
74
|
-
|
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::
|
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
|
4
|
+
# all of the scrolls conform to the base requirements.
|
5
5
|
|
6
|
-
RailsWizard::
|
7
|
-
describe
|
8
|
-
it("should have a name"){
|
9
|
-
it("should have a description"){
|
10
|
-
it("should have a template"){
|
11
|
-
it("should be able to compile"){
|
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
|
15
|
-
|
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
|
21
|
-
|
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::
|
27
|
-
RailsWizard::
|
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::
|
4
|
-
subject{ RailsWizard::
|
5
|
-
let(:
|
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::
|
8
|
+
RailsWizard::Scrolls.add(scroll)
|
9
9
|
end
|
10
10
|
|
11
|
-
it '.list_classes should include
|
12
|
-
subject.list_classes.should be_include(
|
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
|
16
|
-
subject.list.should be_include('
|
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::
|
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(:
|
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([
|
9
|
+
subject.new([scroll]).scrolls.should == [scroll]
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
describe '#
|
13
|
+
describe '#scrolls_with_dependencies' do
|
14
14
|
def r(*deps)
|
15
|
-
mock(:Class, :requires => deps, :superclass => RailsWizard::
|
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!(:
|
21
|
-
@template.stub!(:
|
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
|
26
|
-
@
|
27
|
-
subject.
|
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
|
-
@
|
32
|
-
subject.
|
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
|
-
@
|
37
|
-
subject.
|
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
|
-
@
|
45
|
-
subject.
|
44
|
+
@scrolls = [a,b,c]
|
45
|
+
subject.scrolls_with_dependencies.size.should == 4
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|