philosophies-suspenders 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) 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/Gemfile +3 -0
  6. data/Gemfile.lock +123 -0
  7. data/LICENSE +21 -0
  8. data/NEWS.md +399 -0
  9. data/README.md +194 -0
  10. data/Rakefile +8 -0
  11. data/bin/philosophies-suspenders +18 -0
  12. data/bin/rake +16 -0
  13. data/bin/rspec +16 -0
  14. data/lib/suspenders/actions.rb +33 -0
  15. data/lib/suspenders/app_builder.rb +512 -0
  16. data/lib/suspenders/generators/app_generator.rb +249 -0
  17. data/lib/suspenders/version.rb +5 -0
  18. data/lib/suspenders.rb +4 -0
  19. data/spec/fakes/bin/heroku +5 -0
  20. data/spec/fakes/bin/hub +5 -0
  21. data/spec/features/github_spec.rb +10 -0
  22. data/spec/features/heroku_spec.rb +20 -0
  23. data/spec/features/new_project_spec.rb +157 -0
  24. data/spec/spec_helper.rb +23 -0
  25. data/spec/support/fake_github.rb +21 -0
  26. data/spec/support/fake_heroku.rb +43 -0
  27. data/spec/support/suspenders.rb +49 -0
  28. data/suspenders.gemspec +34 -0
  29. data/templates/.rubocop.yml +25 -0
  30. data/templates/Gemfile.erb +58 -0
  31. data/templates/Procfile +2 -0
  32. data/templates/README.md.erb +39 -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/airbrake.rb +5 -0
  38. data/templates/application.js +4 -0
  39. data/templates/application.scss +1 -0
  40. data/templates/bundler_audit.rake +12 -0
  41. data/templates/config_i18n_tasks.yml +13 -0
  42. data/templates/config_locales_en.yml.erb +19 -0
  43. data/templates/database_cleaner_rspec.rb +21 -0
  44. data/templates/disable_xml_params.rb +3 -0
  45. data/templates/errors.rb +34 -0
  46. data/templates/factory_girl_rspec.rb +3 -0
  47. data/templates/flashes_helper.rb +5 -0
  48. data/templates/i18n.rb +3 -0
  49. data/templates/json_encoding.rb +1 -0
  50. data/templates/newrelic.yml.erb +34 -0
  51. data/templates/postgresql_database.yml.erb +26 -0
  52. data/templates/rails_helper.rb +17 -0
  53. data/templates/secrets.yml +14 -0
  54. data/templates/setup.rb +5 -0
  55. data/templates/smtp.rb +17 -0
  56. data/templates/spec_helper.rb +13 -0
  57. data/templates/staging.rb +1 -0
  58. data/templates/suspenders_gitignore +34 -0
  59. data/templates/suspenders_layout.html.erb.erb +21 -0
  60. data/templates/unicorn.rb +30 -0
  61. metadata +160 -0
