myrails 6.0.0 → 7.0.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -30
  3. data/lib/myrails.rb +46 -122
  4. data/lib/myrails/modules/application_generator_actions.rb +61 -0
  5. data/lib/myrails/modules/application_generators.rb +80 -0
  6. data/lib/myrails/modules/assets.rb +28 -2
  7. data/lib/myrails/modules/bootstrap.rb +16 -12
  8. data/lib/myrails/modules/capistrano.rb +11 -6
  9. data/lib/myrails/modules/database_generator.rb +33 -0
  10. data/lib/myrails/modules/database_generator_actions.rb +18 -0
  11. data/lib/myrails/modules/devise.rb +11 -5
  12. data/lib/myrails/modules/dotenv.rb +30 -6
  13. data/lib/myrails/modules/draper.rb +29 -0
  14. data/lib/myrails/modules/engine_generator_actions.rb +117 -0
  15. data/lib/myrails/modules/engine_generators.rb +66 -0
  16. data/lib/myrails/modules/figaro.rb +18 -2
  17. data/lib/myrails/modules/gems.rb +7 -2
  18. data/lib/myrails/modules/heroku.rb +28 -9
  19. data/lib/myrails/modules/material.rb +23 -13
  20. data/lib/myrails/modules/pundit.rb +30 -6
  21. data/lib/myrails/modules/rails_generator_actions.rb +110 -0
  22. data/lib/myrails/modules/rails_generators.rb +49 -95
  23. data/lib/myrails/modules/rspec.rb +70 -40
  24. data/lib/myrails/modules/rspec_generator_actions.rb +56 -0
  25. data/lib/myrails/modules/rspec_generators.rb +36 -35
  26. data/lib/myrails/modules/ui.rb +24 -7
  27. data/lib/myrails/templates/rails/app/assets/javascripts/application.js +0 -4
  28. data/lib/myrails/templates/rails/app/controllers/controller.rb +6 -6
  29. data/lib/myrails/templates/rails/app/controllers/namespace_controller.rb +1 -1
  30. data/lib/myrails/templates/rails/app/decorators/application_decorator.rb +10 -0
  31. data/lib/myrails/templates/rails/app/decorators/decoration.rb +13 -0
  32. data/lib/myrails/templates/rails/app/helpers/application_helper.rb +0 -7
  33. data/lib/myrails/templates/rails/app/mailers/dev_mail_interceptor.rb +1 -1
  34. data/lib/myrails/templates/rails/app/models/model.rb +1 -1
  35. data/lib/myrails/templates/rails/app/models/namespace_model.rb +2 -2
  36. data/lib/myrails/templates/rails/app/policies/pundit.rb +2 -8
  37. data/lib/myrails/templates/rails/app/presenters/presenter.rb +5 -5
  38. data/lib/myrails/templates/rails/app/presenters/presenter_spec.rb +4 -4
  39. data/lib/myrails/templates/rails/app/views/layout/material/footer.html.haml +24 -0
  40. data/lib/myrails/templates/rails/config/application.example.yml +23 -23
  41. data/lib/myrails/templates/rails/config/initializers/sendgrid.rb +10 -0
  42. data/lib/myrails/templates/spec/controller.rb +37 -37
  43. data/lib/myrails/templates/spec/decorator_spec.rb +16 -0
  44. data/lib/myrails/templates/spec/factory.rb +1 -1
  45. data/lib/myrails/templates/spec/feature.rb +2 -2
  46. data/lib/myrails/templates/spec/helper.rb +1 -1
  47. data/lib/myrails/templates/spec/model.rb +1 -1
  48. data/lib/myrails/templates/spec/pundit.rb +5 -4
  49. data/lib/myrails/templates/spec/request.rb +27 -27
  50. data/lib/myrails/templates/spec/shared_example.rb +2 -2
  51. data/lib/myrails/templates/{rails/app/presenters/presenter_config.rb → spec/support/configs/decorator_presenter.rb} +0 -0
  52. data/lib/myrails/templates/ui/ui_controller.rb +1 -1
  53. data/lib/myrails/version.rb +1 -1
  54. data/myrails.gemspec +3 -3
  55. metadata +24 -15
  56. data/lib/myrails/modules/application.rb +0 -13
  57. data/lib/myrails/modules/database.rb +0 -15
  58. data/lib/myrails/modules/engine.rb +0 -107
  59. data/lib/myrails/modules/footnotes.rb +0 -19
  60. data/lib/myrails/templates/rails/app/mailers/sendgrid.rb +0 -8
