armadura 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +11 -0
  5. data/Gemfile +3 -0
  6. data/LICENSE +19 -0
  7. data/README.md +218 -0
  8. data/Rakefile +8 -0
  9. data/USAGE +9 -0
  10. data/armadura.gemspec +29 -0
  11. data/bin/armadura +23 -0
  12. data/bin/rake +16 -0
  13. data/bin/rspec +16 -0
  14. data/bin/setup +13 -0
  15. data/lib/armadura.rb +7 -0
  16. data/lib/armadura/actions.rb +33 -0
  17. data/lib/armadura/adapters/heroku.rb +118 -0
  18. data/lib/armadura/app_builder.rb +484 -0
  19. data/lib/armadura/generators/app_generator.rb +245 -0
  20. data/lib/armadura/generators/static_generator.rb +10 -0
  21. data/lib/armadura/generators/stylesheet_base_generator.rb +37 -0
  22. data/lib/armadura/version.rb +8 -0
  23. data/spec/adapters/heroku_spec.rb +57 -0
  24. data/spec/fakes/bin/heroku +5 -0
  25. data/spec/fakes/bin/hub +5 -0
  26. data/spec/features/cli_help_spec.rb +36 -0
  27. data/spec/features/github_spec.rb +16 -0
  28. data/spec/features/heroku_spec.rb +75 -0
  29. data/spec/features/new_project_spec.rb +295 -0
  30. data/spec/features/sidekiq_spec.rb +30 -0
  31. data/spec/spec_helper.rb +20 -0
  32. data/spec/support/armadura.rb +83 -0
  33. data/spec/support/fake_github.rb +21 -0
  34. data/spec/support/fake_heroku.rb +53 -0
  35. data/templates/Gemfile.erb +60 -0
  36. data/templates/Procfile +2 -0
  37. data/templates/README.md.erb +28 -0
  38. data/templates/_analytics.html.erb +7 -0
  39. data/templates/_css_overrides.html.erb +7 -0
  40. data/templates/_flashes.html.erb +7 -0
  41. data/templates/_javascript.html.erb +12 -0
  42. data/templates/action_mailer.rb +5 -0
  43. data/templates/app.json.erb +39 -0
  44. data/templates/application.scss +9 -0
  45. data/templates/armadura_gitignore +14 -0
  46. data/templates/armadura_layout.html.erb.erb +22 -0
  47. data/templates/bin_deploy +12 -0
  48. data/templates/bin_setup +22 -0
  49. data/templates/bin_setup_review_app.erb +19 -0
  50. data/templates/browserslist +3 -0
  51. data/templates/bundler_audit.rake +12 -0
  52. data/templates/capybara_webkit.rb +5 -0
  53. data/templates/circle.yml.erb +6 -0
  54. data/templates/config_locales_en.yml.erb +19 -0
  55. data/templates/database_cleaner_rspec.rb +21 -0
  56. data/templates/dev.rake +12 -0
  57. data/templates/dotfiles/.ctags +2 -0
  58. data/templates/dotfiles/.env +14 -0
  59. data/templates/errors.rb +34 -0
  60. data/templates/factories.rb +2 -0
  61. data/templates/factory_girl_rspec.rb +3 -0
  62. data/templates/flashes_helper.rb +5 -0
  63. data/templates/hound.yml +14 -0
  64. data/templates/i18n.rb +3 -0
  65. data/templates/json_encoding.rb +1 -0
  66. data/templates/postgresql_database.yml.erb +21 -0
  67. data/templates/puma.rb +28 -0
  68. data/templates/rack_mini_profiler.rb +5 -0
  69. data/templates/rails_helper.rb +22 -0
  70. data/templates/secrets.yml +14 -0
  71. data/templates/shoulda_matchers_config_rspec.rb +6 -0
  72. data/templates/sidekiq.yml +6 -0
  73. data/templates/smtp.rb +13 -0
  74. data/templates/spec_helper.rb +29 -0
  75. metadata +188 -0
