underwear 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +11 -0
  5. data/CONTRIBUTING.md +38 -0
  6. data/Gemfile +3 -0
  7. data/Gemfile.lock +123 -0
  8. data/LICENSE +21 -0
  9. data/NEWS.md +0 -0
  10. data/README.md +194 -0
  11. data/Rakefile +8 -0
  12. data/bin/rake +16 -0
  13. data/bin/rspec +16 -0
  14. data/bin/setup +13 -0
  15. data/bin/underwear +13 -0
  16. data/lib/underwear.rb +4 -0
  17. data/lib/underwear/actions.rb +33 -0
  18. data/lib/underwear/app_builder.rb +511 -0
  19. data/lib/underwear/generators/app_generator.rb +239 -0
  20. data/lib/underwear/version.rb +5 -0
  21. data/spec/fakes/bin/heroku +5 -0
  22. data/spec/fakes/bin/hub +5 -0
  23. data/spec/features/github_spec.rb +15 -0
  24. data/spec/features/heroku_spec.rb +46 -0
  25. data/spec/features/new_project_spec.rb +113 -0
  26. data/spec/spec_helper.rb +20 -0
  27. data/spec/support/fake_github.rb +21 -0
  28. data/spec/support/fake_heroku.rb +43 -0
  29. data/spec/support/underwear.rb +49 -0
  30. data/templates/Gemfile.erb +65 -0
  31. data/templates/Procfile +3 -0
  32. data/templates/README.md.erb +32 -0
  33. data/templates/_analytics.html.erb +7 -0
  34. data/templates/_flashes.html.erb +7 -0
  35. data/templates/_javascript.html.erb +12 -0
  36. data/templates/action_mailer.rb +5 -0
  37. data/templates/application.scss +1 -0
  38. data/templates/bin_deploy +12 -0
  39. data/templates/bin_setup.erb +36 -0
  40. data/templates/browserslist +4 -0
  41. data/templates/bundler_audit.rake +12 -0
  42. data/templates/circle.yml.erb +8 -0
  43. data/templates/config_i18n_tasks.yml +11 -0
  44. data/templates/config_locales_en.yml.erb +16 -0
  45. data/templates/database_cleaner_rspec.rb +21 -0
  46. data/templates/dev.rake +12 -0
  47. data/templates/disable_xml_params.rb +3 -0
  48. data/templates/errors.rb +34 -0
  49. data/templates/factory_girl_rspec.rb +3 -0
  50. data/templates/flashes_helper.rb +5 -0
  51. data/templates/i18n.rb +3 -0
  52. data/templates/json_encoding.rb +1 -0
  53. data/templates/newrelic.yml.erb +34 -0
  54. data/templates/postgresql_database.yml.erb +22 -0
  55. data/templates/puma.rb +19 -0
  56. data/templates/rails_helper.rb +17 -0
  57. data/templates/sample.env +6 -0
  58. data/templates/secrets.yml +14 -0
  59. data/templates/sidekiq.rb +1 -0
  60. data/templates/smtp.rb +9 -0
  61. data/templates/spec_helper.rb +23 -0
  62. data/templates/staging.rb +5 -0
  63. data/templates/test.rb +48 -0
  64. data/templates/underwear_gitignore +14 -0
  65. data/templates/underwear_layout.html.erb.erb +21 -0
  66. data/underwear.gemspec +33 -0
  67. metadata +166 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5b79153cea8704acd66bd3db313fd5df46164ea7