@@ -1,5 +1,5 @@
1
- shared_examples '<%= options[:text] %>' do
2
- context '<%= options[:text] %>' do
1
+ shared_examples '<%= @description %>' do
2
+ context '<%= @context %>' do
3
3
  before do
4
4
  action
5
5
  end
@@ -1,7 +1,7 @@
1
1
  # Handles HTTP actions for UI
2
2
  class UiController < ApplicationController
3
3
  # Before filter to check if application is running in development
4
- before_action do
4
+ before_action do
5
5
  redirect_to :root if Rails.env.production?
6
6
  end
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module Myrails
2
- VERSION = "6.0.0"
2
+ VERSION = "7.0.0"
3
3
  end
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.require_paths = ["lib"]
31
31
 
32
32
  spec.add_development_dependency "bundler", "~> 1.15"
33
- spec.add_development_dependency "rake", "~> 12.0"
34
- spec.add_development_dependency "rspec", "~> 3.0"
35
- spec.add_dependency 'activesupport', '~> 5.1.3'
33
+ spec.add_development_dependency "rake", "~> 12.3.1"
34
+ spec.add_development_dependency "rspec", "~> 3.8.0"
35
+ spec.add_dependency 'activesupport', '~> 5.2.1'
36
36
  spec.add_dependency 'thor', '~> 0.20.0'
37
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myrails
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-06 00:00:00.000000000 Z
11
+ date: 2018-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,42 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '12.0'
33
+ version: 12.3.1
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '12.0'
40
+ version: 12.3.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: 3.8.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: 3.8.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 5.1.3
61
+ version: 5.2.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 5.1.3
68
+ version: 5.2.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thor
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -97,23 +97,28 @@ files:
97
97
  - bin/myrails
98
98
  - bin/setup
99
99
  - lib/myrails.rb
100
- - lib/myrails/modules/application.rb
100
+ - lib/myrails/modules/application_generator_actions.rb
101
+ - lib/myrails/modules/application_generators.rb
101
102
  - lib/myrails/modules/assets.rb
102
103
  - lib/myrails/modules/bootstrap.rb
103
104
  - lib/myrails/modules/capistrano.rb
104
- - lib/myrails/modules/database.rb
105
+ - lib/myrails/modules/database_generator.rb
106
+ - lib/myrails/modules/database_generator_actions.rb
105
107
  - lib/myrails/modules/devise.rb
106
108
  - lib/myrails/modules/dotenv.rb
107
- - lib/myrails/modules/engine.rb
109
+ - lib/myrails/modules/draper.rb
110
+ - lib/myrails/modules/engine_generator_actions.rb
111
+ - lib/myrails/modules/engine_generators.rb
108
112
  - lib/myrails/modules/figaro.rb
109
- - lib/myrails/modules/footnotes.rb
110
113
  - lib/myrails/modules/gems.locked
111
114
  - lib/myrails/modules/gems.rb
112
115
  - lib/myrails/modules/heroku.rb
113
116
  - lib/myrails/modules/material.rb
114
117
  - lib/myrails/modules/pundit.rb
118
+ - lib/myrails/modules/rails_generator_actions.rb
115
119
  - lib/myrails/modules/rails_generators.rb
116
120
  - lib/myrails/modules/rspec.rb
121
+ - lib/myrails/modules/rspec_generator_actions.rb
117
122
  - lib/myrails/modules/rspec_generators.rb
118
123
  - lib/myrails/modules/ui.rb
119
124
  - lib/myrails/templates/capistrano/config/deploy/templates/maintenance/index.html
@@ -152,15 +157,15 @@ files:
152
157
  - lib/myrails/templates/rails/app/assets/stylesheets/will_paginate.scss
153
158
  - lib/myrails/templates/rails/app/controllers/controller.rb
154
159
  - lib/myrails/templates/rails/app/controllers/namespace_controller.rb
160
+ - lib/myrails/templates/rails/app/decorators/application_decorator.rb
161
+ - lib/myrails/templates/rails/app/decorators/decoration.rb
155
162
  - lib/myrails/templates/rails/app/helpers/application_helper.rb
156
163
  - lib/myrails/templates/rails/app/mailers/dev_mail_interceptor.rb
157
- - lib/myrails/templates/rails/app/mailers/sendgrid.rb
158
164
  - lib/myrails/templates/rails/app/models/model.rb
159
165
  - lib/myrails/templates/rails/app/models/namespace_model.rb
160
166
  - lib/myrails/templates/rails/app/policies/pundit.rb
