appscrolls 0.7.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.
Files changed (110) hide show
  1. data/.gitignore +8 -0
  2. data/.rspec +2 -0
  3. data/.travis.yml +6 -0
  4. data/ChangeLog.md +63 -0
  5. data/Gemfile +3 -0
  6. data/Guardfile +18 -0
  7. data/MIT_LICENSE +20 -0
  8. data/README.md +154 -0
  9. data/Rakefile +78 -0
  10. data/appscrolls.gemspec +32 -0
  11. data/bin/appscrolls +7 -0
  12. data/features/step_definitions/common_steps.rb +211 -0
  13. data/features/support/common.rb +51 -0
  14. data/features/support/env.rb +18 -0
  15. data/lib/appscrolls.rb +10 -0
  16. data/lib/appscrolls/command.rb +85 -0
  17. data/lib/appscrolls/config.rb +86 -0
  18. data/lib/appscrolls/scroll.rb +106 -0
  19. data/lib/appscrolls/scrolls.rb +38 -0
  20. data/lib/appscrolls/template.rb +67 -0
  21. data/lib/rails/generators/.DS_Store +0 -0
  22. data/lib/rails/generators/run_template/USAGE +13 -0
  23. data/lib/rails/generators/run_template/run_template_generator.rb +13 -0
  24. data/sample.rb +75 -0
  25. data/scrolls/active_admin.rb +19 -0
  26. data/scrolls/capybara.rb +34 -0
  27. data/scrolls/cucumber.rb +21 -0
  28. data/scrolls/delayed_job.rb +94 -0
  29. data/scrolls/env_yaml.rb +53 -0
  30. data/scrolls/eycloud.rb +72 -0
  31. data/scrolls/eycloud_recipes_on_deploy.rb +20 -0
  32. data/scrolls/git.rb +17 -0
  33. data/scrolls/github.rb +38 -0
  34. data/scrolls/guard.rb +75 -0
  35. data/scrolls/jquery.rb +11 -0
  36. data/scrolls/mysql.rb +51 -0
  37. data/scrolls/passenger.rb +11 -0
  38. data/scrolls/postgresql.rb +54 -0
  39. data/scrolls/prototype.rb +21 -0
  40. data/scrolls/puma.rb +11 -0
  41. data/scrolls/rails_basics.rb +54 -0
  42. data/scrolls/redis.rb +19 -0
  43. data/scrolls/resque.rb +59 -0
  44. data/scrolls/rspec.rb +21 -0
  45. data/scrolls/simple_form.rb +19 -0
  46. data/scrolls/split.rb +35 -0
  47. data/scrolls/spork.rb +19 -0
  48. data/scrolls/sqlite3.rb +10 -0
  49. data/scrolls/test_unit.rb +11 -0
  50. data/scrolls/thin.rb +10 -0
  51. data/scrolls/twitter_bootstrap.rb +41 -0
  52. data/scrolls/unicorn.rb +10 -0
  53. data/scrolls/zzz/activerecord.rb +69 -0
  54. data/scrolls/zzz/cancan.rb +16 -0
  55. data/scrolls/zzz/carrierwave.rb +42 -0
  56. data/scrolls/zzz/carrierwave_direct.rb +13 -0
  57. data/scrolls/zzz/cartographer.rb +33 -0
  58. data/scrolls/zzz/devise.rb +52 -0
  59. data/scrolls/zzz/devise_invitable.rb +23 -0
  60. data/scrolls/zzz/event_calendar.rb +12 -0
  61. data/scrolls/zzz/factory_girl.rb +38 -0
  62. data/scrolls/zzz/ffaker.rb +22 -0
  63. data/scrolls/zzz/fixture_builder.rb +35 -0
  64. data/scrolls/zzz/forgery.rb +15 -0
  65. data/scrolls/zzz/haml.rb +11 -0
  66. data/scrolls/zzz/heroku.rb +58 -0
  67. data/scrolls/zzz/hoptoad.rb +34 -0
  68. data/scrolls/zzz/inherited_resources.rb +12 -0
  69. data/scrolls/zzz/intercom.rb +35 -0
  70. data/scrolls/zzz/jammit.rb +43 -0
  71. data/scrolls/zzz/jasmine.rb +12 -0
  72. data/scrolls/zzz/mini_magick.rb +13 -0
  73. data/scrolls/zzz/mongo_mapper.rb +20 -0
  74. data/scrolls/zzz/mongohq.rb +61 -0
  75. data/scrolls/zzz/mongoid.rb +20 -0
  76. data/scrolls/zzz/mootools.rb +23 -0
  77. data/scrolls/zzz/newrelic.rb +11 -0
  78. data/scrolls/zzz/nifty_generators.rb +21 -0
  79. data/scrolls/zzz/oa_oauth.rb +12 -0
  80. data/scrolls/zzz/omniauth.rb +55 -0
  81. data/scrolls/zzz/paper_trail.rb +17 -0
  82. data/scrolls/zzz/pow.rb +12 -0
  83. data/scrolls/zzz/rails_admin.rb +22 -0
  84. data/scrolls/zzz/rails_dev_tweaks.rb +10 -0
  85. data/scrolls/zzz/rails_erd.rb +9 -0
  86. data/scrolls/zzz/rails_footnotes.rb +14 -0
  87. data/scrolls/zzz/ransack.rb +32 -0
  88. data/scrolls/zzz/rmagick.rb +13 -0
  89. data/scrolls/zzz/sass.rb +13 -0
  90. data/scrolls/zzz/sequel.rb +13 -0
  91. data/scrolls/zzz/settingslogic.rb +43 -0
  92. data/scrolls/zzz/shoulda_matchers.rb +11 -0
  93. data/scrolls/zzz/sidekiq.rb +23 -0
  94. data/scrolls/zzz/slim.rb +11 -0
  95. data/scrolls/zzz/thinking_sphinx.rb +14 -0
  96. data/scrolls/zzz/vanity.rb +35 -0
  97. data/spec/appscrolls/config_spec.rb +99 -0
  98. data/spec/appscrolls/scroll_spec.rb +103 -0
  99. data/spec/appscrolls/scrolls/sanity_spec.rb +30 -0
  100. data/spec/appscrolls/scrolls_spec.rb +24 -0
  101. data/spec/appscrolls/template_spec.rb +57 -0
  102. data/spec/spec_helper.rb +11 -0
  103. data/spec/support/rails_directory.rb +17 -0
  104. data/spec/support/template_runner.rb +28 -0
  105. data/templates/helpers.erb +45 -0
  106. data/templates/layout.erb +44 -0
  107. data/templates/new_scroll.erb +28 -0
  108. data/templates/scroll.erb +10 -0
  109. data/version.rb +3 -0
  110. metadata +297 -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,12 @@
