os_suspenders 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.travis.yml +13 -0
  4. data/CONTRIBUTING.md +38 -0
  5. data/Gemfile +3 -0
  6. data/Gemfile.lock +133 -0
  7. data/LICENSE +21 -0
  8. data/NEWS.md +167 -0
  9. data/README.md +2 -0
  10. data/Rakefile +8 -0
  11. data/bin/rspec +16 -0
  12. data/bin/suspenders +18 -0
  13. data/lib/suspenders/actions.rb +35 -0
  14. data/lib/suspenders/app_builder.rb +352 -0
  15. data/lib/suspenders/generators/app_generator.rb +207 -0
  16. data/lib/suspenders/version.rb +3 -0
  17. data/lib/suspenders.rb +3 -0
  18. data/spec/fakes/bin/heroku +5 -0
  19. data/spec/fakes/bin/hub +5 -0
  20. data/spec/features/github_spec.rb +10 -0
  21. data/spec/features/heroku_spec.rb +13 -0
  22. data/spec/features/new_project_spec.rb +38 -0
  23. data/spec/spec_helper.rb +24 -0
  24. data/spec/support/fake_github.rb +21 -0
  25. data/spec/support/fake_heroku.rb +36 -0
  26. data/spec/support/suspenders.rb +50 -0
  27. data/suspenders.gemspec +35 -0
  28. data/templates/Gemfile_clean +44 -0
  29. data/templates/Procfile +2 -0
  30. data/templates/README.md.erb +25 -0
  31. data/templates/_flashes.html.erb +5 -0
  32. data/templates/_javascript.html.erb +10 -0
  33. data/templates/application.css.scss +8 -0
  34. data/templates/background_jobs_rspec.rb +19 -0
  35. data/templates/bin_setup +32 -0
  36. data/templates/config_locales_en.yml +11 -0
  37. data/templates/database_cleaner_rspec.rb +21 -0
  38. data/templates/development_seeds.rb +13 -0
  39. data/templates/disable_xml_params.rb +3 -0
  40. data/templates/errors.rb +28 -0
  41. data/templates/factories_spec.rb +13 -0
  42. data/templates/factories_spec_rake_task.rb +15 -0
  43. data/templates/factory_girl_syntax_rspec.rb +3 -0
  44. data/templates/postgresql_database.yml.erb +11 -0
  45. data/templates/rack_timeout.rb +1 -0
  46. data/templates/sample.env +3 -0
  47. data/templates/secret_token.rb +10 -0
  48. data/templates/smtp.rb +10 -0
  49. data/templates/spec_helper.rb +29 -0
  50. data/templates/staging.rb +3 -0
  51. data/templates/suspenders_gitignore +13 -0
  52. data/templates/suspenders_layout.html.erb.erb +15 -0
  53. data/templates/unicorn.rb +29 -0
  54. metadata +195 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0153f4ec3d09e56af3369771902298409d6c6f0f
