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
data/scrolls/github.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
gem 'github', '>= 0.7.0', :require => nil, :group => [:development]
|
2
|
+
|
3
|
+
after_everything do
|
4
|
+
tried_create_already = false
|
5
|
+
while (@git_uri = `git config remote.origin.url`.strip) && @git_uri.size == 0
|
6
|
+
if tried_create_already
|
7
|
+
@repo_name = ask_wizard "Repository already exists. What project name?"
|
8
|
+
else
|
9
|
+
@repo_name = ""
|
10
|
+
end
|
11
|
+
if config["github_private"]
|
12
|
+
run "bundle exec gh create-from-local #{@repo_name} --private"
|
13
|
+
else
|
14
|
+
run "bundle exec gh create-from-local #{@repo_name}"
|
15
|
+
end
|
16
|
+
tried_create_already = true
|
17
|
+
end
|
18
|
+
|
19
|
+
say_custom "github", "Created repo #{@git_uri}"
|
20
|
+
end
|
21
|
+
|
22
|
+
__END__
|
23
|
+
|
24
|
+
name: GitHub
|
25
|
+
description: Push project to new GitHub repository
|
26
|
+
author: drnic
|
27
|
+
|
28
|
+
category: deployment
|
29
|
+
exclusive: scm-hosting
|
30
|
+
|
31
|
+
requires: [git]
|
32
|
+
run_after: [git]
|
33
|
+
|
34
|
+
config:
|
35
|
+
- github_private:
|
36
|
+
prompt: "Create a GitHub repository?"
|
37
|
+
type: multiple_choice
|
38
|
+
choices: [["Public", false], ["Private", true]]
|
data/scrolls/guard.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
prepend_file 'Gemfile' do <<-RUBY
|
2
|
+
require 'rbconfig'
|
3
|
+
HOST_OS = RbConfig::CONFIG['host_os']
|
4
|
+
|
5
|
+
RUBY
|
6
|
+
end
|
7
|
+
|
8
|
+
append_file 'Gemfile' do <<-RUBY
|
9
|
+
|
10
|
+
guard_notifications = #{config['guard_notifications'].inspect}
|
11
|
+
group :development do
|
12
|
+
case HOST_OS
|
13
|
+
when /darwin/i
|
14
|
+
gem 'rb-fsevent'
|
15
|
+
gem 'ruby_gntp' if guard_notifications
|
16
|
+
when /linux/i
|
17
|
+
gem 'libnotify'
|
18
|
+
gem 'rb-inotify'
|
19
|
+
when /mswin|windows/i
|
20
|
+
gem 'rb-fchange'
|
21
|
+
gem 'win32console'
|
22
|
+
gem 'rb-notifu' if guard_notifications
|
23
|
+
end
|
24
|
+
end
|
25
|
+
RUBY
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
# LiveReload
|
30
|
+
|
31
|
+
application nil, :env => "development" do
|
32
|
+
"config.middleware.insert_before(Rack::Lock, Rack::LiveReload)"
|
33
|
+
end
|
34
|
+
|
35
|
+
gem_group :development do
|
36
|
+
gem 'guard-livereload'
|
37
|
+
gem 'yajl-ruby'
|
38
|
+
gem 'rack-livereload'
|
39
|
+
|
40
|
+
# Guard for other Scrolls
|
41
|
+
|
42
|
+
gem 'guard-bundler'
|
43
|
+
gem 'guard-test' if scrolls.include? 'test_unit'
|
44
|
+
|
45
|
+
KNOWN_GUARD_SCROLLS = %w[cucumber haml less passenger puma redis resque rspec spork unicorn]
|
46
|
+
KNOWN_GUARD_SCROLLS.each do |scroll|
|
47
|
+
gem "guard-#{scroll}" if scrolls.include? scroll
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
after_bundler do
|
52
|
+
run "bundle exec guard init"
|
53
|
+
|
54
|
+
# TODO move livereload to the top of the Guardfile so it is zippy quick
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
__END__
|
59
|
+
|
60
|
+
name: Guard
|
61
|
+
description: Command line tool to file system modification events; Powers Up with other scrolls!
|
62
|
+
author: drnic
|
63
|
+
website: https://github.com/guard/guard
|
64
|
+
|
65
|
+
requires: []
|
66
|
+
run_after: []
|
67
|
+
run_before: []
|
68
|
+
|
69
|
+
category: other
|
70
|
+
# exclusive:
|
71
|
+
|
72
|
+
config:
|
73
|
+
- guard_notifications:
|
74
|
+
type: boolean
|
75
|
+
prompt: "Enable desktop Guard/Growl notifications?"
|
data/scrolls/jquery.rb
ADDED
data/scrolls/mysql.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
gem "mysql2"
|
2
|
+
|
3
|
+
# TODO what about Windows?
|
4
|
+
|
5
|
+
# if scroll?("eycloud")
|
6
|
+
# mysql_versions = [
|
7
|
+
# ["MySQL 5.0", "mysql_50"],
|
8
|
+
# ["MySQL 5.5 (beta)", "mysql_55"]
|
9
|
+
# ]
|
10
|
+
# @mysql_stack = multiple_choice("Create app to which Engine Yard Cloud account?", mysql_versions)
|
11
|
+
# end
|
12
|
+
|
13
|
+
after_bundler do
|
14
|
+
rake "db:create:all" if config['auto_create']
|
15
|
+
|
16
|
+
if config['populate_rake_task']
|
17
|
+
sample_rake = <<-RUBY
|
18
|
+
require './config/environment'
|
19
|
+
namespace :db do
|
20
|
+
desc "Populate the database with sample data"
|
21
|
+
task :sample do
|
22
|
+
end
|
23
|
+
task :populate => :sample
|
24
|
+
end
|
25
|
+
RUBY
|
26
|
+
File.open("lib/tasks/sample.rake", 'w') {|f| f.write(sample_rake)}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
__END__
|
31
|
+
|
32
|
+
name: MySQL
|
33
|
+
description: Use MySQL for dev & production database
|
34
|
+
author: drnic
|
35
|
+
|
36
|
+
exclusive: orm
|
37
|
+
category: persistence
|
38
|
+
|
39
|
+
run_before: [eycloud]
|
40
|
+
|
41
|
+
args: -d mysql
|
42
|
+
|
43
|
+
config:
|
44
|
+
- auto_create:
|
45
|
+
type: boolean
|
46
|
+
prompt: "Create MySQL database with default configuration?"
|
47
|
+
|
48
|
+
- populate_rake_task:
|
49
|
+
type: boolean
|
50
|
+
prompt: "Add db:sample rake task?"
|
51
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
gem "pg"
|
2
|
+
|
3
|
+
gsub_file "config/database.yml", /username: .*/, "username: #{config['pg_username']}"
|
4
|
+
gsub_file "config/database.yml", /password: .*/, "username: #{config['pg_password']}"
|
5
|
+
|
6
|
+
# if scroll?("eycloud")
|
7
|
+
# @db_stack = "postgresql_91"
|
8
|
+
# end
|
9
|
+
|
10
|
+
after_bundler do
|
11
|
+
rake "db:create:all" if config['auto_create']
|
12
|
+
|
13
|
+
if config['populate_rake_task']
|
14
|
+
sample_rake = <<-RUBY
|
15
|
+
require './config/environment'
|
16
|
+
namespace :db do
|
17
|
+
desc "Populate the database with sample data"
|
18
|
+
task :sample do
|
19
|
+
end
|
20
|
+
task :populate => :sample
|
21
|
+
end
|
22
|
+
RUBY
|
23
|
+
File.open("lib/tasks/sample.rake", 'w') {|f| f.write(sample_rake)}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
__END__
|
28
|
+
|
29
|
+
name: PostgreSQL
|
30
|
+
description: Use PostgreSQL for dev & production database
|
31
|
+
author: drnic
|
32
|
+
|
33
|
+
exclusive: orm
|
34
|
+
category: persistence
|
35
|
+
|
36
|
+
run_before: [eycloud]
|
37
|
+
|
38
|
+
args: -d postgresql
|
39
|
+
|
40
|
+
config:
|
41
|
+
- auto_create:
|
42
|
+
type: boolean
|
43
|
+
prompt: "Create PostgreSQL database with default configuration?"
|
44
|
+
|
45
|
+
- populate_rake_task:
|
46
|
+
type: boolean
|
47
|
+
prompt: "Add db:sample rake task?"
|
48
|
+
|
49
|
+
- pg_username:
|
50
|
+
type: string
|
51
|
+
prompt: "PostgreSQL username:"
|
52
|
+
- pg_password:
|
53
|
+
type: string
|
54
|
+
prompt: "PostgreSQL password:"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
gem "prototype-rails"
|
2
|
+
|
3
|
+
after_bundler do
|
4
|
+
gsub_file "app/assets/javascripts/application.js", "//= require prototype_ujs", <<-EOS
|
5
|
+
//= require prototype_ujs
|
6
|
+
//= require effects
|
7
|
+
//= require dragdrop
|
8
|
+
//= require controls
|
9
|
+
EOS
|
10
|
+
end
|
11
|
+
|
12
|
+
__END__
|
13
|
+
|
14
|
+
name: Prototype
|
15
|
+
description: "Prototype.JS as the JavaScript framework"
|
16
|
+
author: mbleigh
|
17
|
+
|
18
|
+
exclusive: javascript_framework
|
19
|
+
category: assets
|
20
|
+
|
21
|
+
args: -j prototype
|
data/scrolls/puma.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# create rvmrc file
|
2
|
+
# create_file ".rvmrc", "rvm gemset create '#{app_name}' \nrvm gemset use '#{app_name}'"
|
3
|
+
|
4
|
+
after_bundler do
|
5
|
+
# clean up rails defaults
|
6
|
+
remove_file "public/index.html"
|
7
|
+
remove_file "public/images/rails.png"
|
8
|
+
generate "controller home index"
|
9
|
+
gsub_file "app/controllers/home_controller.rb", /def index/, <<-RUBY
|
10
|
+
def index
|
11
|
+
flash.now[:notice] = "Welcome! - love Eldar Scrolls"
|
12
|
+
RUBY
|
13
|
+
route "root :to => 'home#index'"
|
14
|
+
|
15
|
+
run "mv README.rdoc RAILS_README.rdoc"
|
16
|
+
remove_file "README.rdoc"
|
17
|
+
create_file "README.md", <<-README
|
18
|
+
# ReadMe
|
19
|
+
|
20
|
+
|
21
|
+
## Deployment
|
22
|
+
|
23
|
+
```
|
24
|
+
ey deploy
|
25
|
+
```
|
26
|
+
|
27
|
+
## Thanks
|
28
|
+
|
29
|
+
The original scaffold for this application was created by [Eldar Scrolls](http://railseldarscrolls.org).
|
30
|
+
|
31
|
+
The project was created with the following scrolls:
|
32
|
+
|
33
|
+
#{ scrolls.map {|r| "* #{r}"}.join("\n")}
|
34
|
+
|
35
|
+
README
|
36
|
+
|
37
|
+
if scrolls.include? 'git'
|
38
|
+
append_file ".gitignore", "\nconfig/database.yml"
|
39
|
+
append_file ".gitignore", "\npublic/system"
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
after_everything do
|
45
|
+
rake "db:migrate"
|
46
|
+
end
|
47
|
+
|
48
|
+
__END__
|
49
|
+
|
50
|
+
name: Rails Basics
|
51
|
+
description: Best practices for new Rails apps
|
52
|
+
author: drnic
|
53
|
+
|
54
|
+
run_before: [git]
|
data/scrolls/redis.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
gem 'redis'
|
2
|
+
|
3
|
+
initializer "redis.rb", <<-RUBY
|
4
|
+
REDIS = Redis.new
|
5
|
+
RUBY
|
6
|
+
|
7
|
+
if scroll? "eycloud_recipes_on_deploy"
|
8
|
+
gem 'eycloud-recipe-redis', :group => :eycloud
|
9
|
+
end
|
10
|
+
|
11
|
+
__END__
|
12
|
+
|
13
|
+
name: Redis
|
14
|
+
description: "Add Redis as a persistence engine to your application."
|
15
|
+
author: mbleigh
|
16
|
+
|
17
|
+
exclusive: key_value
|
18
|
+
category: persistence
|
19
|
+
tags: [key_value, cache, session_store]
|
data/scrolls/resque.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
gem 'resque', :require => "resque/server"
|
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-recipe-resque', :group => :eycloud
|
8
|
+
|
9
|
+
create_file "config/initializers/resque.rb", <<-RUBY
|
10
|
+
resque_yml = File.expand_path('../../resque.yml', __FILE__)
|
11
|
+
if File.exist?(resque_yml)
|
12
|
+
Resque.redis = YAML.load_file(resque_yml)["redis_uri"]
|
13
|
+
end
|
14
|
+
RUBY
|
15
|
+
end
|
16
|
+
|
17
|
+
after_bundler do
|
18
|
+
say_wizard 'Adding resque.rake task to lib/tasks'
|
19
|
+
create_file "lib/tasks/resque.rake", <<-RAKE
|
20
|
+
require 'resque/tasks'
|
21
|
+
RAKE
|
22
|
+
|
23
|
+
route %{match "/resque/eycloud", :to => Resque::Server, :anchor => false}
|
24
|
+
|
25
|
+
if scroll? "eycloud_recipes_on_deploy"
|
26
|
+
|
27
|
+
say_wizard 'Installing deploy hooks to restart resque after deploys'
|
28
|
+
run "touch deploy/before_restart.rb"
|
29
|
+
append_file "deploy/before_restart.rb", <<-RUBY
|
30
|
+
on_app_servers_and_utilities do
|
31
|
+
node[:applications].each do |app_name, data|
|
32
|
+
sudo 'echo "sleep 20 && monit -g \#{app_name}_resque restart all" | at now'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
RUBY
|
36
|
+
|
37
|
+
append_file "deploy/cookbooks/main/recipes/default.rb", "\nrequire_recipe 'resque'\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
__END__
|
43
|
+
|
44
|
+
name: Resque
|
45
|
+
description: Add Resque to handle background jobs
|
46
|
+
author: drnic
|
47
|
+
website: https://github.com/defunkt/resque
|
48
|
+
|
49
|
+
requires: [redis]
|
50
|
+
run_after: [redis, eycloud_recipes_on_deploy]
|
51
|
+
|
52
|
+
category: worker
|
53
|
+
tags: [background, worker]
|
54
|
+
exclusive: worker
|
55
|
+
|
56
|
+
config:
|
57
|
+
- resque_admin_secret:
|
58
|
+
type: string
|
59
|
+
prompt: "Enter a secret string for the route /resque/YOUR-SECRET-STRING:"
|
data/scrolls/rspec.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
gem 'rspec-rails', :group => [:development, :test]
|
2
|
+
|
3
|
+
inject_into_file "config/initializers/generators.rb", :after => "Rails.application.config.generators do |g|\n" do
|
4
|
+
" g.test_framework = :rspec\n"
|
5
|
+
end
|
6
|
+
|
7
|
+
after_bundler do
|
8
|
+
generate 'rspec:install'
|
9
|
+
end
|
10
|
+
|
11
|
+
__END__
|
12
|
+
|
13
|
+
name: RSpec
|
14
|
+
description: "Use RSpec for unit testing for this Rails app."
|
15
|
+
author: mbleigh
|
16
|
+
|
17
|
+
exclusive: unit_testing
|
18
|
+
category: testing
|
19
|
+
|
20
|
+
args: ["-T"]
|
21
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
gem 'simple_form'
|
2
|
+
|
3
|
+
after_bundler do
|
4
|
+
if scroll? "twitter_bootstrap"
|
5
|
+
generate "simple_form:install --bootstrap"
|
6
|
+
else
|
7
|
+
generate "simple_form:install"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
__END__
|
12
|
+
|
13
|
+
name: Simple Form
|
14
|
+
description: Install Simple Form to generate nicely formatted forms.
|
15
|
+
author: jonochang
|
16
|
+
website: https://github.com/plataformatec/simple_form
|
17
|
+
|
18
|
+
exclusive: forms
|
19
|
+
category: templating
|