1
+ gem 'oa-oauth'
2
+ __END__
3
+
4
+ name: OA-Oauth
5
+ description: "Include oa-oauth to use with Omniauth"
6
+ author: porta
7
+
8
+ category: authentication
9
+ tags: [devise, oauth]
10
+
11
+ requires: [devise, omniauth]
12
+ run_after: [devise, omniauth]
@@ -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
@@ -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,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,10 @@
1
+ gem 'rails-dev-tweaks', '~> 0.5.0', :group => :development
2
+
3
+ __END__
4
+
5
+ name: Rails Dev Tweaks
6
+ description: "Use Rails Dev Tweaks to speed up asset serving in Rails 3.1 dev environment"
7
+ author: jonochang
8
+
9
+ category: dev-tools
10
+ tags: [dev-tools]
@@ -0,0 +1,9 @@
1
+ gem 'rails-erd'
2
+ __END__
3
+
4
+ name: ERD Diagrams
5
+ description: Generates ERD diagrams for the project
6
+
7
+ category: domain-model
8
+ tags: [domain-model]
9
+
@@ -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
@@ -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,13 @@
1
+ gem 'sequel-rails'
2
+
3
+ application "require 'sequel-rails/railtie'"
4
+
5
+ __END__
6
+
7
+ name: Sequel
8
+ description: "Utilize Sequel as the primary ORM for your application."
9
+ author: mbleigh
10
+
11
+ exclusive: orm
12
+ category: persistence
13
+ tags: [orm, sql]
@@ -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,11 @@
1
+ gem 'shoulda-matchers', :group => [:test]
2
+
3
+ __END__
4
+
5
+ name: shoulda-matchers
6
+ description: "Collection of testing matchers extracted from Shoulda."
7
+ author: lightyrs
8
+
9
+ category: testing
10
+ run_after: [rspec]
11
+ requires: [rspec]
@@ -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]
@@ -0,0 +1,11 @@
1
+ gem 'slim'
2
+ gem 'slim-rails'
3
+
4
+ __END__
5
+
6
+ name: Slim
7
+ description: "Use Slim as the default templating engine."
8
+ author: mbleigh
9
+
10
+ category: templating
11
+ exclusive: templating
@@ -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 AppScrollsScrolls::Config do
4
+ describe '#initialize' do
5
+ subject{ AppScrollsScrolls::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(AppScrollsScrolls::Config::Prompt)
24
+ subject.questions['boolean'].should be_kind_of(AppScrollsScrolls::Config::TrueFalse)
25
+ subject.questions['multiple_choice'].should be_kind_of(AppScrollsScrolls::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 AppScrollsScrolls::Config::Prompt do
78
+ subject{ AppScrollsScrolls::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 AppScrollsScrolls::Config::TrueFalse do
85
+ subject{ AppScrollsScrolls::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 AppScrollsScrolls::Config::MultipleChoice do
92
+ subject{ AppScrollsScrolls::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