welaika-suspenders 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.md +38 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +123 -0
  5. data/LICENSE +21 -0
  6. data/NEWS.md +90 -0
  7. data/README.md +125 -0
  8. data/Rakefile +8 -0
  9. data/bin/welaika-suspenders +16 -0
  10. data/features/github_repo.feature +8 -0
  11. data/features/heroku_true.feature +9 -0
  12. data/features/rake_clean.feature +15 -0
  13. data/features/step_definitions/suspenders_steps.rb +68 -0
  14. data/features/support/bin/heroku +5 -0
  15. data/features/support/bin/hub +5 -0
  16. data/features/support/env.rb +10 -0
  17. data/features/support/fake_github.rb +21 -0
  18. data/features/support/fake_heroku.rb +21 -0
  19. data/lib/suspenders/actions.rb +35 -0
  20. data/lib/suspenders/app_builder.rb +295 -0
  21. data/lib/suspenders/generators/app_generator.rb +197 -0
  22. data/lib/suspenders/version.rb +3 -0
  23. data/templates/Gemfile_clean +46 -0
  24. data/templates/Procfile +1 -0
  25. data/templates/README.md.erb +9 -0
  26. data/templates/_flashes.html.slim +3 -0
  27. data/templates/_javascript.html.slim +5 -0
  28. data/templates/bin_setup +11 -0
  29. data/templates/config_locales_en.yml +11 -0
  30. data/templates/database_cleaner_rspec.rb +21 -0
  31. data/templates/disable_xml_params.rb +3 -0
  32. data/templates/email_validator.rb +7 -0
  33. data/templates/errors.rb +28 -0
  34. data/templates/factories_spec.rb +14 -0
  35. data/templates/factories_spec_rake_task.rb +9 -0
  36. data/templates/factory_girl_syntax_rspec.rb +3 -0
  37. data/templates/import_common_javascripts +4 -0
  38. data/templates/import_sass_styles +1 -0
  39. data/templates/model_spec_helper.rb +16 -0
  40. data/templates/postgresql_database.yml.erb +11 -0
  41. data/templates/presenters.rb +3 -0
  42. data/templates/rack_timeout.rb +1 -0
  43. data/templates/rspec +2 -0
  44. data/templates/rspec_config.rb +12 -0
  45. data/templates/sample.env +3 -0
  46. data/templates/simplecov_init.rb +3 -0
  47. data/templates/smtp.rb +10 -0
  48. data/templates/strong_parameters.rb +1 -0
  49. data/templates/suspenders_gitignore +12 -0
  50. data/templates/suspenders_layout.html.slim.erb +12 -0
  51. data/templates/unit_spec_helper.rb +14 -0
  52. data/welaika-suspenders.gemspec +37 -0
  53. metadata +180 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 42f77302a1ea9cda64e27012d58e35ba5465e214