4
+ data.tar.gz: 1292aada3f9419957169517cfe757cfb0bc7986b
5
+ SHA512:
6
+ metadata.gz: 26897ec32a454c7883f2f012c85f06d4c894592868746d1ebe4de1f44cca71a3447d0034bce34989063a633978b4415f7877ba815877bed342b2e96a84e9762a
7
+ data.tar.gz: 60d44f44e3ed6c002c8ee3aa10e8beff63835d22a6abf4b4b92c4e1da496a206f0f9761b34483a1464d61244b0894a3eb24f0c8259236de24b1116dd26748760
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ *.swp
3
+ /.bundle
4
+ /tmp
@@ -0,0 +1 @@
1
+ 2.2.3
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm: 2.2.3
3
+ cache: bundler
4
+ sudo: false
5
+ before_install:
6
+ - "echo '--colour' > ~/.rspec"
7
+ - git config --global user.name 'Travis CI'
8
+ - git config --global user.email 'travis-ci@example.com'
9
+ install: bundle install
10
+ notifications:
11
+ email: false
@@ -0,0 +1,38 @@
1
+ # Contributing
2
+
3
+ We love pull requests from everyone.
4
+
5
+ Fork the repo:
6
+
7
+ git clone git@github.com:proletarian/underwear.git
8
+
9
+ Set up your machine:
10
+
11
+ ./bin/setup
12
+
13
+ Make sure the tests pass:
14
+
15
+ rake
16
+
17
+ Make your change.
18
+ Write tests.
19
+ Follow a [style guide][style].
20
+ Make the tests pass:
21
+
22
+ rake
23
+
24
+ Write a [good commit message][commit].
25
+ Push to your fork.
26
+ [Submit a pull request][pr].
27
+
28
+ [commit]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
29
+ [pr]: https://github.com/proletarian/underwear/compare/
30
+
31
+ Wait for me.
32
+ I try to at least comment on pull requests within one business day.
33
+ I may suggest changes.
34
+
35
+ ## Versions
36
+
37
+ To update the Ruby version,
38
+ change `.ruby-version` and `.travis.yml`.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,123 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ underwear (0.0.1)
5
+ bundler (~> 1.3)
6
+ rails (~> 4.2.4)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (4.2.4)
12
+ actionpack (= 4.2.4)
13
+ actionview (= 4.2.4)
14
+ activejob (= 4.2.4)
15
+ mail (~> 2.5, >= 2.5.4)
16
+ rails-dom-testing (~> 1.0, >= 1.0.5)
17
+ actionpack (4.2.4)
18
+ actionview (= 4.2.4)
19
+ activesupport (= 4.2.4)
20
+ rack (~> 1.6)
21
+ rack-test (~> 0.6.2)
22
+ rails-dom-testing (~> 1.0, >= 1.0.5)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
+ actionview (4.2.4)
25
+ activesupport (= 4.2.4)
26
+ builder (~> 3.1)
27
+ erubis (~> 2.7.0)
28
+ rails-dom-testing (~> 1.0, >= 1.0.5)
29
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
30
+ activejob (4.2.4)
31
+ activesupport (= 4.2.4)
32
+ globalid (>= 0.3.0)
33
+ activemodel (4.2.4)
34
+ activesupport (= 4.2.4)
35
+ builder (~> 3.1)
36
+ activerecord (4.2.4)
37
+ activemodel (= 4.2.4)
38
+ activesupport (= 4.2.4)
39
+ arel (~> 6.0)
40
+ activesupport (4.2.4)
41
+ i18n (~> 0.7)
42
+ json (~> 1.7, >= 1.7.7)
43
+ minitest (~> 5.1)
44
+ thread_safe (~> 0.3, >= 0.3.4)
45
+ tzinfo (~> 1.1)
46
+ arel (6.0.3)
47
+ builder (3.2.2)
48
+ diff-lcs (1.2.5)
49
+ erubis (2.7.0)
50
+ globalid (0.3.6)
51
+ activesupport (>= 4.1.0)
52
+ i18n (0.7.0)
53
+ json (1.8.3)
54
+ loofah (2.0.3)
55
+ nokogiri (>= 1.5.9)
56
+ mail (2.6.3)
57
+ mime-types (>= 1.16, < 3)
58
+ mime-types (2.6.1)
59
+ mini_portile (0.6.2)
60
+ minitest (5.8.0)
61
+ nokogiri (1.6.6.2)
62
+ mini_portile (~> 0.6.0)
63
+ rack (1.6.4)
64
+ rack-test (0.6.3)
65
+ rack (>= 1.0)
66
+ rails (4.2.4)
67
+ actionmailer (= 4.2.4)
68
+ actionpack (= 4.2.4)
69
+ actionview (= 4.2.4)
70
+ activejob (= 4.2.4)
71
+ activemodel (= 4.2.4)
72
+ activerecord (= 4.2.4)
73
+ activesupport (= 4.2.4)
74
+ bundler (>= 1.3.0, < 2.0)
75
+ railties (= 4.2.4)
76
+ sprockets-rails
77
+ rails-deprecated_sanitizer (1.0.3)
78
+ activesupport (>= 4.2.0.alpha)
79
+ rails-dom-testing (1.0.7)
80
+ activesupport (>= 4.2.0.beta, < 5.0)
81
+ nokogiri (~> 1.6.0)
82
+ rails-deprecated_sanitizer (>= 1.0.1)
83
+ rails-html-sanitizer (1.0.2)
84
+ loofah (~> 2.0)
85
+ railties (4.2.4)
86
+ actionpack (= 4.2.4)
87
+ activesupport (= 4.2.4)
88
+ rake (>= 0.8.7)
89
+ thor (>= 0.18.1, < 2.0)
90
+ rake (10.4.2)
91
+ rspec (3.2.0)
92
+ rspec-core (~> 3.2.0)
93
+ rspec-expectations (~> 3.2.0)
94
+ rspec-mocks (~> 3.2.0)
95
+ rspec-core (3.2.3)
96
+ rspec-support (~> 3.2.0)
97
+ rspec-expectations (3.2.1)
98
+ diff-lcs (>= 1.2.0, < 2.0)
99
+ rspec-support (~> 3.2.0)
100
+ rspec-mocks (3.2.1)
101
+ diff-lcs (>= 1.2.0, < 2.0)
102
+ rspec-support (~> 3.2.0)
103
+ rspec-support (3.2.2)
104
+ sprockets (3.3.3)
105
+ rack (~> 1.0)
106
+ sprockets-rails (2.3.2)
107
+ actionpack (>= 3.0)
108
+ activesupport (>= 3.0)
109
+ sprockets (>= 2.8, < 4.0)
110
+ thor (0.19.1)
111
+ thread_safe (0.3.5)
112
+ tzinfo (1.2.2)
113
+ thread_safe (~> 0.1)
114
+
115
+ PLATFORMS
116
+ ruby
117
+
118
+ DEPENDENCIES
119
+ rspec (~> 3.2)
120
+ underwear!
121
+
122
+ BUNDLED WITH
123
+ 1.10.6
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010-2015 Adeel Ahmad, 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
File without changes
@@ -0,0 +1,194 @@
1
+ NOTE: Underwear is under heavy and frequent development and is not recommeded for use yet.
2
+
3
+ Underwear is based on Suspenders, the base Rails application used at
4
+ [thoughtbot](http://thoughtbot.com).
5
+
6
+ ## Installation
7
+
8
+ First install the underwear gem:
9
+
10
+ gem install underwear
11
+
12
+ Then run:
13
+
14
+ underwear projectname
15
+
16
+ This will create a Rails app in `projectname` using the latest version of Rails.
17
+ Note: This will also create Heroku staging and production apps using the name you provide, so make it unique.
18
+
19
+ ## Gemfile
20
+
21
+ To see the latest and greatest gems, look at Underwear'
22
+ [Gemfile](templates/Gemfile.erb), which will be appended to the default
23
+ generated projectname/Gemfile.
24
+
25
+ It includes application gems like:
26
+
27
+ * [AASM](https://github.com/aasm/aasm) for state machines for Ruby classes
28
+ * [Autoprefixer Rails](https://github.com/ai/autoprefixer-rails) for CSS vendor prefixes
29
+ * [Awesome Print](https://github.com/michaeldv/awesome_print) Pretty print your Ruby objects with style
30
+ * [Devise](https://github.com/plataformatec/devise) Flexible authentication solution.
31
+ * [FriendlyId](https://github.com/norman/friendly_id) FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for Active Record.
32
+ * [jQuery Rails](https://github.com/rails/jquery-rails) for jQuery
33
+ * [New Relic RPM](https://github.com/newrelic/rpm) for monitoring performance
34
+ * [Paperclip](https://github.com/thoughtbot/paperclip) Easy file attachment management for ActiveRecord.
35
+ * [Postgres](https://github.com/ged/ruby-pg) for access to the Postgres database
36
+ * [Rack Canonical Host](https://github.com/tylerhunt/rack-canonical-host) to
37
+ ensure all requests are served from the same domain
38
+ * [Rack Timeout](https://github.com/kch/rack-timeout) to abort requests that are
39
+ taking too long
40
+ * [Raven (Sentry)](https://github.com/getsentry/raven-ruby) for exception notification
41
+ * [Recipient Interceptor](https://github.com/croaky/recipient_interceptor) to
42
+ avoid accidentally sending emails to real people from staging
43
+ * [Semantic UI](https://github.com/doabit/semantic-ui-sass) UI component framework based around useful principles from natural language.
44
+ * [Sidekiq](https://github.com/mperham/sidekiq) for background processing
45
+ * [Puma](https://github.com/puma/puma) to serve HTTP requests
46
+
47
+ And development gems like:
48
+
49
+ * [Bullet](https://github.com/flyerhzm/bullet) help to kill N+1 queries and unused eager loading
50
+ * [Bundler Audit](https://github.com/rubysec/bundler-audit) for scanning the
51
+ Gemfile for insecure dependencies based on published CVEs
52
+ * [ByeBug](https://github.com/deivid-rodriguez/byebug) for interactively
53
+ debugging behavior
54
+ * [Dotenv](https://github.com/bkeepers/dotenv) for loading environment variables
55
+ * [Faker](https://github.com/stympy/faker) A library for generating fake data such as names, addresses, and phone numbers.
56
+ * [Pry Rails](https://github.com/rweng/pry-rails) for interactively exploring
57
+ objects
58
+ * [Spring](https://github.com/rails/spring) for fast Rails actions via
59
+ pre-loading
60
+ * [Web Console](https://github.com/rails/web-console) for better debugging via
61
+ in-browser IRB consoles.
62
+
63
+ And testing gems like:
64
+
65
+ * [Capybara](https://github.com/jnicklas/capybara) and
66
+ [Capybara Webkit](https://github.com/thoughtbot/capybara-webkit) for
67
+ integration testing
68
+ * [Factory Girl](https://github.com/thoughtbot/factory_girl) for test data
69
+ * [RSpec Rails](https://github.com/rspec/rspec-rails) RSpec for Rails-3+
70
+ * [RSpec Mocks](https://github.com/rspec/rspec-mocks) for stubbing and spying
71
+ * [Shoulda Matchers](https://github.com/thoughtbot/shoulda-matchers) for common
72
+ RSpec matchers
73
+
74
+ TODO
75
+ * [Database Cleaner](https://github.com/DatabaseCleaner/database_cleaner) Strategies for cleaning databases in Ruby.
76
+ * [Webmock](https://github.com/bblimke/webmock) Library for stubbing and setting expectations on HTTP requests in Ruby.
77
+ * [VCR](https://github.com/vcr/vcr) Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
78
+ * [Simplecov](https://github.com/colszowka/simplecov) Code coverage for Ruby 1.9+ with a powerful configuration library and automatic merging of coverage across test suites.
79
+
80
+
81
+ ## Other goodies
82
+
83
+ Underwear also comes with:
84
+
85
+ * The [`./bin/setup`][setup] convention for new developer setup
86
+ * The `./bin/deploy` convention for deploying to Heroku
87
+ * Rails' flashes set up and in application layout
88
+ * A few nice time formats set up for localization
89
+ * `Rack::Deflater` to [compress responses with Gzip][compress]
90
+ * A [low database connection pool limit][pool]
91
+ * [Safe binstubs][binstub]
92
+ * [t() and l() in specs without prefixing with I18n][i18n]
93
+ * An automatically-created `SECRET_KEY_BASE` environment variable in all
94
+ environments
95
+ * Configuration for [CircleCI][circle] Continuous Integration (tests)
96
+ * The analytics adapter [Segment][segment] (and therefore config for Google
97
+ Analytics, Intercom, Facebook Ads, Twitter Ads, etc.)
98
+
99
+ [setup]: http://robots.thoughtbot.com/bin-setup
100
+ [compress]: http://robots.thoughtbot.com/content-compression-with-rack-deflater/
101
+ [pool]: https://devcenter.heroku.com/articles/concurrency-and-database-connections
102
+ [binstub]: https://github.com/thoughtbot/underwear/pull/282
103
+ [i18n]: https://github.com/thoughtbot/underwear/pull/304
104
+ [circle]: https://circleci.com/docs
105
+ [segment]: https://segment.com
106
+
107
+ ## Heroku
108
+
109
+ You can optionally create Heroku staging and production apps:
110
+
111
+ underwear app --heroku true
112
+
113
+ This:
114
+
115
+ * Creates a staging and production Heroku app
116
+ * Sets them as `staging` and `production` Git remotes
117
+ * Configures staging with `RACK_ENV` and `RAILS_ENV` environment variables set
118
+ to `staging`
119
+ * Adds the [Rails Stdout Logging][logging-gem] gem
120
+ to configure the app to log to standard out,
121
+ which is how [Heroku's logging][heroku-logging] works.
122
+
123
+ [logging-gem]: https://github.com/heroku/rails_stdout_logging
124
+ [heroku-logging]: https://devcenter.heroku.com/articles/logging#writing-to-your-log
125
+
126
+ You can optionally specify alternate Heroku flags:
127
+
128
+ underwear app \
129
+ --heroku true \
130
+ --heroku-flags "--region eu --addons newrelic,sendgrid,ssl"
131
+
132
+ See all possible Heroku flags:
133
+
134
+ heroku help create
135
+
136
+ ## Git
137
+
138
+ This will initialize a new git repository for your Rails app. You can
139
+ bypass this with the `--skip-git` option:
140
+
141
+ underwear app --skip-git true
142
+
143
+ ## GitHub
144
+
145
+ You can optionally create a GitHub repository for the suspended Rails app. It
146
+ requires that you have [Hub](https://github.com/github/hub) on your system:
147
+
148
+ curl http://hub.github.com/standalone -sLo ~/bin/hub && chmod +x ~/bin/hub
149
+ underwear app --github organization/project
150
+
151
+ This has the same effect as running:
152
+
153
+ hub create organization/project
154
+
155
+ ## Spring
156
+
157
+ Underwear uses [spring](https://github.com/rails/spring) by default.
158
+ It makes Rails applications load faster, but it might introduce confusing issues
159
+ around stale code not being refreshed.
160
+ If you think your application is running old code, run `spring stop`.
161
+ And if you'd rather not use spring, add `DISABLE_SPRING=1` to your login file.
162
+
163
+ ## Dependencies
164
+
165
+ Underwear requires the latest version of Ruby.
166
+
167
+ Some gems included in Underwear have native extensions. You should have GCC
168
+ installed on your machine before generating an app with Underwear.
169
+
170
+ Use [OS X GCC Installer](https://github.com/kennethreitz/osx-gcc-installer/) for
171
+ Snow Leopard (OS X 10.6).
172
+
173
+ Use [Command Line Tools for XCode](https://developer.apple.com/downloads/index.action)
174
+ for Lion (OS X 10.7) or Mountain Lion (OS X 10.8).
175
+
176
+ We use [Capybara Webkit](https://github.com/thoughtbot/capybara-webkit) for
177
+ full-stack JavaScript integration testing. It requires QT. Instructions for
178
+ installing QT are
179
+ [here](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
180
+
181
+ PostgreSQL needs to be installed and running for the `db:create` rake task.
182
+
183
+ ## Issues
184
+
185
+ If you have problems, please create a
186
+ [GitHub Issue](https://github.com/thoughtbot/underwear/issues).
187
+
188
+ ## Contributing
189
+
190
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
191
+
192
+ ## License
193
+
194
+ [LICENSE]: LICENSE
@@ -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
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' 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('rake', 'rake')
@@ -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')