eldarscrolls 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/ChangeLog.md +63 -0
- data/Gemfile +3 -0
- data/Guardfile +18 -0
- data/MIT_LICENSE +20 -0
- data/README.md +157 -0
- data/Rakefile +78 -0
- data/bin/eldar +7 -0
- data/bin/eldarscrolls +7 -0
- data/eldarscrolls.gemspec +32 -0
- data/features/step_definitions/common_steps.rb +211 -0
- data/features/support/common.rb +51 -0
- data/features/support/env.rb +18 -0
- data/lib/eldarscrolls.rb +10 -0
- data/lib/eldarscrolls/command.rb +85 -0
- data/lib/eldarscrolls/config.rb +86 -0
- data/lib/eldarscrolls/scroll.rb +106 -0
- data/lib/eldarscrolls/scrolls.rb +38 -0
- data/lib/eldarscrolls/template.rb +67 -0
- data/lib/rails/generators/.DS_Store +0 -0
- data/lib/rails/generators/run_template/USAGE +13 -0
- data/lib/rails/generators/run_template/run_template_generator.rb +13 -0
- data/sample.rb +74 -0
- data/scrolls/active_admin.rb +19 -0
- data/scrolls/capybara.rb +34 -0
- data/scrolls/cucumber.rb +21 -0
- data/scrolls/delayed_job.rb +94 -0
- data/scrolls/env_yaml.rb +53 -0
- data/scrolls/eycloud.rb +72 -0
- data/scrolls/eycloud_recipes_on_deploy.rb +20 -0
- data/scrolls/git.rb +17 -0
- data/scrolls/github.rb +38 -0
- data/scrolls/guard.rb +75 -0
- data/scrolls/jquery.rb +11 -0
- data/scrolls/mysql.rb +51 -0
- data/scrolls/passenger.rb +11 -0
- data/scrolls/postgresql.rb +54 -0
- data/scrolls/prototype.rb +21 -0
- data/scrolls/puma.rb +11 -0
- data/scrolls/rails_basics.rb +54 -0
- data/scrolls/redis.rb +19 -0
- data/scrolls/resque.rb +59 -0
- data/scrolls/rspec.rb +21 -0
- data/scrolls/simple_form.rb +19 -0
- data/scrolls/split.rb +35 -0
- data/scrolls/spork.rb +19 -0
- data/scrolls/sqlite3.rb +10 -0
- data/scrolls/test_unit.rb +11 -0
- data/scrolls/thin.rb +10 -0
- data/scrolls/twitter_bootstrap.rb +41 -0
- data/scrolls/unicorn.rb +10 -0
- data/scrolls/zzz/activerecord.rb +69 -0
- data/scrolls/zzz/cancan.rb +16 -0
- data/scrolls/zzz/carrierwave.rb +42 -0
- data/scrolls/zzz/carrierwave_direct.rb +13 -0
- data/scrolls/zzz/cartographer.rb +33 -0
- data/scrolls/zzz/devise.rb +52 -0
- data/scrolls/zzz/devise_invitable.rb +23 -0
- data/scrolls/zzz/event_calendar.rb +12 -0
- data/scrolls/zzz/factory_girl.rb +38 -0
- data/scrolls/zzz/ffaker.rb +22 -0
- data/scrolls/zzz/fixture_builder.rb +35 -0
- data/scrolls/zzz/forgery.rb +15 -0
- data/scrolls/zzz/haml.rb +11 -0
- data/scrolls/zzz/heroku.rb +58 -0
- data/scrolls/zzz/hoptoad.rb +34 -0
- data/scrolls/zzz/inherited_resources.rb +12 -0
- data/scrolls/zzz/intercom.rb +35 -0
- data/scrolls/zzz/jammit.rb +43 -0
- data/scrolls/zzz/jasmine.rb +12 -0
- data/scrolls/zzz/mini_magick.rb +13 -0
- data/scrolls/zzz/mongo_mapper.rb +20 -0
- data/scrolls/zzz/mongohq.rb +61 -0
- data/scrolls/zzz/mongoid.rb +20 -0
- data/scrolls/zzz/mootools.rb +23 -0
- data/scrolls/zzz/newrelic.rb +11 -0
- data/scrolls/zzz/nifty_generators.rb +21 -0
- data/scrolls/zzz/oa_oauth.rb +12 -0
- data/scrolls/zzz/omniauth.rb +55 -0
- data/scrolls/zzz/paper_trail.rb +17 -0
- data/scrolls/zzz/pow.rb +12 -0
- data/scrolls/zzz/rails_admin.rb +22 -0
- data/scrolls/zzz/rails_dev_tweaks.rb +10 -0
- data/scrolls/zzz/rails_erd.rb +9 -0
- data/scrolls/zzz/rails_footnotes.rb +14 -0
- data/scrolls/zzz/ransack.rb +32 -0
- data/scrolls/zzz/rmagick.rb +13 -0
- data/scrolls/zzz/sass.rb +13 -0
- data/scrolls/zzz/sequel.rb +13 -0
- data/scrolls/zzz/settingslogic.rb +43 -0
- data/scrolls/zzz/shoulda_matchers.rb +11 -0
- data/scrolls/zzz/sidekiq.rb +23 -0
- data/scrolls/zzz/slim.rb +11 -0
- data/scrolls/zzz/thinking_sphinx.rb +14 -0
- data/scrolls/zzz/vanity.rb +35 -0
- data/spec/eldarscrolls/config_spec.rb +99 -0
- data/spec/eldarscrolls/scroll_spec.rb +103 -0
- data/spec/eldarscrolls/scrolls/sanity_spec.rb +30 -0
- data/spec/eldarscrolls/scrolls_spec.rb +24 -0
- data/spec/eldarscrolls/template_spec.rb +57 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/rails_directory.rb +17 -0
- data/spec/support/template_runner.rb +28 -0
- data/templates/helpers.erb +45 -0
- data/templates/layout.erb +43 -0
- data/templates/new_scroll.erb +28 -0
- data/templates/scroll.erb +10 -0
- data/version.rb +3 -0
- metadata +299 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
gem "nifty-generators"
|
2
|
+
after_bundler do
|
3
|
+
remove_file 'app/views/layouts/application.html.erb' # use nifty layout instead
|
4
|
+
|
5
|
+
if scrolls.include? 'haml'
|
6
|
+
generate 'nifty:layout --haml'
|
7
|
+
else
|
8
|
+
generate 'nifty:layout'
|
9
|
+
end
|
10
|
+
|
11
|
+
generate 'nifty:config'
|
12
|
+
|
13
|
+
end
|
14
|
+
__END__
|
15
|
+
|
16
|
+
name: nifty-generators
|
17
|
+
description: "Use RyanB's nifty template generators."
|
18
|
+
author: amolk
|
19
|
+
|
20
|
+
category: templating
|
21
|
+
exclusive: template_generator
|
@@ -0,0 +1,55 @@
|
|
1
|
+
strategy_gem = ""
|
2
|
+
while strategy_gem.size == 0
|
3
|
+
strategy_gem = ask_wizard "Which rubygem contains the strategy you choose? (e.g. 'omniauth-github'; press ENTER to see all)"
|
4
|
+
|
5
|
+
if strategy_gem.size == 0
|
6
|
+
say_custom "omniauth", "Displaying all strategies"
|
7
|
+
run "gem list --remote omniauth-"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
gem 'omniauth', '~> 1.0'
|
12
|
+
gem strategy_gem
|
13
|
+
|
14
|
+
if strategy_gem =~ /omniauth-(.*)(?:-provider)?/
|
15
|
+
strategy = $1
|
16
|
+
else
|
17
|
+
strategy = "unknown"
|
18
|
+
end
|
19
|
+
|
20
|
+
after_bundler do
|
21
|
+
route "match '/auth/:provider/callback', :to => 'sessions#callback'"
|
22
|
+
file 'app/controllers/sessions_controller.rb', <<-RUBY
|
23
|
+
class SessionsController < ApplicationController
|
24
|
+
def callback
|
25
|
+
auth # Do what you want with the auth hash!
|
26
|
+
end
|
27
|
+
|
28
|
+
def auth
|
29
|
+
request.env['omniauth.auth']
|
30
|
+
end
|
31
|
+
end
|
32
|
+
RUBY
|
33
|
+
|
34
|
+
initializer "omniauth.rb", <<-RUBY
|
35
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
36
|
+
provider :#{strategy}, ENV['#{strategy.upcase}_KEY']
|
37
|
+
end
|
38
|
+
RUBY
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
# TODO consult https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-mongoid-omniauth-template.rb
|
43
|
+
|
44
|
+
after_everything do
|
45
|
+
say_custom "omniauth", "NOTICE: Please consult the strategy for final instructions https://github.com/search?q=#{strategy}"
|
46
|
+
end
|
47
|
+
|
48
|
+
__END__
|
49
|
+
|
50
|
+
name: OmniAuth
|
51
|
+
description: "Install OmniAuth and a selected Strategy/Provider"
|
52
|
+
author: drnic
|
53
|
+
|
54
|
+
exclusive: authentication
|
55
|
+
category: authentication
|
@@ -0,0 +1,17 @@
|
|
1
|
+
gem 'paper_trail', '~> 2'
|
2
|
+
|
3
|
+
after_bundler do
|
4
|
+
generate "paper_trail:install"
|
5
|
+
end
|
6
|
+
|
7
|
+
__END__
|
8
|
+
|
9
|
+
name: Paper Trail
|
10
|
+
description: Plugin for tracking changes to your models' data. Good for auditing or versioning.
|
11
|
+
|
12
|
+
category: persistence
|
13
|
+
exclusive: activerecord_versioning
|
14
|
+
tags: [activerecord_versioning]
|
15
|
+
|
16
|
+
|
17
|
+
# TODO eycloud partner version of same name
|
data/scrolls/zzz/pow.rb
ADDED
@@ -0,0 +1,22 @@
|
|
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
|
+
website: https://github.com/sferik/rails_admin
|
15
|
+
|
16
|
+
category: other
|
17
|
+
|
18
|
+
config:
|
19
|
+
- ckeditor:
|
20
|
+
type: boolean
|
21
|
+
prompt: Install CKEditor?
|
22
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
gem 'rails-footnotes', :group => :development
|
2
|
+
|
3
|
+
after_bundler do
|
4
|
+
generate 'rails_footnotes:install'
|
5
|
+
end
|
6
|
+
|
7
|
+
__END__
|
8
|
+
|
9
|
+
name: Rails Footnotes
|
10
|
+
description: Displays footnotes in your application for easy debugging, such as sessions, request parameters, cookies, filter chain, routes, queries, etc
|
11
|
+
|
12
|
+
category: other
|
13
|
+
tags: [debugging]
|
14
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
gem 'ransack'
|
2
|
+
|
3
|
+
create_file "config/initializers/ransack.rb", <<-RUBY
|
4
|
+
Ransack.configure do |config|
|
5
|
+
# config.add_predicate 'equals_diddly', # Name your predicate
|
6
|
+
# # What non-compound ARel predicate will it use? (eq, matches, etc)
|
7
|
+
# :arel_predicate => 'eq',
|
8
|
+
# # Format incoming values as you see fit. (Default: Don't do formatting)
|
9
|
+
# :formatter => proc {|v| "#{v}-diddly"},
|
10
|
+
# # Validate a value. An "invalid" value won't be used in a search.
|
11
|
+
# # Below is default.
|
12
|
+
# :validator => proc {|v| v.present?},
|
13
|
+
# # Should compounds be created? Will use the compound (any/all) version
|
14
|
+
# # of the arel_predicate to create a corresponding any/all version of
|
15
|
+
# # your predicate. (Default: true)
|
16
|
+
# :compounds => true,
|
17
|
+
# # Force a specific column type for type-casting of supplied values.
|
18
|
+
# # (Default: use type from DB column)
|
19
|
+
# :type => :string
|
20
|
+
end
|
21
|
+
RUBY
|
22
|
+
|
23
|
+
__END__
|
24
|
+
|
25
|
+
name: Ransack
|
26
|
+
description: Extensible searching for Rails - successor to ransack
|
27
|
+
|
28
|
+
category: search
|
29
|
+
exclusive: search
|
30
|
+
tags: [search]
|
31
|
+
|
32
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
gem 'rmagick', :require => "RMagick"
|
2
|
+
|
3
|
+
__END__
|
4
|
+
|
5
|
+
name: RMagick
|
6
|
+
description: "Use RMagick to manipulate images via ImageMagick"
|
7
|
+
author: jonochang
|
8
|
+
|
9
|
+
category: other
|
10
|
+
exclusive: image-manipulation
|
11
|
+
tags: [image-manipulation]
|
12
|
+
|
13
|
+
# TODO eycloud
|
data/scrolls/zzz/sass.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
unless scrolls.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, stylesheet]
|
@@ -0,0 +1,43 @@
|
|
1
|
+
gem 'settingslogic'
|
2
|
+
|
3
|
+
say_wizard "Generating config/application.yml..."
|
4
|
+
|
5
|
+
append_file "config/application.rb", <<-RUBY
|
6
|
+
|
7
|
+
require 'settings'
|
8
|
+
RUBY
|
9
|
+
|
10
|
+
create_file "lib/settings.rb", <<-RUBY
|
11
|
+
class Settings < Settingslogic
|
12
|
+
source "#\{Rails.root\}/config/application.yml"
|
13
|
+
namespace Rails.env
|
14
|
+
end
|
15
|
+
|
16
|
+
RUBY
|
17
|
+
|
18
|
+
create_file "config/application.yml", <<-YAML
|
19
|
+
defaults: &defaults
|
20
|
+
cool:
|
21
|
+
saweet: nested settings
|
22
|
+
neat_setting: 24
|
23
|
+
awesome_setting: <%= "Did you know 5 + 5 = #{5 + 5}?" %>
|
24
|
+
|
25
|
+
development:
|
26
|
+
<<: *defaults
|
27
|
+
neat_setting: 800
|
28
|
+
|
29
|
+
test:
|
30
|
+
<<: *defaults
|
31
|
+
|
32
|
+
production:
|
33
|
+
<<: *defaults
|
34
|
+
YAML
|
35
|
+
|
36
|
+
__END__
|
37
|
+
|
38
|
+
name: Settingslogic
|
39
|
+
description: "A simple and straightforward settings solution that uses an ERB enabled YAML file and a singleton design pattern."
|
40
|
+
author: elandesign
|
41
|
+
|
42
|
+
category: other
|
43
|
+
tags: [utilities, configuration]
|
@@ -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/scrolls/zzz/slim.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
gem 'thinking-sphinx', '>= 2.0.4', :require => 'thinking_sphinx'
|
2
|
+
|
3
|
+
|
4
|
+
__END__
|
5
|
+
|
6
|
+
name: Thinking Sphinx
|
7
|
+
description: "Include thinking sphinx to enable search"
|
8
|
+
author: porta
|
9
|
+
website: http://freelancing-god.github.com/ts/en/
|
10
|
+
|
11
|
+
category: search
|
12
|
+
tags: [thinking_sphinx, search]
|
13
|
+
|
14
|
+
requires: [thinking_sphinx]
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# FIXME recipe failing due to https://github.com/assaf/vanity/issues/105
|
2
|
+
|
3
|
+
gem 'vanity'
|
4
|
+
|
5
|
+
after_bundler do
|
6
|
+
generate "vanity"
|
7
|
+
rake "db:migrate"
|
8
|
+
|
9
|
+
inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
|
10
|
+
" use_vanity :current_user\n"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
after_everything do
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
__END__
|
19
|
+
|
20
|
+
name: Vanity
|
21
|
+
description: Experiment Driven Development
|
22
|
+
website: http://vanity.labnotes.org/
|
23
|
+
author: drnic
|
24
|
+
|
25
|
+
requires: []
|
26
|
+
run_after: []
|
27
|
+
run_before: []
|
28
|
+
|
29
|
+
category: other
|
30
|
+
exclusive: ab-testing
|
31
|
+
|
32
|
+
# config:
|
33
|
+
# - foo:
|
34
|
+
# type: boolean
|
35
|
+
# prompt: "Is foo true?"
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EldarScrolls::Config do
|
4
|
+
describe '#initialize' do
|
5
|
+
subject{ EldarScrolls::Config.new(YAML.load(@schema)) }
|
6
|
+
it 'should add a question key for each key of the schema' do
|
7
|
+
@schema = <<-YAML
|
8
|
+
- test:
|
9
|
+
type: string
|
10
|
+
YAML
|
11
|
+
subject.questions.should be_key('test')
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should instantiate the correct question type for each question' do
|
15
|
+
@schema = <<-YAML
|
16
|
+
- string:
|
17
|
+
type: string
|
18
|
+
- boolean:
|
19
|
+
type: boolean
|
20
|
+
- multiple_choice:
|
21
|
+
type: multiple_choice
|
22
|
+
YAML
|
23
|
+
subject.questions['string'].should be_kind_of(EldarScrolls::Config::Prompt)
|
24
|
+
subject.questions['boolean'].should be_kind_of(EldarScrolls::Config::TrueFalse)
|
25
|
+
subject.questions['multiple_choice'].should be_kind_of(EldarScrolls::Config::MultipleChoice)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should error on invalid question type' do
|
29
|
+
@schema = <<-YAML
|
30
|
+
- invalid:
|
31
|
+
type: invalid
|
32
|
+
YAML
|
33
|
+
lambda{ subject }.should raise_error(ArgumentError)
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#compile' do
|
37
|
+
let(:lines) { subject.compile.split("\n") }
|
38
|
+
before do
|
39
|
+
@schema = <<-YAML
|
40
|
+
- string:
|
41
|
+
type: string
|
42
|
+
prompt: Give me a string?
|
43
|
+
if: is_true
|
44
|
+
- boolean:
|
45
|
+
type: boolean
|
46
|
+
prompt: Yes or no?
|
47
|
+
unless: is_false
|
48
|
+
if_scroll: awesome
|
49
|
+
- multiple_choice:
|
50
|
+
type: multiple_choice
|
51
|
+
choices: [[ABC, abc], [DEF, def]]
|
52
|
+
unless_scroll: awesome
|
53
|
+
YAML
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should include all questions' do
|
57
|
+
lines.size.should == 4
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should handle "if"' do
|
61
|
+
lines[1].should be_include("config['is_true']")
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should handle "unless"' do
|
65
|
+
lines[2].should be_include("!config['is_false']")
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should handle "if_scroll"' do
|
69
|
+
lines[2].should be_include("scroll?('awesome')")
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should handle "unelss_scroll"' do
|
73
|
+
lines[3].should be_include("!scroll?('awesome')")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe EldarScrolls::Config::Prompt do
|
78
|
+
subject{ EldarScrolls::Config::Prompt }
|
79
|
+
it 'should compile to a prompt' do
|
80
|
+
subject.new({'prompt' => "What's your favorite color?"}).question.should == 'ask_wizard("What\'s your favorite color?")'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe EldarScrolls::Config::TrueFalse do
|
85
|
+
subject{ EldarScrolls::Config::TrueFalse }
|
86
|
+
it 'should compile to a yes? question' do
|
87
|
+
subject.new({'prompt' => 'Yes yes?'}).question.should == 'yes_wizard?("Yes yes?")'
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe EldarScrolls::Config::MultipleChoice do
|
92
|
+
subject{ EldarScrolls::Config::MultipleChoice }
|
93
|
+
it 'should compile into a multiple_choice' do
|
94
|
+
subject.new({'prompt' => 'What kind of fruit?', 'choices' => [['Apples', 'apples'], ['Bananas', 'bananas']]}).question.should ==
|
95
|
+
'multiple_choice("What kind of fruit?", [["Apples", "apples"], ["Bananas", "bananas"]])'
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|