kazan 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +8 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE +21 -0
  8. data/README.md +92 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/kazan +30 -0
  12. data/bin/setup +8 -0
  13. data/kazan.gemspec +32 -0
  14. data/lib/kazan/actions.rb +33 -0
  15. data/lib/kazan/app_builder.rb +308 -0
  16. data/lib/kazan/generators/app_generator.rb +177 -0
  17. data/lib/kazan/generators/clockwork_generator.rb +7 -0
  18. data/lib/kazan/generators/sidekiq_generator.rb +7 -0
  19. data/lib/kazan/version.rb +5 -0
  20. data/lib/kazan.rb +5 -0
  21. data/spec/kazan_spec.rb +21 -0
  22. data/spec/project_spec.rb +222 -0
  23. data/spec/spec_helper.rb +7 -0
  24. data/spec/support/hooks.rb +15 -0
  25. data/spec/support/kazan_spec_helpers.rb +71 -0
  26. data/templates/Gemfile.api.erb +53 -0
  27. data/templates/Gemfile.erb +68 -0
  28. data/templates/Procfile.erb +1 -0
  29. data/templates/README.md.erb +16 -0
  30. data/templates/_flashes.html.erb +7 -0
  31. data/templates/_javascript.html.erb +12 -0
  32. data/templates/_styles.html.erb +7 -0
  33. data/templates/action_mailer.rb +5 -0
  34. data/templates/application.html.erb +17 -0
  35. data/templates/application.scss +9 -0
  36. data/templates/browserslist +3 -0
  37. data/templates/bullet.rb +6 -0
  38. data/templates/bundler_audit.rake +12 -0
  39. data/templates/database.yml.erb +31 -0
  40. data/templates/database_cleaner.rb +21 -0
  41. data/templates/envs/.env.development.example +21 -0
  42. data/templates/envs/.env.production +24 -0
  43. data/templates/errors.rb +33 -0
  44. data/templates/factory_girl.rb +3 -0
  45. data/templates/flashes_helper.rb +5 -0
  46. data/templates/gitignore +14 -0
  47. data/templates/i18n.rb +3 -0
  48. data/templates/json_encoding.rb +2 -0
  49. data/templates/puma.rb +14 -0
  50. data/templates/rack_mini_profiler.rb +6 -0
  51. data/templates/rails_helper.rb +21 -0
  52. data/templates/rollbar.rb +57 -0
  53. data/templates/settings.yml.erb +0 -0
  54. data/templates/shoulda_matchers.rb +6 -0
  55. data/templates/smtp.rb +14 -0
  56. data/templates/spec_helper.rb +24 -0
  57. metadata +164 -0