@@ -0,0 +1,34 @@
1
+ require "net/http"
2
+ require "net/smtp"
3
+
4
+ # Example:
5
+ # begin
6
+ # some http call
7
+ # rescue *HTTP_ERRORS => error
8
+ # notify_hoptoad error
9
+ # end
10
+
11
+ HTTP_ERRORS = [
12
+ EOFError,
13
+ Errno::ECONNRESET,
14
+ Errno::EINVAL,
15
+ Net::HTTPBadResponse,
16
+ Net::HTTPHeaderSyntaxError,
17
+ Net::ProtocolError,
18
+ Timeout::Error
19
+ ]
20
+
21
+ SMTP_SERVER_ERRORS = [
22
+ IOError,
23
+ Net::SMTPAuthenticationError,
24
+ Net::SMTPServerBusy,
25
+ Net::SMTPUnknownError,
26
+ TimeoutError
27
+ ]
28
+
29
+ SMTP_CLIENT_ERRORS = [
30
+ Net::SMTPFatalError,
31
+ Net::SMTPSyntaxError
32
+ ]
33
+
34
+ SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include FactoryGirl::Syntax::Methods
3
+ end
@@ -0,0 +1,5 @@
1
+ module FlashesHelper
2
+ def user_facing_flashes
3
+ flash.to_hash.slice('alert', 'error', 'notice', 'success')
4
+ end
5
+ end
data/templates/i18n.rb ADDED
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include AbstractController::Translation
3
+ end
@@ -0,0 +1 @@
1
+ ActiveSupport::JSON::Encoding.time_precision = 0
@@ -0,0 +1,34 @@
1
+ common: &default_settings
2
+ app_name: "<%= app_name %>"
3
+ audit_log:
4
+ enabled: false
5
+ browser_monitoring:
6
+ auto_instrument: true
7
+ capture_params: false
8
+ developer_mode: false
9
+ error_collector:
10
+ capture_source: true
11
+ enabled: true
12
+ ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
13
+ license_key: "<%%= ENV["NEW_RELIC_LICENSE_KEY"] %>"
14
+ log_level: info
15
+ monitor_mode: true
16
+ transaction_tracer:
17
+ enabled: true
18
+ record_sql: obfuscated
19
+ stack_trace_threshold: 0.500
20
+ transaction_threshold: apdex_f
21
+ development:
22
+ <<: *default_settings
23
+ monitor_mode: false
24
+ developer_mode: true
25
+ test:
26
+ <<: *default_settings
27
+ monitor_mode: false
28
+ production:
29
+ <<: *default_settings
30
+ monitor_mode: true
31
+ staging:
32
+ <<: *default_settings
33
+ app_name: "<%= app_name %> (Staging)"
34
+ monitor_mode: true
@@ -0,0 +1,26 @@
1
+ default: &default
2
+ adapter: postgresql
3
+ encoding: utf8
4
+
5
+ local_default: &local_default
6
+ <<: *default
7
+ min_messages: warning
8
+ pool: 2
9
+ timeout: 5000
10
+ host: localhost
11
+
12
+ development:
13
+ <<: *local_default
14
+ database: <%= app_name %>_development
15
+
16
+ test:
17
+ <<: *local_default
18
+ database: <%= app_name %>_test
19
+
20
+ staging:
21
+ <<: *default
22
+ url: <%%= ENV['DATABASE_URL'] %>
23
+
24
+ production:
25
+ <<: *default
26
+ url: <%%= ENV['DATABASE_URL'] %>
@@ -0,0 +1,17 @@
1
+ ENV['RAILS_ENV'] = 'test'
2
+
3
+ require File.expand_path('../../config/environment', __FILE__)
4
+
5
+ require 'rspec/rails'
6
+ require 'shoulda/matchers'
7
+
8
+ Dir[Rails.root.join('spec/support/**/*.rb')].sort.each { |file| require file }
9
+
10
+ RSpec.configure do |config|
11
+ config.infer_base_class_for_anonymous_controllers = false
12
+ config.infer_spec_type_from_file_location!
13
+ config.use_transactional_fixtures = false
14
+ end
15
+
16
+ ActiveRecord::Migration.maintain_test_schema!
17
+ Capybara.javascript_driver = :webkit
@@ -0,0 +1,14 @@
1
+ default: &default
2
+ secret_key_base: <%%= ENV["SECRET_KEY_BASE"] %>
3
+
4
+ development:
5
+ <<: *default
6
+
7
+ test:
8
+ <<: *default
9
+
10
+ staging:
11
+ <<: *default
12
+
13
+ production:
14
+ <<: *default
@@ -0,0 +1,5 @@
1
+ setup :secret_key_base
2
+ env 'HOST', provide('Host', default: 'localhost:3000')
3
+ env 'ASSET_HOST', provide('Asset host', default: 'localhost:3000')
4
+
5
+ rake 'db:setup'
data/templates/smtp.rb ADDED
@@ -0,0 +1,17 @@
1
+ if ENV['SMTP_PROVIDER'] == 'mandrill'
2
+ SMTP_USERNAME = ENV.fetch('MANDRILL_USERNAME')
3
+ SMTP_PASSWORD = ENV.fetch('MANDRILL_APIKEY')
4
+ else
5
+ SMTP_USERNAME = ENV.fetch('SMTP_USERNAME')
6
+ SMTP_PASSWORD = ENV.fetch("SMTP_PASSWORD")
7
+ end
8
+
9
+ SMTP_SETTINGS = {
10
+ address: ENV.fetch("SMTP_ADDRESS"), # example: "smtp.mandrillapp.com"
11
+ authentication: :plain,
12
+ domain: ENV.fetch("SMTP_DOMAIN"), # example: "heroku.com"
13
+ enable_starttls_auto: true,
14
+ password: SMTP_PASSWORD,
15
+ port: "587",
16
+ user_name: SMTP_USERNAME
17
+ }
@@ -0,0 +1,13 @@
1
+ # http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
2
+ RSpec.configure do |config|
3
+ config.expect_with :rspec do |expectations|
4
+ expectations.syntax = :expect
5
+ end
6
+
7
+ config.mock_with :rspec do |mocks|
8
+ mocks.syntax = :expect
9
+ mocks.verify_partial_doubles = true
10
+ end
11
+
12
+ config.order = :random
13
+ end
@@ -0,0 +1 @@
1
+ require_relative "production"
@@ -0,0 +1,34 @@
1
+ # Global
2
+ !.keep
3
+ *.DS_Store
4
+ *.sw[nop]
5
+ .sass-cache
6
+ dump.rdb
7
+ latest.dump
8
+ /coverage/*
9
+ .build
10
+
11
+ # Ruby & Rails
12
+ .zsh_rake_cache
13
+ .rbenv-version
14
+ .rbenv-vars
15
+ .ruby-version
16
+ .env
17
+ /.bundle
18
+ /.foreman
19
+ public/uploads
20
+ public/system
21
+ public/assets
22
+ /db/*.sqlite3
23
+ /db/*.sqlite3-journal
24
+ /log/*
25
+ /tmp/*
26
+ .rspec
27
+ /spec/tmp
28
+ /vendor/bundle
29
+ /vendor/assets/bower_components
30
+ rerun.txt
31
+ tags
32
+ .tags
33
+ .gemtags
34
+ zeus.json
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="ROBOTS" content="NOODP" />
6
+ <meta name="viewport" content="initial-scale=1" />
7
+ <%%#
8
+ Configure default and controller-, and view-specific titles in
9
+ config/locales/en.yml. For more see:
10
+ https://github.com/calebthompson/title#usage
11
+ %>
12
+ <title><%%= title %></title>
13
+ <%%= stylesheet_link_tag :application, media: "all" %>
14
+ <%%= csrf_meta_tags %>
15
+ </head>
16
+ <body class="<%%= body_class %>">
17
+ <%%= render "flashes" -%>
18
+ <%%= yield %>
19
+ <%%= render "javascript" %>
20
+ </body>
21
+ </html>
@@ -0,0 +1,30 @@
1
+ # https://devcenter.heroku.com/articles/rails-unicorn
2
+
3
+ worker_processes (ENV["UNICORN_WORKERS"] || 3).to_i
4
+ timeout (ENV["UNICORN_TIMEOUT"] || 15).to_i
5
+ preload_app true
6
+
7
+ before_fork do |_server, _worker|
8
+ Signal.trap "TERM" do
9
+ puts "Unicorn master intercepting TERM, sending myself QUIT instead"
10
+ Process.kill "QUIT", Process.pid
11
+ end
12
+
13
+ if defined? ActiveRecord::Base
14
+ ActiveRecord::Base.connection.disconnect!
15
+ end
16
+ end
17
+
18
+ after_fork do |_server, _worker|
19
+ Signal.trap "TERM" do
20
+ puts "Unicorn worker intercepting TERM, waiting for master to send QUIT"
21
+ end
22
+
23
+ if defined? ActiveRecord::Base
24
+ config = ActiveRecord::Base.configurations[Rails.env] ||
25
+ Rails.application.config.database_configuration[Rails.env]
26
+ config["reaping_frequency"] = (ENV["DB_REAPING_FREQUENCY"] || 10).to_i
27
+ config["pool"] = (ENV["DB_POOL"] || 2).to_i
28
+ ActiveRecord::Base.establish_connection(config)
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,160 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: philosophies-suspenders
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Philosophie
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 4.2.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 4.2.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.2'
55
+ description: |
56
+ Suspenders is a base Rails project that you can upgrade. It is used by
57
+ Philosophie to get a jump start on a working app. Use Suspenders if you're in a
58
+ rush to build something amazing; don't use it if you like missing deadlines.
59
+ email: support@thoughtbot.com
60
+ executables:
61
+ - philosophies-suspenders
62
+ extensions: []
63
+ extra_rdoc_files:
64
+ - README.md
65
+ - LICENSE
66
+ files:
67
+ - ".gitignore"
68
+ - ".ruby-version"
69
+ - ".travis.yml"
70
+ - Gemfile
71
+ - Gemfile.lock
72
+ - LICENSE
73
+ - NEWS.md
74
+ - README.md
75
+ - Rakefile
76
+ - bin/philosophies-suspenders
77
+ - bin/rake
78
+ - bin/rspec
79
+ - lib/suspenders.rb
80
+ - lib/suspenders/actions.rb
81
+ - lib/suspenders/app_builder.rb
82
+ - lib/suspenders/generators/app_generator.rb
83
+ - lib/suspenders/version.rb
84
+ - spec/fakes/bin/heroku
85
+ - spec/fakes/bin/hub
86
+ - spec/features/github_spec.rb
87
+ - spec/features/heroku_spec.rb
88
+ - spec/features/new_project_spec.rb
89
+ - spec/spec_helper.rb
90
+ - spec/support/fake_github.rb
91
+ - spec/support/fake_heroku.rb
92
+ - spec/support/suspenders.rb
93
+ - suspenders.gemspec
94
+ - templates/.rubocop.yml
95
+ - templates/Gemfile.erb
96
+ - templates/Procfile
97
+ - templates/README.md.erb
98
+ - templates/_analytics.html.erb
99
+ - templates/_flashes.html.erb
100
+ - templates/_javascript.html.erb
101
+ - templates/action_mailer.rb
102
+ - templates/airbrake.rb
103
+ - templates/application.js
104
+ - templates/application.scss
105
+ - templates/bundler_audit.rake
106
+ - templates/config_i18n_tasks.yml
107
+ - templates/config_locales_en.yml.erb
108
+ - templates/database_cleaner_rspec.rb
109
+ - templates/disable_xml_params.rb
110
+ - templates/errors.rb
111
+ - templates/factory_girl_rspec.rb
112
+ - templates/flashes_helper.rb
113
+ - templates/i18n.rb
114
+ - templates/json_encoding.rb
115
+ - templates/newrelic.yml.erb
116
+ - templates/postgresql_database.yml.erb
117
+ - templates/rails_helper.rb
118
+ - templates/secrets.yml
119
+ - templates/setup.rb
120
+ - templates/smtp.rb
121
+ - templates/spec_helper.rb
122
+ - templates/staging.rb
123
+ - templates/suspenders_gitignore
124
+ - templates/suspenders_layout.html.erb.erb
125
+ - templates/unicorn.rb
126
+ homepage: https://github.com/philosophie/suspenders
127
+ licenses:
128
+ - MIT
129
+ metadata: {}
130
+ post_install_message:
131
+ rdoc_options:
132
+ - "--charset=UTF-8"
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: 2.2.2
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubyforge_project:
147
+ rubygems_version: 2.4.5
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Generate a Rails app using Philosophie's best practices.
151
+ test_files:
152
+ - spec/fakes/bin/heroku
153
+ - spec/fakes/bin/hub
154
+ - spec/features/github_spec.rb
155
+ - spec/features/heroku_spec.rb
156
+ - spec/features/new_project_spec.rb
157
+ - spec/spec_helper.rb
158
+ - spec/support/fake_github.rb
159
+ - spec/support/fake_heroku.rb
160
+ - spec/support/suspenders.rb