161
167
  - lib/myrails/templates/rails/app/presenters/base.rb
162
168
  - lib/myrails/templates/rails/app/presenters/presenter.rb
163
- - lib/myrails/templates/rails/app/presenters/presenter_config.rb
164
169
  - lib/myrails/templates/rails/app/presenters/presenter_spec.rb
165
170
  - lib/myrails/templates/rails/app/views/layout/bootstrap/_error_messages.html.haml
166
171
  - lib/myrails/templates/rails/app/views/layout/bootstrap/_footer.html.haml
@@ -184,11 +189,14 @@ files:
184
189
  - lib/myrails/templates/rails/app/views/layout/material/_simple_pagination.html.haml
185
190
  - lib/myrails/templates/rails/app/views/layout/material/_success_message.html.haml
186
191
  - lib/myrails/templates/rails/app/views/layout/material/application.html.haml
192
+ - lib/myrails/templates/rails/app/views/layout/material/footer.html.haml
187
193
  - lib/myrails/templates/rails/app/views/layout/material/mailer.html.haml
188
194
  - lib/myrails/templates/rails/app/views/layout/material/mailer.text.haml
189
195
  - lib/myrails/templates/rails/config/application.example.yml
196
+ - lib/myrails/templates/rails/config/initializers/sendgrid.rb
190
197
  - lib/myrails/templates/rails/env.config
191
198
  - lib/myrails/templates/spec/controller.rb
199
+ - lib/myrails/templates/spec/decorator_spec.rb
192
200
  - lib/myrails/templates/spec/factory.rb
193
201
  - lib/myrails/templates/spec/feature.rb
194
202
  - lib/myrails/templates/spec/files.rb
@@ -199,6 +207,7 @@ files:
199
207
  - lib/myrails/templates/spec/request_shared_example.rb
200
208
  - lib/myrails/templates/spec/shared_example.rb
201
209
  - lib/myrails/templates/spec/support/configs/database_cleaner.rb
210
+ - lib/myrails/templates/spec/support/configs/decorator_presenter.rb
202
211
  - lib/myrails/templates/spec/support/configs/devise.rb
203
212
  - lib/myrails/templates/spec/support/configs/factory_bot.rb
204
213
  - lib/myrails/templates/spec/support/configs/mailer.rb
@@ -236,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
245
  version: '0'
237
246
  requirements: []
238
247
  rubyforge_project:
239
- rubygems_version: 2.7.6
248
+ rubygems_version: 2.7.7
240
249
  signing_key:
241
250
  specification_version: 4
242
251
  summary: A thor backed gem for generating rails related files based on my style of