@@ -0,0 +1,12 @@
1
+ <%= javascript_include_tag :application %>
2
+
3
+ <%= yield :javascript %>
4
+
5
+ <%= render "analytics" %>
6
+
7
+ <% if Rails.env.test? %>
8
+ <%= javascript_tag do %>
9
+ $.fx.off = true;
10
+ $.ajaxSetup({ async: false });
11
+ <% end %>
12
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% if Rails.env.test? %>
2
+ <style type="text/css">
3
+ * {
4
+ transition-property: none !important;
5
+ }
6
+ </style>
7
+ <% end %>
@@ -0,0 +1,5 @@
1
+ RSpec.configure do |config|
2
+ config.before(:each) do
3
+ ActionMailer::Base.deliveries.clear
4
+ end
5
+ end
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html lang="<%= I18n.locale %>">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="ROBOTS" content="NOODP" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
7
+ <title><%= title %></title>
8
+ <%= stylesheet_link_tag :application, media: "all" %>
9
+ <%= csrf_meta_tags %>
10
+ </head>
11
+ <body class="<%%= body_class %>">
12
+ <%= render "shared/flashes" -%>
13
+ <%= yield %>
14
+ <%= render "shared/javascript" %>
15
+ <%= render "shared/styles" %>
16
+ </body>
17
+ </html>
@@ -0,0 +1,9 @@
1
+ @charset "utf-8";
2
+
3
+ @import "normalize-rails";
4
+
5
+ @import "bourbon";
6
+ @import "neat";
7
+
8
+ @import "base/base";
9
+ @import "refills/flashes";
@@ -0,0 +1,3 @@
1
+ Last 2 versions
2
+ Explorer >= 11
3
+ Android >= 4.4
@@ -0,0 +1,6 @@
1
+ if defined? Bullet
2
+ Bullet.enable = true
3
+ Bullet.alert = true
4
+ Bullet.rails_logger = true
5
+ Bullet.rollbar = false
6
+ end
@@ -0,0 +1,12 @@
1
+ if Rails.env.development? || Rails.env.test?
2
+ require 'bundler/audit/cli'
3
+
4
+ namespace :bundler do
5
+ desc 'Updates the ruby-advisory-db and runs audit'
6
+ task :audit do
7
+ %w(update check).each do |command|
8
+ Bundler::Audit::CLI.start [command]
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,31 @@
1
+ settings: &settings
2
+ adapter: postgresql
3
+ encoding: utf8
4
+ min_messages: warning
5
+ timeout: <%%= Integer(ENV.fetch('DATABASE_TIMEOUT', 5000))%>
6
+ pool: <%%= Integer(ENV.fetch('DATABASE_POOL', 5))%>
7
+
8
+
9
+ development:
10
+ <<: *settings
11
+ reaping_frequency: <%%= Integer(ENV.fetch('DATABASE_REAPING_FREQUENCY', 10))%>
12
+ database: <%= app_name %>_development
13
+
14
+ test:
15
+ <<: *settings
16
+ reaping_frequency: <%%= Integer(ENV.fetch('DATABASE_REAPING_FREQUENCY', 10))%>
17
+ database: <%= app_name %>_test
18
+
19
+ staging:
20
+ <<: *settings
21
+ database: <%= app_name %>_staging
22
+
23
+
24
+ production:
25
+ <<: *settings
26
+ username:
27
+ password:
28
+ database: <%= app_name %>_production
29
+ pool: <%%= [Integer(ENV.fetch("PUMA_THREADS", 5)), Integer(ENV.fetch("DATABASE_POOL", 5))].max %>
30
+
31
+
@@ -0,0 +1,21 @@
1
+ RSpec.configure do |config|
2
+ config.before(:suite) do
3
+ DatabaseCleaner.clean_with(:deletion)
4
+ end
5
+
6
+ config.before(:each) do
7
+ DatabaseCleaner.strategy = :transaction
8
+ end
9
+
10
+ config.before(:each, js: true) do
11
+ DatabaseCleaner.strategy = :deletion
12
+ end
13
+
14
+ config.before(:each) do
15
+ DatabaseCleaner.start
16
+ end
17
+
18
+ config.after(:each) do
19
+ DatabaseCleaner.clean
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ RACK_ENV = development
2
+ RACK_MINI_PROFILER = 0
3
+ RACK_TIMEOUT = 5
4
+
5
+ DATABASE_REAPING_FREQUENCY = 10
6
+ DATABASE_TIMEOUT = 5000
7
+ DATABASE_POOL = 5
8
+
9
+ PUMA_WORKERS = 2
10
+ PUMA_THREADS = 2
11
+
12
+ SMTP_ADDRESS =
13
+ SMTP_DOMAIN =
14
+ SMTP_PASSWORD =
15
+ SMTP_USERNAME =
16
+
17
+ APPLICATION_HOST = localhost
18
+
19
+ ROLLBAR_TOCKEN =
20
+ ROLLBAR_ENV =
21
+
@@ -0,0 +1,24 @@
1
+ RACK_ENV = staging
2
+ RACK_MINI_PROFILER = 0
3
+ RACK_TIMEOUT = 5
4
+
5
+ # SECRET_KEY_BASE
6
+
7
+ DATABASE_TIMEOUT = 5000
8
+ DATABASE_POOL = 5
9
+ # DATABASE_USERNAME
10
+ # DATABASE_PASSWORD
11
+
12
+ PUMA_WORKERS = 2
13
+ PUMA_THREADS = 2
14
+
15
+ SMTP_ADDRESS =
16
+ SMTP_DOMAIN =
17
+ SMTP_PASSWORD =
18
+ SMTP_USERNAME =
19
+
20
+ APPLICATION_HOST =
21
+
22
+ ROLLBAR_TOCKEN =
23
+ ROLLBAR_ENV =
24
+
@@ -0,0 +1,33 @@
1
+ require 'net/http'
2
+ require 'net/smtp'
3
+
4
+ # begin
5
+ # some http call
6
+ # rescue *HTTP_ERRORS => error
7
+ # notify_hoptoad error
8
+ # end
9
+
10
+ HTTP_ERRORS = [
11
+ EOFError,
12
+ Errno::ECONNRESET,
13
+ Errno::EINVAL,
14
+ Net::HTTPBadResponse,
15
+ Net::HTTPHeaderSyntaxError,
16
+ Net::ProtocolError,
17
+ Timeout::Error,
18
+ ]
19
+
20
+ SMTP_SERVER_ERRORS = [
21
+ IOError,
22
+ Net::SMTPAuthenticationError,
23
+ Net::SMTPServerBusy,
24
+ Net::SMTPUnknownError,
25
+ Timeout::Error,
26
+ ]
27
+
28
+ SMTP_CLIENT_ERRORS = [
29
+ Net::SMTPFatalError,
30
+ Net::SMTPSyntaxError,
31
+ ]
32
+
33
+ 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
@@ -0,0 +1,14 @@
1
+ !.keep
2
+ *.DS_Store
3
+ *.swo
4
+ *.swp
5
+ /.bundle
6
+ /.env.production
7
+ /.env.development
8
+ /coverage/*
9
+ /db/*.sqlite3
10
+ /log/*
11
+ /public/system
12
+ /public/assets
13
+ /tags
14
+ /tmp/*
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,2 @@
1
+ ActiveSupport::JSON::Encoding.time_precision = 0
2
+
data/templates/puma.rb ADDED
@@ -0,0 +1,14 @@
1
+ workers Integer(ENV.fetch("PUMA_WORKERS", 2))
2
+ threads_count = Integer(ENV.fetch("PUMA_THREADS", 2))
3
+ threads(threads_count, threads_count)
4
+
5
+ preload_app!
6
+
7
+ rackup DefaultRackup
8
+ environment ENV.fetch('RACK_ENV', 'development')
9
+
10
+ on_worker_boot do
11
+ # Worker specific setup for Rails 4.1+
12
+ # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
13
+ # ActiveRecord::Base.establish_connection
14
+ end
@@ -0,0 +1,6 @@
1
+ if ENV.fetch("RACK_MINI_PROFILER", 0).to_i > 0
2
+ # Before uncomment read https://github.com/MiniProfiler/rack-mini-profiler#rails-and-manual-initialization
3
+ require 'rack_mini_profiler'
4
+
5
+ Rack::MiniProfilerRails.initialize!(Rails.application)
6
+ end
@@ -0,0 +1,21 @@
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
+ include Formulaic::Dsl if defined? Formulaic
12
+ end
13
+
14
+ RSpec.configure do |config|
15
+ config.include Features, type: :feature
16
+ config.infer_base_class_for_anonymous_controllers = false
17
+ config.infer_spec_type_from_file_location!
18
+ config.use_transactional_fixtures = false
19
+ end
20
+
21
+ ActiveRecord::Migration.maintain_test_schema!
@@ -0,0 +1,57 @@
1
+ Rollbar.configure do |config|
2
+ # Without configuration, Rollbar is enabled in all environments.
3
+ # To disable in specific environments, set config.enabled=false.
4
+
5
+ config.access_token = ENV['ROLLBAR_TOCKEN']
6
+
7
+ # Here we'll disable in 'test':
8
+ if Rails.env.test? || Rails.env.development?
9
+ config.enabled = false
10
+ end
11
+
12
+ # By default, Rollbar will try to call the `current_user` controller method
13
+ # to fetch the logged-in user object, and then call that object's `id`,
14
+ # `username`, and `email` methods to fetch those properties. To customize:
15
+ # config.person_method = "my_current_user"
16
+ # config.person_id_method = "my_id"
17
+ # config.person_username_method = "my_username"
18
+ # config.person_email_method = "my_email"
19
+
20
+ # If you want to attach custom data to all exception and message reports,
21
+ # provide a lambda like the following. It should return a hash.
22
+ # config.custom_data_method = lambda { {:some_key => "some_value" } }
23
+
24
+ # Add exception class names to the exception_level_filters hash to
25
+ # change the level that exception is reported at. Note that if an exception
26
+ # has already been reported and logged the level will need to be changed
27
+ # via the rollbar interface.
28
+ # Valid levels: 'critical', 'error', 'warning', 'info', 'debug', 'ignore'
29
+ # 'ignore' will cause the exception to not be reported at all.
30
+ # config.exception_level_filters.merge!('MyCriticalException' => 'critical')
31
+ #
32
+ # You can also specify a callable, which will be called with the exception instance.
33
+ # config.exception_level_filters.merge!('MyCriticalException' => lambda { |e| 'critical' })
34
+
35
+ # Enable asynchronous reporting (uses girl_friday or Threading if girl_friday
36
+ # is not installed)
37
+ # config.use_async = true
38
+ # Supply your own async handler:
39
+ # config.async_handler = Proc.new { |payload|
40
+ # Thread.new { Rollbar.process_from_async_handler(payload) }
41
+ # }
42
+
43
+ # Enable asynchronous reporting (using sucker_punch)
44
+ # config.use_sucker_punch
45
+
46
+ # Enable delayed reporting (using Sidekiq)
47
+ # config.use_sidekiq
48
+ # You can supply custom Sidekiq options:
49
+ # config.use_sidekiq 'queue' => 'default'
50
+
51
+ # If you run your staging application instance in production environment then
52
+ # you'll want to override the environment reported by `Rails.env` with an
53
+ # environment variable like this: `ROLLBAR_ENV=staging`. This is a recommended
54
+ # setup for Heroku. See:
55
+ # https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment
56
+ config.environment = ENV['ROLLBAR_ENV'] || Rails.env
57
+ end
File without changes
@@ -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
data/templates/smtp.rb ADDED
@@ -0,0 +1,14 @@
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
14
+
@@ -0,0 +1,24 @@
1
+ if ENV.fetch('COVERAGE', false)
2
+ require 'simplecov'
3
+ SimpleCov.start 'rails'
4
+ end
5
+
6
+ require 'webmock/rspec'
7
+
8
+ RSpec.configure do |config|
9
+ config.expect_with :rspec do |expectations|
10
+ expectations.syntax = :expect
11
+ end
12
+
13
+ config.mock_with :rspec do |mocks|
14
+ mocks.syntax = :expect
15
+ mocks.verify_partial_doubles = true
16
+ end
17
+
18
+ config.example_status_persistence_file_path = 'tmp/rspec_examples.txt'
19
+ config.order = :random
20
+
21
+ config.infer_spec_type_from_file_location!
22
+ end
23
+
24
+ WebMock.disable_net_connect!(allow_localhost: true)
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kazan
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Marat Khusnetdinov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 5.0.0
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: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
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.5'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.5'
69
+ description: Kazan creates rails project and setups predefined gems and tools.
70
+ email:
71
+ - marat@khusnetdinov.ru
72
+ executables:
73
+ - kazan
74
+ extensions: []
75
+ extra_rdoc_files:
76
+ - README.md
77
+ - LICENSE
78
+ files:
79
+ - ".gitignore"
80
+ - ".rspec"
81
+ - ".ruby-version"
82
+ - ".travis.yml"
83
+ - Gemfile
84
+ - LICENSE
85
+ - README.md
86
+ - Rakefile
87
+ - bin/console
88
+ - bin/kazan
89
+ - bin/setup
90
+ - kazan.gemspec
91
+ - lib/kazan.rb
92
+ - lib/kazan/actions.rb
93
+ - lib/kazan/app_builder.rb
94
+ - lib/kazan/generators/app_generator.rb
95
+ - lib/kazan/generators/clockwork_generator.rb
96
+ - lib/kazan/generators/sidekiq_generator.rb
97
+ - lib/kazan/version.rb
98
+ - spec/kazan_spec.rb
99
+ - spec/project_spec.rb
100
+ - spec/spec_helper.rb
101
+ - spec/support/hooks.rb
102
+ - spec/support/kazan_spec_helpers.rb
103
+ - templates/Gemfile.api.erb
104
+ - templates/Gemfile.erb
105
+ - templates/Procfile.erb
106
+ - templates/README.md.erb
107
+ - templates/_flashes.html.erb
108
+ - templates/_javascript.html.erb
109
+ - templates/_styles.html.erb
110
+ - templates/action_mailer.rb
111
+ - templates/application.html.erb
112
+ - templates/application.scss
113
+ - templates/browserslist
114
+ - templates/bullet.rb
115
+ - templates/bundler_audit.rake
116
+ - templates/database.yml.erb
117
+ - templates/database_cleaner.rb
118
+ - templates/envs/.env.development.example
119
+ - templates/envs/.env.production
120
+ - templates/errors.rb
121
+ - templates/factory_girl.rb
122
+ - templates/flashes_helper.rb
123
+ - templates/gitignore
124
+ - templates/i18n.rb
125
+ - templates/json_encoding.rb
126
+ - templates/puma.rb
127
+ - templates/rack_mini_profiler.rb
128
+ - templates/rails_helper.rb
129
+ - templates/rollbar.rb
130
+ - templates/settings.yml.erb
131
+ - templates/shoulda_matchers.rb
132
+ - templates/smtp.rb
133
+ - templates/spec_helper.rb
134
+ homepage: https://github.com/khusnetdinov/kazan
135
+ licenses:
136
+ - MIT
137
+ metadata: {}
138
+ post_install_message:
139
+ rdoc_options:
140
+ - "--charset=UTF-8"
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - '='
146
+ - !ruby/object:Gem::Version
147
+ version: 2.3.1
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ requirements: []
154
+ rubyforge_project:
155
+ rubygems_version: 2.5.1
156
+ signing_key:
157
+ specification_version: 4
158
+ summary: Kazan creates rails project and setups predefined gems and tools.
159
+ test_files:
160
+ - spec/kazan_spec.rb
161
+ - spec/project_spec.rb
162
+ - spec/spec_helper.rb
163
+ - spec/support/hooks.rb
164
+ - spec/support/kazan_spec_helpers.rb