4
+ data.tar.gz: 78e866afa33b6b2527008fb8afe7484750844e83
5
+ SHA512:
6
+ metadata.gz: cb98eda44027ee74f8a59fbaa4bd4f4f72de45aa5ffd6bd9e486540339438487e1393cc2b205ee430f898c764684d2a4b453cc78ce43df33f8b18554b73962e0
7
+ data.tar.gz: 067b6ba53baaf918759abc41ab603ba97a5216bd6c1ac93d71182cdf3a14ffdaeef3bba10af3f46f4a919c5686752d5f525437475cfd4e0047f3555e05edc41f
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 "http://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,123 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ welaika-suspenders (1.2.3)
5
+ bundler (>= 1.1)
6
+ hub (~> 1.10.2)
7
+ rails (= 3.2.12)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ actionmailer (3.2.12)
13
+ actionpack (= 3.2.12)
14
+ mail (~> 2.4.4)
15
+ actionpack (3.2.12)
16
+ activemodel (= 3.2.12)
17
+ activesupport (= 3.2.12)
18
+ builder (~> 3.0.0)
19
+ erubis (~> 2.7.0)
20
+ journey (~> 1.0.4)
21
+ rack (~> 1.4.5)
22
+ rack-cache (~> 1.2)
23
+ rack-test (~> 0.6.1)
24
+ sprockets (~> 2.2.1)
25
+ activemodel (3.2.12)
26
+ activesupport (= 3.2.12)
27
+ builder (~> 3.0.0)
28
+ activerecord (3.2.12)
29
+ activemodel (= 3.2.12)
30
+ activesupport (= 3.2.12)
31
+ arel (~> 3.0.2)
32
+ tzinfo (~> 0.3.29)
33
+ activeresource (3.2.12)
34
+ activemodel (= 3.2.12)
35
+ activesupport (= 3.2.12)
36
+ activesupport (3.2.12)
37
+ i18n (~> 0.6)
38
+ multi_json (~> 1.0)
39
+ arel (3.0.2)
40
+ aruba (0.4.11)
41
+ childprocess (>= 0.2.3)
42
+ cucumber (>= 1.1.1)
43
+ ffi (>= 1.0.11)
44
+ rspec (>= 2.7.0)
45
+ builder (3.0.4)
46
+ childprocess (0.3.6)
47
+ ffi (~> 1.0, >= 1.0.6)
48
+ cucumber (1.1.9)
49
+ builder (>= 2.1.2)
50
+ diff-lcs (>= 1.1.2)
51
+ gherkin (~> 2.9.0)
52
+ json (>= 1.4.6)
53
+ term-ansicolor (>= 1.0.6)
54
+ diff-lcs (1.1.3)
55
+ erubis (2.7.0)
56
+ ffi (1.3.1)
57
+ gherkin (2.9.3)
58
+ json (>= 1.4.6)
59
+ hike (1.2.1)
60
+ hub (1.10.5)
61
+ i18n (0.6.4)
62
+ journey (1.0.4)
63
+ json (1.7.6)
64
+ mail (2.4.4)
65
+ i18n (>= 0.4.0)
66
+ mime-types (~> 1.16)
67
+ treetop (~> 1.4.8)
68
+ mime-types (1.21)
69
+ multi_json (1.7.2)
70
+ polyglot (0.3.3)
71
+ rack (1.4.5)
72
+ rack-cache (1.2)
73
+ rack (>= 0.4)
74
+ rack-ssl (1.3.3)
75
+ rack
76
+ rack-test (0.6.2)
77
+ rack (>= 1.0)
78
+ rails (3.2.12)
79
+ actionmailer (= 3.2.12)
80
+ actionpack (= 3.2.12)
81
+ activerecord (= 3.2.12)
82
+ activeresource (= 3.2.12)
83
+ activesupport (= 3.2.12)
84
+ bundler (~> 1.0)
85
+ railties (= 3.2.12)
86
+ railties (3.2.12)
87
+ actionpack (= 3.2.12)
88
+ activesupport (= 3.2.12)
89
+ rack-ssl (~> 1.3.2)
90
+ rake (>= 0.8.7)
91
+ rdoc (~> 3.4)
92
+ thor (>= 0.14.6, < 2.0)
93
+ rake (10.0.4)
94
+ rdoc (3.12.2)
95
+ json (~> 1.4)
96
+ rspec (2.12.0)
97
+ rspec-core (~> 2.12.0)
98
+ rspec-expectations (~> 2.12.0)
99
+ rspec-mocks (~> 2.12.0)
100
+ rspec-core (2.12.2)
101
+ rspec-expectations (2.12.1)
102
+ diff-lcs (~> 1.1.3)
103
+ rspec-mocks (2.12.1)
104
+ sprockets (2.2.2)
105
+ hike (~> 1.2)
106
+ multi_json (~> 1.0)
107
+ rack (~> 1.0)
108
+ tilt (~> 1.1, != 1.3.0)
109
+ term-ansicolor (1.0.7)
110
+ thor (0.18.0)
111
+ tilt (1.3.6)
112
+ treetop (1.4.12)
113
+ polyglot
114
+ polyglot (>= 0.3.1)
115
+ tzinfo (0.3.37)
116
+
117
+ PLATFORMS
118
+ ruby
119
+
120
+ DEPENDENCIES
121
+ aruba (~> 0.4.11)
122
+ cucumber (~> 1.1.9)
123
+ welaika-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,90 @@
1
+ 1.2.2 (March 14, 2013)
2
+
3
+ * Fix Syntax error in staging/production environment config files.
4
+ * Make Factory Girl available to development environment for generators and
5
+ `rails console`.
6
+
7
+ 1.2.1 (February 28, 2013)
8
+
9
+ * Use Ruby 1.9.3 and 2.0
10
+ * Update staging and production email delivery
11
+ * Remove Spork and Guard
12
+ * Add better_errors and binding_of_caller gems
13
+ * Fix ActiveRecord attributes' blacklist
14
+ * Add Flutie to Gemfile
15
+
16
+ 1.2.0 (February 13, 2013)
17
+
18
+ * Upgrade Rails from 3.2.8 to 3.2.12 to keep pace with security patches.
19
+ * Improve staging environment on Heroku with staging `ENV` variables and
20
+ overriding the recipient in staging email delivery.
21
+ * Remove Flutie, use Bourbon.
22
+ * Wrap all HTTP requests in a 5 second timeout.
23
+ * Don't use `attr_accessible` whitelists. Instead, configure Strong Parameters.
24
+ * Provide a `bin/setup` script.
25
+ * Force RSpec's `expect` syntax.
26
+ * Remove remaining references to Cucumber, complete RSpec + Capybara conversion.
27
+ * Improve Foreman/`.env`/`Procfile` interactions.
28
+
29
+ 1.1.5 (October 22, 2012)
30
+
31
+ * Ignore `.env`.
32
+ * Link to thoughtbot/guides in generated README.
33
+ * Remove Cucumber in favor of RSpec + Capybara.
34
+ * Deliver emails in staging environment to an overriden email or set of emails.
35
+ * Encode database as UTF8.
36
+ * Bundle with binstubs using 37signals' directory convention.
37
+ * Configure time formats using localization.
38
+ * Add Ruby version to Gemfile.
39
+ * Add fast-failing spec that tests validity of factories.
40
+ * Use SimpleCov for C0 coverage.
41
+ * Configure RSpec with `--profile` flag to find slow-running specs.
42
+
43
+ 1.1.4 (September 4, 2012)
44
+
45
+ * Always store UTC in the DB.
46
+ * Use Rails 3.2.8.
47
+
48
+ 1.1.3 (August 7, 2012)
49
+
50
+ * Fix broken Gemfile additions where capybara stole cucumber's `require: false`
51
+
52
+ 1.1.2 (August 6, 2012)
53
+
54
+ * Fix broken rake.
55
+ * Use Heroku-compliant asset pipeline settings.
56
+
57
+ 1.1.1 (August 3, 2012)
58
+
59
+ * Fix broken newline interpolation
60
+
61
+ 1.1.0 (August 3, 2012)
62
+
63
+ * Add --github option.
64
+ * Add --webkit option.
65
+ * Remove cruft when generating controllers.
66
+ * Add Spork and Guard.
67
+
68
+ 1.0.1 (August 2, 2012)
69
+
70
+ * Fix broken install on Ruby 1.8.
71
+ * Remove db/schema.rb from .gitignore.
72
+ * Remove Factory Girl step definitions.
73
+
74
+ 1.0.0 (June 29, 2012)
75
+
76
+ * Ignore `bin/`, `.rake_tasks`, `.bundle/`, and `.gem/`.
77
+ * Create a root route only with `--clearance`.
78
+ * Do not autocommit after generate.
79
+ * Style static error pages.
80
+ * Cucumber requires everything under `features/`, regardless of pwd.
81
+ * Added gems:
82
+ * `foreman`
83
+ * `therubyracer`
84
+ * Removed gems:
85
+ * `copycopter_client`
86
+ * `heroku`
87
+ * `ruby-debug`
88
+ * `sass`
89
+ * `sprockets-redirect`
90
+ * `email_spec`
data/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # Suspenders [![Build Status](https://secure.travis-ci.org/welaika/suspenders.png?branch=master)](http://travis-ci.org/welaika/suspenders)
2
+
3
+ This is a Suspenders fork in use at [weLaika](http://dev.welaika.com). Big thanks
4
+ to [thoughtbot](http://thoughtbot.com/community) for providing such a great starting
5
+ point.
6
+
7
+ Installation
8
+ ------------
9
+
10
+ First install the suspenders gem:
11
+
12
+ gem install welaika-suspenders
13
+
14
+ Then run:
15
+
16
+ welaika-suspenders projectname
17
+
18
+ This will create a Rails 3.2 app in `projectname`. This script creates a
19
+ new git repository. It is not meant to be used against an existing repo.
20
+
21
+ Gemfile
22
+ -------
23
+
24
+ To see the latest and greatest gems, look at Suspenders'
25
+ [templates/Gemfile_clean](templates/Gemfile_clean),
26
+ which will be appended to the default generated projectname/Gemfile.
27
+
28
+ It includes application gems like:
29
+
30
+ * [Airbrake](https://github.com/airbrake/airbrake) for exception notification
31
+ * [Bourbon](https://github.com/thoughtbot/bourbon) for Sass mixins
32
+ * [Simple Form](https://github.com/plataformatec/simple_form) for form markup and style
33
+
34
+ And testing gems like:
35
+
36
+ * [Bourne](https://github.com/thoughtbot/bourne) and
37
+ [Mocha](https://github.com/freerange/mocha) for stubbing and spying
38
+ * [Capybara](https://github.com/jnicklas/capybara) and
39
+ [Capybara Webkit](https://github.com/thoughtbot/capybara-webkit) for
40
+ integration testing
41
+ * [Factory Girl](https://github.com/thoughtbot/factory_girl) for test data
42
+ * [RSpec](https://github.com/rspec/rspec) for unit testing
43
+ * [Shoulda Matchers](https://github.com/thoughtbot/shoulda-matchers) for common
44
+ RSpec matchers
45
+ * [Timecop](https://github.com/jtrupiano/timecop-console) for testing time
46
+
47
+ Other goodies
48
+ -------------
49
+
50
+ Suspenders also comes with:
51
+
52
+ * Override recipient emails in staging environment.
53
+ * Rails' flashes set up and in application layout.
54
+ * A few nice time formats set up for localization.
55
+ * [Heroku-recommended asset pipeline
56
+ settings](https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar/).
57
+
58
+ Heroku
59
+ ------
60
+
61
+ You can optionally create Heroku staging and production apps:
62
+
63
+ welaika-suspenders app --heroku true
64
+
65
+ This has the same effect as running:
66
+
67
+ heroku create app-staging --remote staging
68
+ heroku create app-production --remote production
69
+
70
+ Github
71
+ ------
72
+
73
+ You can optionally create a Github repository:
74
+
75
+ welaika-suspenders app --github organization/project
76
+
77
+ This has the same effect as running:
78
+
79
+ hub create organization/project
80
+
81
+ Dependencies
82
+ ------------
83
+
84
+ Some gems included in Suspenders have native extensions. You should have GCC
85
+ installed on your machine before generating an app with Suspenders.
86
+
87
+ Use [OS X GCC Installer](https://github.com/kennethreitz/osx-gcc-installer/) for
88
+ Snow Leopard (OS X 10.6).
89
+
90
+ Use [Command Line Tools for XCode](https://developer.apple.com/downloads/index.action)
91
+ for Lion (OS X 10.7) or Mountain Lion (OS X 10.8).
92
+
93
+ We use [Capybara Webkit](https://github.com/thoughtbot/capybara-webkit) for
94
+ full-stack Javascript integration testing. It requires QT. Instructions for
95
+ installing QT are
96
+ [here](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
97
+
98
+ PostgreSQL needs to be installed and running for the `db:create` rake task.
99
+
100
+ Issues
101
+ ------
102
+
103
+ If you have problems, please create a
104
+ [Github Issue](https://github.com/thoughtbot/suspenders/issues).
105
+
106
+ Contributing
107
+ ------------
108
+
109
+ Please see CONTRIBUTING.md for details.
110
+
111
+ Credits
112
+ -------
113
+
114
+ ![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
115
+
116
+ Suspenders is maintained and funded by
117
+ [thoughtbot, inc](http://thoughtbot.com/community).
118
+
119
+ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
120
+
121
+ License
122
+ -------
123
+
124
+ Suspenders is Copyright © 2008-2013 thoughtbot. It is free software, and may be
125
+ redistributed under the terms specified in the LICENSE file.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'bundler/setup'
2
+ require 'bundler/gem_tasks'
3
+ require 'cucumber/rake/task'
4
+
5
+ Cucumber::Rake::Task.new
6
+
7
+ desc 'Run the test suite'
8
+ task :default => ['cucumber']
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(File.join('..', 'lib', 'suspenders', 'generators', 'app_generator'), File.dirname(__FILE__))
4
+ require File.expand_path(File.join('..', 'lib', 'suspenders', 'actions'), File.dirname(__FILE__))
5
+ require File.expand_path(File.join('..', 'lib', 'suspenders', 'app_builder'), File.dirname(__FILE__))
6
+
7
+ if ['create', '--create'].include? ARGV[0]
8
+ ARGV.shift
9
+ puts "[WARNING] the suspenders create argument is deprecated. Just use `suspenders #{ARGV.join}` instead"
10
+ end
11
+
12
+ templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
13
+ Suspenders::AppGenerator.source_root templates_root
14
+ Suspenders::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
15
+
16
+ Suspenders::AppGenerator.start
@@ -0,0 +1,8 @@
1
+ @disable-bundler
2
+ Feature: Creating a Github repo
3
+
4
+ Scenario: --github=organization/project
5
+ When I suspend a project called "test_project" with:
6
+ | argument | value |
7
+ | --github | organization/project |
8
+ Then the "organization/project" Github repo should exist
@@ -0,0 +1,9 @@
1
+ @disable-bundler
2
+ Feature: Creating a Heroku app
3
+
4
+ Scenario: --heroku=true
5
+ When I suspend a project called "test_project" with:
6
+ | argument | value |
7
+ | --heroku | true |
8
+ Then the "test_project-staging" Heroku app should exist
9
+ And the "test_project-production" Heroku app should exist
@@ -0,0 +1,15 @@
1
+ @disable-bundler
2
+ Feature: Rake works in the suspended project
3
+ Background:
4
+ Given I ensure no databases exist for "test_project"
5
+
6
+ Scenario: Running rake in the suspended project
7
+ When I suspend a project called "test_project"
8
+ And I cd to the "test_project" root
9
+ Then I can cleanly rake the project
10
+
11
+ Scenario: Making a spec then running rake
12
+ When I suspend a project called "test_project"
13
+ And I cd to the "test_project" root
14
+ And I generate "model post title:string"
15
+ Then I can cleanly rake the project
@@ -0,0 +1,68 @@
1
+ require 'aruba/cucumber'
2
+
3
+ When 'I run rake' do
4
+ in_current_dir do
5
+ run_simple 'bundle exec rake'
6
+ end
7
+ end
8
+
9
+ When 'I run the rake task "$task_name"' do |task_name|
10
+ in_current_dir do
11
+ run_simple "bundle exec rake #{task_name}"
12
+ end
13
+ end
14
+
15
+ When 'I generate "$generator_with_args"' do |generator_with_args|
16
+ in_current_dir do
17
+ run_simple "bundle exec rails generate #{generator_with_args}"
18
+ end
19
+ end
20
+
21
+ When 'I ensure no databases exist for "$project_name"' do |project_name|
22
+ run "dropdb #{project_name}_development"
23
+ run "dropdb #{project_name}_test"
24
+ end
25
+
26
+ When 'I suspend a project called "$project_name"' do |project_name|
27
+ suspenders_bin = File.expand_path(File.join('..', '..', 'bin', 'welaika-suspenders'), File.dirname(__FILE__))
28
+ run_simple "#{suspenders_bin} #{project_name}"
29
+ end
30
+
31
+ When /^I suspend a project called "([^"]*)" with:$/ do |project_name, arguments_table|
32
+ suspenders_bin = File.expand_path(File.join('..', '..', 'bin', 'welaika-suspenders'), File.dirname(__FILE__))
33
+ arguments = arguments_table.hashes.inject([]) do |accum, argument|
34
+ accum << "#{argument['argument']}=#{argument['value']}"
35
+ end.join
36
+ run_simple "#{suspenders_bin} #{project_name} #{arguments}"
37
+ end
38
+
39
+ When 'I cd to the "$test_project" root' do |dirname|
40
+ cd dirname
41
+ end
42
+
43
+ Then 'I can cleanly rake the project' do
44
+ steps %{
45
+ And I run the rake task "db:create"
46
+ And I run the rake task "db:migrate"
47
+ And I run the rake task "db:test:prepare"
48
+ And I run rake
49
+ }
50
+ end
51
+
52
+ Then /^"(.*)" should not be installed$/ do |gem_name|
53
+ in_current_dir do
54
+ system("bundle show #{gem_name} 2>&1 > /dev/null").should be_false
55
+ end
56
+ end
57
+
58
+ Then /^"(.*)" should not be included in "(.*)"$/ do |content, file_path|
59
+ check_file_content file_path, content, false
60
+ end
61
+
62
+ Then /^the "([^"]*)" Heroku app should exist$/ do |app_name|
63
+ FakeHeroku.should have_created_app(app_name)
64
+ end
65
+
66
+ Then /^the "([^"]*)" Github repo should exist$/ do |repo_name|
67
+ FakeGithub.should have_created_repo(repo_name)
68
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(File.join('..', '..', 'support', 'fake_heroku'), File.dirname(__FILE__))
4
+
5
+ FakeHeroku.new(ARGV).run!
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(File.join('..', '..', 'support', 'fake_github'), File.dirname(__FILE__))
4
+
5
+ FakeGithub.new(ARGV).run!
@@ -0,0 +1,10 @@
1
+ Before do
2
+ ENV['TESTING'] = 'true'
3
+ @aruba_timeout_seconds = 560
4
+ end
5
+
6
+ After do
7
+ FakeHeroku.clear!
8
+ FakeGithub.clear!
9
+ FileUtils.rm_rf 'test_project'
10
+ end
@@ -0,0 +1,21 @@
1
+ class FakeGithub
2
+ RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'hub_commands'), File.dirname(__FILE__))
3
+
4
+ def initialize(args)
5
+ @args = args
6
+ end
7
+
8
+ def run!
9
+ File.open(RECORDER, 'a') do |file|
10
+ file.write @args.join(' ')
11
+ end
12
+ end
13
+
14
+ def self.clear!
15
+ FileUtils.rm_rf RECORDER
16
+ end
17
+
18
+ def self.has_created_repo?(repo_name)
19
+ File.open(RECORDER, 'r').read.include?("create #{repo_name}")
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ class FakeHeroku
2
+ RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'heroku_commands'), File.dirname(__FILE__))
3
+
4
+ def initialize(args)
5
+ @args = args
6
+ end
7
+
8
+ def run!
9
+ File.open(RECORDER, 'a') do |file|
10
+ file.write @args.join(' ')
11
+ end
12
+ end
13
+
14
+ def self.clear!
15
+ FileUtils.rm_rf RECORDER
16
+ end
17
+
18
+ def self.has_created_app?(app_name)
19
+ File.open(RECORDER, 'r').read.include?("create #{app_name}")
20
+ end
21
+ end
@@ -0,0 +1,35 @@
1
+ module Suspenders
2
+ module Actions
3
+ def concat_file(source, destination)
4
+ contents = IO.read(find_in_source_paths(source))
5
+ append_file destination, contents
6
+ end
7
+
8
+ def replace_in_file(relative_path, find, replace)
9
+ path = File.join(destination_root, relative_path)
10
+ contents = IO.read(path)
11
+ unless contents.gsub!(find, replace)
12
+ raise "#{find.inspect} not found in #{relative_path}"
13
+ end
14
+ File.open(path, "w") { |file| file.write(contents) }
15
+ end
16
+
17
+ def action_mailer_host(rails_env, host)
18
+ inject_into_file(
19
+ "config/environments/#{rails_env}.rb",
20
+ "\n\n config.action_mailer.default_url_options = { :host => '#{host}' }",
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