4
+ data.tar.gz: 85eccc6f609661f5bc179b896fd97b9f68ac6602
5
+ SHA512:
6
+ metadata.gz: f3c360d5fce6065396951998581c8af7b506e12e75d0d845c4b87ad3da7d237638bb75b71050a1ecedb1292b56e5faf2d5a79e8bdfdb053193c497084ea1c51b
7
+ data.tar.gz: 47fca7fcf22f6cfd4e46656b8aeeddade23e3c13c5e8ea56142d60e28b01b704e1f69d23dd1fa5950b5545f535fb6442719b985b2e070e32f0056ebaff98a846
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ *.swp
3
+ /.bundle
4
+ /tmp/dummy
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
6
+ - 2.1.1
7
+ before_install:
8
+ - git config --global user.name 'Travis CI'
9
+ - git config --global user.email 'travis-ci@example.com'
10
+ install:
11
+ - bundle install
12
+ notifications:
13
+ email: false
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,38 @@
1
+ We love pull requests. Here's a quick guide:
2
+
3
+ 1. Fork the repo.
4
+
5
+ 2. Run the tests. We only take pull requests with passing tests, and it's great
6
+ to know that you have a clean slate: `bundle && rake`
7
+
8
+ 3. Add a test for your change. Only refactoring and documentation changes
9
+ require no new tests. If you are adding functionality or fixing a bug, we need
10
+ a test!
11
+
12
+ 4. Make the test pass.
13
+
14
+ 5. Push to your fork and submit a pull request.
15
+
16
+
17
+ At this point you're waiting on us. We like to at least comment on, if not
18
+ accept, pull requests within three business days (and, typically, one business
19
+ day). We may suggest some changes or improvements or alternatives.
20
+
21
+ Some things that will increase the chance that your pull request is accepted,
22
+ taken straight from the Ruby on Rails guide:
23
+
24
+ * Use Rails idioms and helpers
25
+ * Include tests that fail without your code, and pass with it
26
+ * Update the documentation, the surrounding one, examples elsewhere, guides,
27
+ whatever is affected by your contribution
28
+
29
+ Syntax:
30
+
31
+ * Two spaces, no tabs.
32
+ * No trailing whitespace. Blank lines should not have any space.
33
+ * Prefer &&/|| over and/or.
34
+ * my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
35
+ * a = b and not a=b.
36
+ * Follow the conventions you see used in the source already.
37
+
38
+ And in case we didn't emphasize it enough: we love tests!
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,133 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ suspenders (1.8.1)
5
+ bundler (~> 1.3)
6
+ rails (= 4.0.3)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (4.0.3)
12
+ actionpack (= 4.0.3)
13
+ mail (~> 2.5.4)
14
+ actionpack (4.0.3)
15
+ activesupport (= 4.0.3)
16
+ builder (~> 3.1.0)
17
+ erubis (~> 2.7.0)
18
+ rack (~> 1.5.2)
19
+ rack-test (~> 0.6.2)
20
+ activemodel (4.0.3)
21
+ activesupport (= 4.0.3)
22
+ builder (~> 3.1.0)
23
+ activerecord (4.0.3)
24
+ activemodel (= 4.0.3)
25
+ activerecord-deprecated_finders (~> 1.0.2)
26
+ activesupport (= 4.0.3)
27
+ arel (~> 4.0.0)
28
+ activerecord-deprecated_finders (1.0.3)
29
+ activesupport (4.0.3)
30
+ i18n (~> 0.6, >= 0.6.4)
31
+ minitest (~> 4.2)
32
+ multi_json (~> 1.3)
33
+ thread_safe (~> 0.1)
34
+ tzinfo (~> 0.3.37)
35
+ arel (4.0.2)
36
+ aruba (0.5.3)
37
+ childprocess (>= 0.3.6)
38
+ cucumber (>= 1.1.1)
39
+ rspec-expectations (>= 2.7.0)
40
+ atomic (1.1.15)
41
+ builder (3.1.4)
42
+ capybara (2.2.0)
43
+ mime-types (>= 1.16)
44
+ nokogiri (>= 1.3.3)
45
+ rack (>= 1.0.0)
46
+ rack-test (>= 0.5.4)
47
+ xpath (~> 2.0)
48
+ childprocess (0.3.9)
49
+ ffi (~> 1.0, >= 1.0.11)
50
+ cucumber (1.3.3)
51
+ builder (>= 2.1.2)
52
+ diff-lcs (>= 1.1.3)
53
+ gherkin (~> 2.12.0)
54
+ multi_json (~> 1.7.5)
55
+ multi_test (~> 0.0.1)
56
+ diff-lcs (1.2.4)
57
+ erubis (2.7.0)
58
+ ffi (1.9.0)
59
+ ffi (1.9.0-x86-mingw32)
60
+ gherkin (2.12.0)
61
+ multi_json (~> 1.3)
62
+ gherkin (2.12.0-x86-mingw32)
63
+ multi_json (~> 1.3)
64
+ hike (1.2.3)
65
+ i18n (0.6.9)
66
+ mail (2.5.4)
67
+ mime-types (~> 1.16)
68
+ treetop (~> 1.4.8)
69
+ mime-types (1.25.1)
70
+ mini_portile (0.5.2)
71
+ minitest (4.7.5)
72
+ multi_json (1.7.9)
73
+ multi_test (0.0.1)
74
+ nokogiri (1.6.1)
75
+ mini_portile (~> 0.5.0)
76
+ nokogiri (1.6.1-x86-mingw32)
77
+ mini_portile (~> 0.5.0)
78
+ polyglot (0.3.4)
79
+ rack (1.5.2)
80
+ rack-test (0.6.2)
81
+ rack (>= 1.0)
82
+ rails (4.0.3)
83
+ actionmailer (= 4.0.3)
84
+ actionpack (= 4.0.3)
85
+ activerecord (= 4.0.3)
86
+ activesupport (= 4.0.3)
87
+ bundler (>= 1.3.0, < 2.0)
88
+ railties (= 4.0.3)
89
+ sprockets-rails (~> 2.0.0)
90
+ railties (4.0.3)
91
+ actionpack (= 4.0.3)
92
+ activesupport (= 4.0.3)
93
+ rake (>= 0.8.7)
94
+ thor (>= 0.18.1, < 2.0)
95
+ rake (10.1.1)
96
+ rspec (2.14.1)
97
+ rspec-core (~> 2.14.0)
98
+ rspec-expectations (~> 2.14.0)
99
+ rspec-mocks (~> 2.14.0)
100
+ rspec-core (2.14.7)
101
+ rspec-expectations (2.14.0)
102
+ diff-lcs (>= 1.1.3, < 2.0)
103
+ rspec-mocks (2.14.4)
104
+ sprockets (2.11.0)
105
+ hike (~> 1.2)
106
+ multi_json (~> 1.0)
107
+ rack (~> 1.0)
108
+ tilt (~> 1.1, != 1.3.0)
109
+ sprockets-rails (2.0.1)
110
+ actionpack (>= 3.0)
111
+ activesupport (>= 3.0)
112
+ sprockets (~> 2.8)
113
+ thor (0.18.1)
114
+ thread_safe (0.2.0)
115
+ atomic (>= 1.1.7, < 2)
116
+ tilt (1.4.1)
117
+ treetop (1.4.15)
118
+ polyglot
119
+ polyglot (>= 0.3.1)
120
+ tzinfo (0.3.38)
121
+ xpath (2.0.0)
122
+ nokogiri (~> 1.3)
123
+
124
+ PLATFORMS
125
+ ruby
126
+ x86-mingw32
127
+
128
+ DEPENDENCIES
129
+ aruba (~> 0.5.2)
130
+ capybara
131
+ cucumber (~> 1.2)
132
+ rspec
133
+ suspenders!
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010-2012 Mike Burns and thoughtbot, inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/NEWS.md ADDED
@@ -0,0 +1,167 @@
1
+ 1.8.1 (February 19, 2014)
2
+
3
+ * Don't distribute rspec binstub with gem.
4
+
5
+ 1.8.0 (February 18, 2014)
6
+
7
+ * Make the .git/safe directory in bin/setup.
8
+ * Require `rails_12factor` gem only on Heroku.
9
+ * Require mailer config on staging and production.
10
+ * Add rspec binstub.
11
+ * Fix .ruby-version on Ruby 2.1.0.
12
+ * Replace Flutie's `page_title` with `title` gem.
13
+ * Don't run factory specs twice.
14
+ * Inherit staging config from production.
15
+ * Internal: convert tests from Cucumber to RSpec.
16
+ * Don't include `prefilled_input.js`.
17
+ * Fix Rack class name - Deflater instead of Timeout.
18
+ * Add Pry Rails.
19
+ * Add Spring.
20
+ * Add Dotenv to development and test environments to load environment variables
21
+ from the `.env` file.
22
+ * Reduce ActiveRecord connection pool from 5 to 2.
23
+
24
+ 1.7.0 (December 6, 2013)
25
+
26
+ * Keep `db/schema.rb` under version control.
27
+ * Fast-fail if any part of `bin/setup` fails.
28
+ * Move secret key out of version control.
29
+ * Create `.ruby-version` in generated applications.
30
+ * Add placeholder modules and directories for feature specs.
31
+ * Improve README to include setup instructions.
32
+
33
+ 1.6.0 (November 28, 2013)
34
+
35
+ * Do not create `.rspec` file as the settings are not project-specific.
36
+ * Generate RSpec binstub at `bin/rspec`.
37
+ * Fix stylesheet error on 500, 404, and 422 static pages.
38
+ * Add `--skip-git` option.
39
+ * Disable jQuery animations in Rails integration tests that execute JavaScript.
40
+ * Fix git remote bug.
41
+ * Add `Rack::Deflater` to compress responses with Gzip.
42
+
43
+ 1.5.1 (September 10, 2013)
44
+
45
+ * Remove Turbolinks.
46
+ * Don't use Bundler's binstubs in `bin/setup`.
47
+ * Remove `--drb` now that we aren't using Spork.
48
+ * Set up DNS via Pow for development.
49
+ * Update gem versions.
50
+
51
+ 1.5.0 (August 3, 2013)
52
+
53
+ * Add Neat.
54
+ * Replace Bourne with RSpec Mocks.
55
+ * Replace Sham Rack with WebMock.
56
+ * Remove dependency on `hub` gem.
57
+ * Clean up leftover Rails 3 conventions.
58
+
59
+ 1.4.0 (July 21, 2013)
60
+
61
+ * Support Rails 4.
62
+ * Support Ruby 2.
63
+ * Remove jQuery UI.
64
+ * Factories spec works for non-ActiveRecord objects.
65
+ * Use New Relic RPM gem >= 3.5.7 for Heroku request queue accuracy.
66
+ * Abort RSpec runs on first failure.
67
+ * Replace custom email validator with gem.
68
+
69
+ 1.3.0 (May 13, 2013)
70
+
71
+ * Switch web server from Thin to Unicorn
72
+ * Set up database before setting up RSpec so that the rspec:install task works
73
+ * Add Delayed::Job
74
+ * Clean up cruft from ActionMailer delivery configuration
75
+ * strong_parameters now raises an error in development
76
+ * Enforce Ruby 1.9.2+ in the gemspec
77
+
78
+ 1.2.2 (March 14, 2013)
79
+
80
+ * Fix Syntax error in staging/production environment config files.
81
+ * Make Factory Girl available to development environment for generators and
82
+ `rails console`.
83
+
84
+ 1.2.1 (February 28, 2013)
85
+
86
+ * Use Ruby 1.9.3 and 2.0
87
+ * Update staging and production email delivery
88
+ * Remove Spork and Guard
89
+ * Add better_errors and binding_of_caller gems
90
+ * Fix ActiveRecord attributes' blacklist
91
+ * Add Flutie to Gemfile
92
+
93
+ 1.2.0 (February 13, 2013)
94
+
95
+ * Upgrade Rails from 3.2.8 to 3.2.12 to keep pace with security patches.
96
+ * Improve staging environment on Heroku with staging `ENV` variables and
97
+ overriding the recipient in staging email delivery.
98
+ * Remove Flutie, use Bourbon.
99
+ * Wrap all HTTP requests in a 5 second timeout.
100
+ * Don't use `attr_accessible` whitelists. Instead, configure Strong Parameters.
101
+ * Provide a `bin/setup` script.
102
+ * Force RSpec's `expect` syntax.
103
+ * Remove remaining references to Cucumber, complete RSpec + Capybara conversion.
104
+ * Improve Foreman/`.env`/`Procfile` interactions.
105
+
106
+ 1.1.5 (October 22, 2012)
107
+
108
+ * Ignore `.env`.
109
+ * Link to thoughtbot/guides in generated README.
110
+ * Remove Cucumber in favor of RSpec + Capybara.
111
+ * Deliver emails in staging environment to an overriden email or set of emails.
112
+ * Encode database as UTF8.
113
+ * Bundle with binstubs using 37signals' directory convention.
114
+ * Configure time formats using localization.
115
+ * Add Ruby version to Gemfile.
116
+ * Add fast-failing spec that tests validity of factories.
117
+ * Use SimpleCov for C0 coverage.
118
+ * Configure RSpec with `--profile` flag to find slow-running specs.
119
+
120
+ 1.1.4 (September 4, 2012)
121
+
122
+ * Always store UTC in the DB.
123
+ * Use Rails 3.2.8.
124
+
125
+ 1.1.3 (August 7, 2012)
126
+
127
+ * Fix broken Gemfile additions where capybara stole cucumber's `require: false`
128
+
129
+ 1.1.2 (August 6, 2012)
130
+
131
+ * Fix broken rake.
132
+ * Use Heroku-compliant asset pipeline settings.
133
+
134
+ 1.1.1 (August 3, 2012)
135
+
136
+ * Fix broken newline interpolation
137
+
138
+ 1.1.0 (August 3, 2012)
139
+
140
+ * Add --github option.
141
+ * Add --webkit option.
142
+ * Remove cruft when generating controllers.
143
+ * Add Spork and Guard.
144
+
145
+ 1.0.1 (August 2, 2012)
146
+
147
+ * Fix broken install on Ruby 1.8.
148
+ * Remove db/schema.rb from .gitignore.
149
+ * Remove Factory Girl step definitions.
150
+
151
+ 1.0.0 (June 29, 2012)
152
+
153
+ * Ignore `bin/`, `.rake_tasks`, `.bundle/`, and `.gem/`.
154
+ * Create a root route only with `--clearance`.
155
+ * Do not autocommit after generate.
156
+ * Style static error pages.
157
+ * Cucumber requires everything under `features/`, regardless of pwd.
158
+ * Added gems:
159
+ * `foreman`
160
+ * `therubyracer`
161
+ * Removed gems:
162
+ * `copycopter_client`
163
+ * `heroku`
164
+ * `ruby-debug`
165
+ * `sass`
166
+ * `sprockets-redirect`
167
+ * `email_spec`
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ Custom version of Thoughbot Suspenders
2
+ https://github.com/thoughtbot/suspenders
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'bundler/setup'
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:rspec)
6
+
7
+ desc 'Run the test suite'
8
+ task :default => :rspec
data/bin/rspec ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'rspec')
data/bin/suspenders ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
5
+ $LOAD_PATH << source_path
6
+
7
+ require 'suspenders'
8
+
9
+ if ['create', '--create'].include? ARGV[0]
10
+ ARGV.shift
11
+ puts "[WARNING] the suspenders create argument is deprecated. Just use `suspenders #{ARGV.join}` instead"
12
+ end
13
+
14
+ templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
15
+ Suspenders::AppGenerator.source_root templates_root
16
+ Suspenders::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
17
+
18
+ Suspenders::AppGenerator.start
@@ -0,0 +1,35 @@
1
+ module Suspenders
2
+ module Actions
3
+ def replace_in_file(relative_path, find, replace)
4
+ path = File.join(destination_root, relative_path)
5
+ contents = IO.read(path)
6
+ unless contents.gsub!(find, replace)
7
+ raise "#{find.inspect} not found in #{relative_path}"
8
+ end
9
+ File.open(path, "w") { |file| file.write(contents) }
10
+ end
11
+
12
+ def action_mailer_host(rails_env, host)
13
+ host_config = "config.action_mailer.default_url_options = { host: '#{host}' }"
14
+ configure_environment(rails_env, host_config)
15
+ end
16
+
17
+ def configure_environment(rails_env, config)
18
+ inject_into_file(
19
+ "config/environments/#{rails_env}.rb",
20
+ "\n\n #{config}",
21
+ before: "\nend"
22
+ )
23
+ end
24
+
25
+ def download_file(uri_string, destination)
26
+ uri = URI.parse(uri_string)
27
+ http = Net::HTTP.new(uri.host, uri.port)
28
+ http.use_ssl = true if uri_string =~ /^https/
29
+ request = Net::HTTP::Get.new(uri.path)
30
+ contents = http.request(request).body
31
+ path = File.join(destination_root, destination)
32
+ File.open(path, "w") { |file| file.write(contents) }
33
+ end
34
+ end
35
+ end