@@ -1,13 +0,0 @@
1
- module Install
2
- module ApplicationHelper
3
- def self.included(thor)
4
- thor.class_eval do
5
-
6
- def install_application_helper
7
- copy_file 'rails/app/helpers/application_helper.rb', 'app/helpers/application_helper.rb'
8
- end
9
-
10
- end
11
- end
12
- end
13
- end
@@ -1,15 +0,0 @@
1
- module Rails
2
- module Database
3
- def self.included(thor)
4
- thor.class_eval do
5
-
6
- def mysql_switch
7
- gsub_file 'Gemfile', "gem 'sqlite3'", "gem 'mysql2', '>= 0.3.13', '< 0.5'"
8
- run 'bundle install'
9
- copy_file 'db/mysql_database.yml', 'config/database.yml'
10
- end
11
-
12
- end
13
- end
14
- end
15
- end
@@ -1,107 +0,0 @@
1
- module Rails
2
- module Engines
3
- def self.included(thor)
4
- thor.class_eval do
5
-
6
- desc 'engine(full | mountable)', 'Generate a full or mountable engine. default: mountable'
7
- option :name, required: true
8
- def engine(etype='mountable')
9
- run "rails plugin new #{options[:name]} --dummy-path=spec/dummy --skip-test-unit --#{etype}"
10
- end
11
-
12
- def add_gemspec_info
13
- gsub_file "#{options[:name]}.gemspec", 's.homepage = "TODO"', 's.homepage = "http://TBD.com"'
14
- gsub_file "#{options[:name]}.gemspec", "s.summary = \"TODO: Summary of #{options[:name].camelize}.\"", "s.summary = \"Summary of #{options[:name].camelize}.\""
15
- gsub_file "#{options[:name]}.gemspec", "s.description = \"TODO: Description of #{options[:name].camelize}.\"", "s.description = \"Description of #{options[:name].camelize}.\""
16
-
17
- inject_into_file "#{options[:name]}.gemspec", after: "s.license = \"MIT\"\n" do <<-CODE
18
- s.test_files = Dir["spec/**/*"]
19
- CODE
20
- end
21
- end
22
-
23
- def add_engine_gems
24
- inject_into_file "#{options[:name]}.gemspec", after: "s.add_development_dependency \"sqlite3\"\n" do <<-CODE
25
- s.add_development_dependency 'rspec-rails'
26
- s.add_development_dependency 'capybara'
27
- s.add_development_dependency 'factory_bot_rails'
28
- s.add_development_dependency "faker"
29
- s.add_development_dependency "byebug"
30
- s.add_development_dependency 'rails-controller-testing'
31
- s.add_development_dependency 'pundit-matchers'
32
- s.add_development_dependency "simplecov"
33
- s.add_development_dependency "shoulda-matchers"
34
- s.add_development_dependency "database_cleaner"
35
- s.add_dependency 'pundit'
36
- s.add_dependency 'bootstrap-sass', '~> 3.3.6'
37
- s.add_dependency 'autoprefixer-rails'
38
- s.add_dependency "haml-rails"
39
- s.add_dependency "font-awesome-rails"
40
- s.add_dependency 'record_tag_helper'
41
- CODE
42
- end
43
-
44
- run 'bundle'
45
- end
46
-
47
- def copy_rspec_files
48
- Dir["#{__dir__}/myrails/templates/spec/**/*"].each do |file|
49
- if file.include? '/support/'
50
- copy_file file, "#{file.gsub(__dir__+'/myrails/templates/', '')}" unless File.directory? file
51
- end
52
- end
53
- end
54
-
55
- def configure_rake_file
56
- copy_file 'engines/rakefile', 'Rakefile'
57
- end
58
-
59
- def configure_rspec
60
- run 'rails g rspec:install'
61
-
62
- gsub_file 'spec/rails_helper.rb', "# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }", "Dir[File.join(__dir__, 'support', '**', '*.rb')].each { |f| require f }"
63
-
64
- gsub_file 'spec/rails_helper.rb', "require File.expand_path('../../config/environment', __FILE__)", "require_relative 'dummy/config/environment'"
65
-
66
- inject_into_file 'spec/rails_helper.rb', after: "require 'rspec/rails'\n" do <<-CODE
67
- require 'shoulda/matchers'
68
- require 'factory_bot'
69
- require 'database_cleaner'
70
- CODE
71
- end
72
-
73
- inject_into_file 'spec/rails_helper.rb', after: "RSpec.configure do |config|\n" do <<-CODE
74
- config.mock_with :rspec
75
- config.infer_base_class_for_anonymous_controllers = false
76
- config.order = "random"
77
- CODE
78
- end
79
- end
80
-
81
- def configure_engine
82
- inject_into_file "lib/#{options[:name]}/engine.rb", after: "class Engine < ::Rails::Engine\n" do <<-CODE
83
- config.generators do |g|
84
- g.test_framework :rspec, :fixture => false
85
- g.fixture_replacement :factory_bot, :dir => 'spec/factories'
86
- g.assets false
87
- g.helper false
88
- end
89
- CODE
90
- end
91
- end
92
-
93
- desc 'engine_setup', 'Configure rails engine for development with RSpec, Capybara and FactoryBot'
94
- option :name, required: true
95
- def engine_setup
96
- add_gemspec_info
97
- add_engine_gems
98
- configure_rake_file
99
- configure_rspec
100
- copy_rspec_files
101
- configure_engine
102
- end
103
-
104
- end
105
- end
106
- end
107
- end
@@ -1,19 +0,0 @@
1
- module Install
2
- module Footnotes
3
- def self.included(thor)
4
- thor.class_eval do
5
-
6
- desc 'install_footnotes', 'Install rails-footnotes and run its generator'
7
- def install_footnotes
8
- insert_into_file 'Gemfile', after: "gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]\n" do <<-CODE
9
- gem 'rails-footnotes'
10
- CODE
11
- end
12
- run 'bundle install'
13
- run 'rails generate rails_footnotes:install'
14
- end
15
-
16
- end
17
- end
18
- end
19
- end
@@ -1,8 +0,0 @@
1
- config.action_mailer.delivery_method = :smtp
2
- config.action_mailer.smtp_settings = { address: 'smtp.sendgrid.net',
3
- port: 587,
4
- domain: 'yourdomain.com',
5
- user_name: 'someuser',
6
- password: 'somepassword',
7
- authentication: 'plain',
8
- enable_starttls_auto: true }