@@ -0,0 +1,14 @@
1
+ # https://github.com/ddollar/forego
2
+ ASSET_HOST=localhost:3000
3
+ APPLICATION_HOST=localhost:3000
4
+ PORT=3000
5
+ EXECJS_RUNTIME=Node
6
+ RACK_ENV=development
7
+ RACK_MINI_PROFILER=0
8
+ SECRET_KEY_BASE=development_secret
9
+ SENTRY_DSN="https://YOUR_ACCOUNT@sentry.io/YOUR_PROJECT"
10
+ SMTP_ADDRESS=smtp.example.com
11
+ SMTP_DOMAIN=example.com
12
+ SMTP_PASSWORD=password
13
+ SMTP_USERNAME=username
14
+ WEB_CONCURRENCY=1
@@ -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
+ Timeout::Error,
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,2 @@
1
+ FactoryGirl.define do
2
+ end
@@ -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
@@ -0,0 +1,14 @@
1
+ # See https://houndci.com/configuration for help.
2
+ haml:
3
+ # config_file: .haml-style.yml
4
+ enabled: true
5
+ javascript:
6
+ # config_file: .javascript-style.json
7
+ enabled: true
8
+ # ignore_file: .javascript_ignore
9
+ ruby:
10
+ # config_file: .ruby-style.yml
11
+ enabled: true
12
+ scss:
13
+ # config_file: .scss-style.yml
14
+ enabled: true
data/templates/i18n.rb ADDED
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include ActionView::Helpers::TranslationHelper
3
+ end
@@ -0,0 +1 @@
1
+ ActiveSupport::JSON::Encoding.time_precision = 0
@@ -0,0 +1,21 @@
1
+ development: &default
2
+ adapter: postgresql
3
+ database: <%= app_name %>_development
4
+ encoding: utf8
5
+ min_messages: warning
6
+ pool: <%%= Integer(ENV.fetch("DB_POOL", 5)) %>
7
+ reaping_frequency: <%%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
8
+ timeout: 5000
9
+
10
+ test:
11
+ <<: *default
12
+ database: <%= app_name %>_test
13
+
14
+ production: &deploy
15
+ encoding: utf8
16
+ min_messages: warning
17
+ pool: <%%= [Integer(ENV.fetch("MAX_THREADS", 5)), Integer(ENV.fetch("DB_POOL", 5))].max %>
18
+ timeout: 5000
19
+ url: <%%= ENV.fetch("DATABASE_URL", "") %>
20
+
21
+ staging: *deploy
data/templates/puma.rb ADDED
@@ -0,0 +1,28 @@
1
+ # https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server
2
+
3
+ # The environment variable WEB_CONCURRENCY may be set to a default value based
4
+ # on dyno size. To manually configure this value use heroku config:set
5
+ # WEB_CONCURRENCY.
6
+ #
7
+ # Increasing the number of workers will increase the amount of resting memory
8
+ # your dynos use. Increasing the number of threads will increase the amount of
9
+ # potential bloat added to your dynos when they are responding to heavy
10
+ # requests.
11
+ #
12
+ # Starting with a low number of workers and threads provides adequate
13
+ # performance for most applications, even under load, while maintaining a low
14
+ # risk of overusing memory.
15
+ workers Integer(ENV.fetch("WEB_CONCURRENCY", 2))
16
+ threads_count = Integer(ENV.fetch("MAX_THREADS", 2))
17
+ threads(threads_count, threads_count)
18
+
19
+ preload_app!
20
+
21
+ rackup DefaultRackup
22
+ environment ENV.fetch("RACK_ENV", "development")
23
+
24
+ on_worker_boot do
25
+ # Worker specific setup for Rails 4.1+
26
+ # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
27
+ ActiveRecord::Base.establish_connection
28
+ end
@@ -0,0 +1,5 @@
1
+ if ENV["RACK_MINI_PROFILER"].to_i > 0
2
+ require "rack-mini-profiler"
3
+
4
+ Rack::MiniProfilerRails.initialize!(Rails.application)
5
+ end
@@ -0,0 +1,22 @@
1
+ ENV["RACK_ENV"] = "test"
2
+
3
+ require File.expand_path("../../config/environment", __FILE__)
4
+ abort("DATABASE_URL environment variable is set") if ENV["DATABASE_URL"]
5
+
6
+ require "rspec/rails"
7
+
8
+ Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |file| require file }
9
+
10
+ module Features
11
+ # Extend this module in spec/support/features/*.rb
12
+ include Formulaic::Dsl
13
+ end
14
+
15
+ RSpec.configure do |config|
16
+ config.include Features, type: :feature
17
+ config.infer_base_class_for_anonymous_controllers = false
18
+ config.infer_spec_type_from_file_location!
19
+ config.use_transactional_fixtures = false
20
+ end
21
+
22
+ ActiveRecord::Migration.maintain_test_schema!
@@ -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,6 @@
1
+ Shoulda::Matchers.configure do |config|
2
+ config.integrate do |with|
3
+ with.test_framework :rspec
4
+ with.library :rails
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ ---
2
+ :concurrency: <%= Integer(ENV.fetch("DB_POOL", 5)) %>
3
+ :pidfile: tmp/pids/sidekiq.pid
4
+ :queues:
5
+ - default
6
+ - mailers
data/templates/smtp.rb ADDED
@@ -0,0 +1,13 @@
1
+ SMTP_SETTINGS = {
2
+ address: ENV.fetch("SMTP_ADDRESS"), # example: "smtp.sendgrid.net"
3
+ authentication: :plain,
4
+ domain: ENV.fetch("SMTP_DOMAIN"), # example: "heroku.com"
5
+ enable_starttls_auto: true,
6
+ password: ENV.fetch("SMTP_PASSWORD"),
7
+ port: "587",
8
+ user_name: ENV.fetch("SMTP_USERNAME")
9
+ }
10
+
11
+ if ENV["EMAIL_RECIPIENTS"].present?
12
+ Mail.register_interceptor RecipientInterceptor.new(ENV["EMAIL_RECIPIENTS"])
13
+ end
@@ -0,0 +1,29 @@
1
+ if ENV.fetch("COVERAGE", false)
2
+ require "simplecov"
3
+
4
+ if ENV["CIRCLE_ARTIFACTS"]
5
+ dir = File.join(ENV["CIRCLE_ARTIFACTS"], "coverage")
6
+ SimpleCov.coverage_dir(dir)
7
+ end
8
+
9
+ SimpleCov.start "rails"
10
+ end
11
+
12
+ require "webmock/rspec"
13
+
14
+ # http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
15
+ RSpec.configure do |config|
16
+ config.expect_with :rspec do |expectations|
17
+ expectations.syntax = :expect
18
+ end
19
+
20
+ config.mock_with :rspec do |mocks|
21
+ mocks.syntax = :expect
22
+ mocks.verify_partial_doubles = true
23
+ end
24
+
25
+ config.example_status_persistence_file_path = "tmp/rspec_examples.txt"
26
+ config.order = :random
27
+ end
28
+
29
+ WebMock.disable_net_connect!(allow_localhost: true)
metadata ADDED
@@ -0,0 +1,188 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: armadura
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Elliot Winkler <elliot.winkler@gmail.com>
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bitters
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: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 5.0.0.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 5.0.0.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.2'
69
+ description: Armadura generates Rails projects, preconfigured with sensible defaults.
70
+ email: elliot.winkler@gmail.com
71
+ executables:
72
+ - armadura
73
+ extensions: []
74
+ extra_rdoc_files:
75
+ - README.md
76
+ - LICENSE
77
+ files:
78
+ - ".gitignore"
79
+ - ".ruby-version"
80
+ - ".travis.yml"
81
+ - Gemfile
82
+ - LICENSE
83
+ - README.md
84
+ - Rakefile
85
+ - USAGE
86
+ - armadura.gemspec
87
+ - bin/armadura
88
+ - bin/rake
89
+ - bin/rspec
90
+ - bin/setup
91
+ - lib/armadura.rb
92
+ - lib/armadura/actions.rb
93
+ - lib/armadura/adapters/heroku.rb
94
+ - lib/armadura/app_builder.rb
95
+ - lib/armadura/generators/app_generator.rb
96
+ - lib/armadura/generators/static_generator.rb
97
+ - lib/armadura/generators/stylesheet_base_generator.rb
98
+ - lib/armadura/version.rb
99
+ - spec/adapters/heroku_spec.rb
100
+ - spec/fakes/bin/heroku
101
+ - spec/fakes/bin/hub
102
+ - spec/features/cli_help_spec.rb
103
+ - spec/features/github_spec.rb
104
+ - spec/features/heroku_spec.rb
105
+ - spec/features/new_project_spec.rb
106
+ - spec/features/sidekiq_spec.rb
107
+ - spec/spec_helper.rb
108
+ - spec/support/armadura.rb
109
+ - spec/support/fake_github.rb
110
+ - spec/support/fake_heroku.rb
111
+ - templates/Gemfile.erb
112
+ - templates/Procfile
113
+ - templates/README.md.erb
114
+ - templates/_analytics.html.erb
115
+ - templates/_css_overrides.html.erb
116
+ - templates/_flashes.html.erb
117
+ - templates/_javascript.html.erb
118
+ - templates/action_mailer.rb
119
+ - templates/app.json.erb
120
+ - templates/application.scss
121
+ - templates/armadura_gitignore
122
+ - templates/armadura_layout.html.erb.erb
123
+ - templates/bin_deploy
124
+ - templates/bin_setup
125
+ - templates/bin_setup_review_app.erb
126
+ - templates/browserslist
127
+ - templates/bundler_audit.rake
128
+ - templates/capybara_webkit.rb
129
+ - templates/circle.yml.erb
130
+ - templates/config_locales_en.yml.erb
131
+ - templates/database_cleaner_rspec.rb
132
+ - templates/dev.rake
133
+ - templates/dotfiles/.ctags
134
+ - templates/dotfiles/.env
135
+ - templates/errors.rb
136
+ - templates/factories.rb
137
+ - templates/factory_girl_rspec.rb
138
+ - templates/flashes_helper.rb
139
+ - templates/hound.yml
140
+ - templates/i18n.rb
141
+ - templates/json_encoding.rb
142
+ - templates/postgresql_database.yml.erb
143
+ - templates/puma.rb
144
+ - templates/rack_mini_profiler.rb
145
+ - templates/rails_helper.rb
146
+ - templates/secrets.yml
147
+ - templates/shoulda_matchers_config_rspec.rb
148
+ - templates/sidekiq.yml
149
+ - templates/smtp.rb
150
+ - templates/spec_helper.rb
151
+ homepage: https://github.com/mcmire/armadura
152
+ licenses:
153
+ - MIT
154
+ metadata: {}
155
+ post_install_message:
156
+ rdoc_options:
157
+ - "--charset=UTF-8"
158
+ require_paths:
159
+ - lib
160
+ required_ruby_version: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: 2.3.1
165
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ requirements: []
171
+ rubyforge_project:
172
+ rubygems_version: 2.5.1
173
+ signing_key:
174
+ specification_version: 4
175
+ summary: Armadura generates Rails projects, preconfigured with sensible defaults.
176
+ test_files:
177
+ - spec/adapters/heroku_spec.rb
178
+ - spec/fakes/bin/heroku
179
+ - spec/fakes/bin/hub
180
+ - spec/features/cli_help_spec.rb
181
+ - spec/features/github_spec.rb
182
+ - spec/features/heroku_spec.rb
183
+ - spec/features/new_project_spec.rb
184
+ - spec/features/sidekiq_spec.rb
185
+ - spec/spec_helper.rb
186
+ - spec/support/armadura.rb
187
+ - spec/support/fake_github.rb
188
+ - spec/support/fake_heroku.rb