active_generator 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.reek +6 -0
  3. data/.rubocop.yml +12 -8
  4. data/active_generator.gemspec +0 -1
  5. data/lib/active_generator/base.rb +23 -25
  6. data/lib/active_generator/settings.rb +11 -13
  7. data/lib/active_generator/version.rb +1 -1
  8. data/lib/generators/active_generator/install/install_generator.rb +5 -7
  9. data/lib/generators/environment/environment_generator.rb +6 -2
  10. data/lib/generators/locale/api/api_generator.rb +10 -10
  11. data/lib/generators/locale/controller/controller_generator.rb +10 -11
  12. data/lib/generators/locale/helper/helper_generator.rb +10 -10
  13. data/lib/generators/locale/job/job_generator.rb +10 -10
  14. data/lib/generators/locale/mailer/mailer_generator.rb +10 -10
  15. data/lib/generators/locale/model/model_generator.rb +10 -10
  16. data/lib/generators/locale/service/service_generator.rb +10 -10
  17. data/lib/generators/locale/task/task_generator.rb +10 -10
  18. data/lib/generators/locale/uploader/uploader_generator.rb +10 -10
  19. data/lib/generators/locale/view/view_generator.rb +10 -10
  20. data/lib/generators/rails/base.rb +5 -7
  21. data/lib/generators/rails/controller_generator.rb +20 -28
  22. data/lib/generators/rails/helper_generator.rb +10 -14
  23. data/lib/generators/rails/job_generator.rb +10 -14
  24. data/lib/generators/rails/mailer_generator.rb +20 -28
  25. data/lib/generators/rails/model_generator.rb +20 -20
  26. data/lib/generators/rails/scaffold_generator.rb +10 -14
  27. data/lib/generators/rails/task_generator.rb +5 -8
  28. data/lib/generators/service/service_generator.rb +3 -1
  29. data/lib/generators/view/view_generator.rb +3 -1
  30. metadata +2 -17
  31. data/.flayignore +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17ac7910eb05461115ea5abc7d5946fd6120820c
4
- data.tar.gz: 4d7b548e5b6d5bcb77b26f7646a291faa266d0b4
3
+ metadata.gz: e03c2c9f0ff2757a54adbac0597bafd164c81576
4
+ data.tar.gz: a8bba9b3547e1e52c27021e0eb13aad63a82bd5c
5
5
  SHA512:
6
- metadata.gz: 42a3283c36187908a4dc969315d28186c4be067589cb30291e89fe6667c8cc814d9a704e770c9a46b699e5a46f9c0a56b70225ea8f083d61164a37a9808fc0d0
7
- data.tar.gz: 535acb7bcf9452307ad84992f749e81ef413c779bdcfaaada65ac9e1f596a9660958888d30d62caa980510e72106b4a2cf9857618caa99066213f8d0cbc72170
6
+ metadata.gz: 4f8fcaf18b7239c97a6a310950858533237c2c16a0b2004902c5c7fc6d56a366cbe92a58c73c0117e36bcbeec2f2e2a7e40f6883dbe870ff1c0b268bdc07034a
7
+ data.tar.gz: 0ff3a24b029c62fc05950d794aa8d16f0f5726b8ad82a10138b33d48da870ea783a2057419adc3478461c0464ae07102c73d442ed62abda74ecef1d1012a07c1
data/.reek CHANGED
@@ -4,6 +4,12 @@ exclude_paths:
4
4
  - lib/generators/service/templates
5
5
  Attribute:
6
6
  enabled: false
7
+ BooleanParameter:
8
+ enabled: false
9
+ ControlParameter:
10
+ enabled: false
11
+ FeatureEnvy:
12
+ enabled: false
7
13
  IrresponsibleModule:
8
14
  enabled: false
9
15
  NilCheck:
data/.rubocop.yml CHANGED
@@ -3,20 +3,20 @@ AllCops:
3
3
  DisplayStyleGuide: true
4
4
  TargetRubyVersion: 2.3
5
5
  Exclude:
6
- - 'lib/generators/environment/templates/*'
7
- - 'lib/generators/initializer/templates/*'
8
- - 'lib/generators/service/templates/*'
9
- - 'spec/support/**/*'
6
+ - 'lib/**/**/templates/*'
7
+ - 'spec/**/**/*'
10
8
  LineLength:
11
- Max: 120
12
- Rails/Delegate:
13
- Enabled: false
14
- Rails/Output:
9
+ Max: 100
10
+ Metrics/ModuleLength:
15
11
  Enabled: false
16
12
  Style/Alias:
17
13
  EnforcedStyle: prefer_alias_method
18
14
  Style/BracesAroundHashParameters:
19
15
  Enabled: false
16
+ Style/ClassAndModuleChildren:
17
+ EnforcedStyle: compact
18
+ Exclude:
19
+ - 'lib/generators/locale/base.rb'
20
20
  Style/ClosingParenthesisIndentation:
21
21
  Enabled: false
22
22
  Style/Documentation:
@@ -27,11 +27,15 @@ Style/EmptyLinesAroundClassBody:
27
27
  Enabled: false
28
28
  Style/EmptyLinesAroundModuleBody:
29
29
  Enabled: false
30
+ Style/HashSyntax:
31
+ Enabled: false
30
32
  Style/FirstParameterIndentation:
31
33
  Enabled: false
32
34
  Style/FrozenStringLiteralComment:
33
35
  Enabled: false
34
36
  Style/MultilineMethodCallIndentation:
35
37
  EnforcedStyle: aligned
38
+ Style/NumericLiterals:
39
+ Enabled: false
36
40
  Style/RescueModifier:
37
41
  Enabled: false
@@ -27,7 +27,6 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'rspec'
28
28
  spec.add_development_dependency 'generator_spec'
29
29
  spec.add_development_dependency 'fasterer'
30
- spec.add_development_dependency 'flay'
31
30
  spec.add_development_dependency 'reek'
32
31
  spec.add_development_dependency 'rubocop'
33
32
  end
@@ -1,35 +1,33 @@
1
- module ActiveGenerator
2
- module Base
1
+ module ActiveGenerator::Base
3
2
 
4
- private
3
+ private
5
4
 
6
- def file_name_table
7
- file_name.underscore
8
- end
9
-
10
- def file_name_human
11
- file_name_table.tr('_', ' ').downcase.capitalize
12
- end
5
+ def file_name_table
6
+ file_name.underscore
7
+ end
13
8
 
14
- def namespace
15
- name.downcase.split('/')[0...-1]
16
- end
9
+ def file_name_human
10
+ file_name_table.tr('_', ' ').downcase.capitalize
11
+ end
17
12
 
18
- def namespaced?
19
- name.include?('/')
20
- end
13
+ def namespace
14
+ name.downcase.split('/')[0...-1]
15
+ end
21
16
 
22
- def namespace_human
23
- namespace.join(' ').tr('_', ' ').downcase.capitalize
24
- end
17
+ def namespaced?
18
+ name.include?('/')
19
+ end
25
20
 
26
- def namespace_table
27
- namespace.join('_')
28
- end
21
+ def namespace_human
22
+ namespace.join(' ').tr('_', ' ').downcase.capitalize
23
+ end
29
24
 
30
- def namespace_path
31
- namespace.join('/')
32
- end
25
+ def namespace_table
26
+ namespace.join('_')
27
+ end
33
28
 
29
+ def namespace_path
30
+ namespace.join('/')
34
31
  end
32
+
35
33
  end
@@ -1,18 +1,16 @@
1
1
  require 'dry-configurable'
2
2
 
3
- module ActiveGenerator
4
- class Settings
5
- extend Dry::Configurable
3
+ class ActiveGenerator::Settings
4
+ extend Dry::Configurable
6
5
 
7
- setting :autoload_controller_generator_locale, true
8
- setting :autoload_helper_generator_locale, true
9
- setting :autoload_job_generator_locale, true
10
- setting :autoload_mailer_generator_locale, true
11
- setting :autoload_model_generator_locale, true
12
- setting :autoload_service_generator_locale, true
13
- setting :autoload_task_generator_locale, true
14
- setting :autoload_view_generator_locale, true
15
- setting :test_framework, 'test_unit'
6
+ setting :autoload_controller_generator_locale, true
7
+ setting :autoload_helper_generator_locale, true
8
+ setting :autoload_job_generator_locale, true
9
+ setting :autoload_mailer_generator_locale, true
10
+ setting :autoload_model_generator_locale, true
11
+ setting :autoload_service_generator_locale, true
12
+ setting :autoload_task_generator_locale, true
13
+ setting :autoload_view_generator_locale, true
14
+ setting :test_framework, 'test_unit'
16
15
 
17
- end
18
16
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveGenerator
2
- VERSION = '4.0.0'.freeze
2
+ VERSION = '4.0.1'.freeze
3
3
  end
@@ -1,10 +1,8 @@
1
- module ActiveGenerator
2
- class InstallGenerator < Rails::Generators::Base
3
- source_root File.expand_path('../templates', __FILE__)
4
-
5
- def copy_initializer_file
6
- copy_file('install.rb', 'config/initializers/active_generator.rb')
7
- end
1
+ class ActiveGenerator::InstallGenerator < Rails::Generators::Base
2
+ source_root File.expand_path('../templates', __FILE__)
8
3
 
4
+ def copy_initializer_file
5
+ copy_file('install.rb', 'config/initializers/active_generator.rb')
9
6
  end
7
+
10
8
  end
@@ -1,6 +1,7 @@
1
1
  class EnvironmentGenerator < Rails::Generators::NamedBase
2
2
  source_root File.expand_path('../templates', __FILE__)
3
- argument :environment, type: :string, required: false, default: nil, desc: 'The environment template to copy'
3
+ argument :environment, type: :string, required: false, default: nil,
4
+ desc: 'The environment template to copy'
4
5
 
5
6
  def create_environment_file
6
7
  assert_valid_environment!
@@ -19,7 +20,10 @@ class EnvironmentGenerator < Rails::Generators::NamedBase
19
20
  unless environment.nil?
20
21
  unless ENVIRONMENTS.include?(environment)
21
22
  raise ArgumentError,
22
- "Unknown environment: #{environment.inspect}. Valid options: #{ENVIRONMENTS.map(&:inspect).join(', ')}"
23
+ [
24
+ "Unknown environment: #{environment.inspect}.",
25
+ "Valid options: #{ENVIRONMENTS.map(&:inspect).join(', ')}"
26
+ ].join(' ')
23
27
  end
24
28
  end
25
29
  end
@@ -1,18 +1,18 @@
1
1
  require 'active_generator/base'
2
2
  require 'generators/locale/base'
3
3
 
4
- module Locale
5
- class ApiGenerator < Rails::Generators::NamedBase
6
- include ActiveGenerator::Base
7
- include Locale::Base
4
+ class Locale::ApiGenerator < Rails::Generators::NamedBase
5
+ include ActiveGenerator::Base
6
+ include Locale::Base
8
7
 
9
- source_root File.expand_path('../templates', __FILE__)
10
- argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
8
+ source_root File.expand_path('../templates', __FILE__)
9
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
10
 
12
- def create_api_file
13
- assert_valid_language!
14
- template('api.yml', File.join("config/locales/#{language}/apis", namespace_path, "#{file_name}.yml"))
15
- end
11
+ def create_api_file
12
+ assert_valid_language!
13
+ path = File.join("config/locales/#{language}/apis", namespace_path, "#{file_name}.yml")
16
14
 
15
+ template('api.yml', path)
17
16
  end
17
+
18
18
  end
@@ -1,19 +1,18 @@
1
1
  require 'active_generator/base'
2
2
  require 'generators/locale/base'
3
3
 
4
- module Locale
5
- class ControllerGenerator < Rails::Generators::NamedBase
6
- include ActiveGenerator::Base
7
- include Locale::Base
4
+ class Locale::ControllerGenerator < Rails::Generators::NamedBase
5
+ include ActiveGenerator::Base
6
+ include Locale::Base
8
7
 
9
- source_root File.expand_path('../templates', __FILE__)
10
- argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
8
+ source_root File.expand_path('../templates', __FILE__)
9
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
10
 
12
- def create_controller_file
13
- assert_valid_language!
14
- template('controller.yml',
15
- File.join("config/locales/#{language}/controllers", namespace_path, "#{file_name}.yml"))
16
- end
11
+ def create_controller_file
12
+ assert_valid_language!
13
+ path = File.join("config/locales/#{language}/controllers", namespace_path, "#{file_name}.yml")
17
14
 
15
+ template('controller.yml', path)
18
16
  end
17
+
19
18
  end
@@ -1,18 +1,18 @@
1
1
  require 'active_generator/base'
2
2
  require 'generators/locale/base'
3
3
 
4
- module Locale
5
- class HelperGenerator < Rails::Generators::NamedBase
6
- include ActiveGenerator::Base
7
- include Locale::Base
4
+ class Locale::HelperGenerator < Rails::Generators::NamedBase
5
+ include ActiveGenerator::Base
6
+ include Locale::Base
8
7
 
9
- source_root File.expand_path('../templates', __FILE__)
10
- argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
8
+ source_root File.expand_path('../templates', __FILE__)
9
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
10
 
12
- def create_helper_file
13
- assert_valid_language!
14
- template('helper.yml', File.join("config/locales/#{language}/helpers", namespace_path, "#{file_name}.yml"))
15
- end
11
+ def create_helper_file
12
+ assert_valid_language!
13
+ path = File.join("config/locales/#{language}/helpers", namespace_path, "#{file_name}.yml")
16
14
 
15
+ template('helper.yml', path)
17
16
  end
17
+
18
18
  end
@@ -1,18 +1,18 @@
1
1
  require 'active_generator/base'
2
2
  require 'generators/locale/base'
3
3
 
4
- module Locale
5
- class JobGenerator < Rails::Generators::NamedBase
6
- include ActiveGenerator::Base
7
- include Locale::Base
4
+ class Locale::JobGenerator < Rails::Generators::NamedBase
5
+ include ActiveGenerator::Base
6
+ include Locale::Base
8
7
 
9
- source_root File.expand_path('../templates', __FILE__)
10
- argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
8
+ source_root File.expand_path('../templates', __FILE__)
9
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
10
 
12
- def create_job_file
13
- assert_valid_language!
14
- template('job.yml', File.join("config/locales/#{language}/jobs", namespace_path, "#{file_name}.yml"))
15
- end
11
+ def create_job_file
12
+ assert_valid_language!
13
+ path = File.join("config/locales/#{language}/jobs", namespace_path, "#{file_name}.yml")
16
14
 
15
+ template('job.yml', path)
17
16
  end
17
+
18
18
  end
@@ -1,18 +1,18 @@
1
1
  require 'active_generator/base'
2
2
  require 'generators/locale/base'
3
3
 
4
- module Locale
5
- class MailerGenerator < Rails::Generators::NamedBase
6
- include ActiveGenerator::Base
7
- include Locale::Base
4
+ class Locale::MailerGenerator < Rails::Generators::NamedBase
5
+ include ActiveGenerator::Base
6
+ include Locale::Base
8
7
 
9
- source_root File.expand_path('../templates', __FILE__)
10
- argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
8
+ source_root File.expand_path('../templates', __FILE__)
9
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
10
 
12
- def create_mailer_file
13
- assert_valid_language!
14
- template('mailer.yml', File.join("config/locales/#{language}/mailers", namespace_path, "#{file_name}.yml"))
15
- end
11
+ def create_mailer_file
12
+ assert_valid_language!
13
+ path = File.join("config/locales/#{language}/mailers", namespace_path, "#{file_name}.yml")
16
14
 
15
+ template('mailer.yml', path)
17
16
  end
17
+
18
18
  end
@@ -1,18 +1,18 @@
1
1
  require 'active_generator/base'
2
2
  require 'generators/locale/base'
3
3
 
4
- module Locale
5
- class ModelGenerator < Rails::Generators::NamedBase
6
- include ActiveGenerator::Base
7
- include Locale::Base
4
+ class Locale::ModelGenerator < Rails::Generators::NamedBase
5
+ include ActiveGenerator::Base
6
+ include Locale::Base
8
7
 
9
- source_root File.expand_path('../templates', __FILE__)
10
- argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
8
+ source_root File.expand_path('../templates', __FILE__)
9
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
10
 
12
- def create_model_file
13
- assert_valid_language!
14
- template('model.yml', File.join("config/locales/#{language}/models", namespace_path, "#{file_name}.yml"))
15
- end
11
+ def create_model_file
12
+ assert_valid_language!
13
+ path = File.join("config/locales/#{language}/models", namespace_path, "#{file_name}.yml")
16
14
 
15
+ template('model.yml', path)
17
16
  end
17
+
18
18
  end
@@ -1,18 +1,18 @@
1
1
  require 'active_generator/base'
2
2
  require 'generators/locale/base'
3
3
 
4
- module Locale
5
- class ServiceGenerator < Rails::Generators::NamedBase
6
- include ActiveGenerator::Base
7
- include Locale::Base
4
+ class Locale::ServiceGenerator < Rails::Generators::NamedBase
5
+ include ActiveGenerator::Base
6
+ include Locale::Base
8
7
 
9
- source_root File.expand_path('../templates', __FILE__)
10
- argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
8
+ source_root File.expand_path('../templates', __FILE__)
9
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
10
 
12
- def create_service_file
13
- assert_valid_language!
14
- template('service.yml', File.join("config/locales/#{language}/services", namespace_path, "#{file_name}.yml"))
15
- end
11
+ def create_service_file
12
+ assert_valid_language!
13
+ path = File.join("config/locales/#{language}/services", namespace_path, "#{file_name}.yml")
16
14
 
15
+ template('service.yml', path)
17
16
  end
17
+
18
18
  end
@@ -1,18 +1,18 @@
1
1
  require 'active_generator/base'
2
2
  require 'generators/locale/base'
3
3
 
4
- module Locale
5
- class TaskGenerator < Rails::Generators::NamedBase
6
- include ActiveGenerator::Base
7
- include Locale::Base
4
+ class Locale::TaskGenerator < Rails::Generators::NamedBase
5
+ include ActiveGenerator::Base
6
+ include Locale::Base
8
7
 
9
- source_root File.expand_path('../templates', __FILE__)
10
- argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
8
+ source_root File.expand_path('../templates', __FILE__)
9
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
10
 
12
- def copy_task_file
13
- assert_valid_language!
14
- template('task.yml', File.join("config/locales/#{language}/tasks", namespace_path, "#{file_name}.yml"))
15
- end
11
+ def copy_task_file
12
+ assert_valid_language!
13
+ path = File.join("config/locales/#{language}/tasks", namespace_path, "#{file_name}.yml")
16
14
 
15
+ template('task.yml', path)
17
16
  end
17
+
18
18
  end
@@ -1,18 +1,18 @@
1
1
  require 'active_generator/base'
2
2
  require 'generators/locale/base'
3
3
 
4
- module Locale
5
- class UploaderGenerator < Rails::Generators::NamedBase
6
- include ActiveGenerator::Base
7
- include Locale::Base
4
+ class Locale::UploaderGenerator < Rails::Generators::NamedBase
5
+ include ActiveGenerator::Base
6
+ include Locale::Base
8
7
 
9
- source_root File.expand_path('../templates', __FILE__)
10
- argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
8
+ source_root File.expand_path('../templates', __FILE__)
9
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
10
 
12
- def create_uploader_file
13
- assert_valid_language!
14
- template('uploader.yml', File.join("config/locales/#{language}/uploaders", namespace_path, "#{file_name}.yml"))
15
- end
11
+ def create_uploader_file
12
+ assert_valid_language!
13
+ path = File.join("config/locales/#{language}/uploaders", namespace_path, "#{file_name}.yml")
16
14
 
15
+ template('uploader.yml', path)
17
16
  end
17
+
18
18
  end
@@ -1,18 +1,18 @@
1
1
  require 'active_generator/base'
2
2
  require 'generators/locale/base'
3
3
 
4
- module Locale
5
- class ViewGenerator < Rails::Generators::NamedBase
6
- include ActiveGenerator::Base
7
- include Locale::Base
4
+ class Locale::ViewGenerator < Rails::Generators::NamedBase
5
+ include ActiveGenerator::Base
6
+ include Locale::Base
8
7
 
9
- source_root File.expand_path('../templates', __FILE__)
10
- argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
8
+ source_root File.expand_path('../templates', __FILE__)
9
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
10
 
12
- def create_view_file
13
- assert_valid_language!
14
- template('view.yml', File.join("config/locales/#{language}/views", namespace_path, "#{file_name}.yml"))
15
- end
11
+ def create_view_file
12
+ assert_valid_language!
13
+ path = File.join("config/locales/#{language}/views", namespace_path, "#{file_name}.yml")
16
14
 
15
+ template('view.yml', path)
17
16
  end
17
+
18
18
  end
@@ -1,11 +1,9 @@
1
- module Rails
2
- module Base
1
+ module Rails::Base
3
2
 
4
- private
5
-
6
- def configuration
7
- ActiveGenerator::Settings.config
8
- end
3
+ private
9
4
 
5
+ def configuration
6
+ ActiveGenerator::Settings.config
10
7
  end
8
+
11
9
  end
@@ -2,42 +2,34 @@ require 'rails/generators/erb/controller/controller_generator'
2
2
  require 'rails/generators/rails/controller/controller_generator'
3
3
  require 'generators/rails/base'
4
4
 
5
- module Erb
6
- module Generators
7
- class ControllerGenerator
8
- include Rails::Base
5
+ class Erb::Generators::ControllerGenerator
6
+ include Rails::Base
9
7
 
10
- def generate_locale_file
11
- invoke('locale:view', [name]) if configuration.autoload_view_generator_locale
12
- end
13
-
14
- def generate_test_file
15
- framework = configuration.test_framework
8
+ def generate_locale_file
9
+ invoke('locale:view', [name]) if configuration.autoload_view_generator_locale
10
+ end
16
11
 
17
- return if framework.nil?
18
- invoke("#{framework}:view", [name]) rescue nil
19
- end
12
+ def generate_test_file
13
+ framework = configuration.test_framework
20
14
 
21
- end
15
+ return if framework.nil?
16
+ invoke("#{framework}:view", [name]) rescue nil
22
17
  end
23
- end
24
18
 
25
- module Rails
26
- module Generators
27
- class ControllerGenerator
28
- include Rails::Base
19
+ end
29
20
 
30
- def generate_locale_file
31
- invoke('locale:controller', [name]) if configuration.autoload_controller_generator_locale
32
- end
21
+ class Rails::Generators::ControllerGenerator
22
+ include Rails::Base
33
23
 
34
- def generate_test_file
35
- framework = configuration.test_framework
24
+ def generate_locale_file
25
+ invoke('locale:controller', [name]) if configuration.autoload_controller_generator_locale
26
+ end
36
27
 
37
- return if framework.nil?
38
- invoke("#{framework}:controller", [name]) rescue nil
39
- end
28
+ def generate_test_file
29
+ framework = configuration.test_framework
40
30
 
41
- end
31
+ return if framework.nil?
32
+ invoke("#{framework}:controller", [name]) rescue nil
42
33
  end
34
+
43
35
  end
@@ -1,22 +1,18 @@
1
1
  require 'rails/generators/rails/helper/helper_generator'
2
2
  require 'generators/rails/base'
3
3
 
4
- module Rails
5
- module Generators
6
- class HelperGenerator
7
- include Rails::Base
4
+ class Rails::Generators::HelperGenerator
5
+ include Rails::Base
8
6
 
9
- def generate_locale_file
10
- invoke('locale:helper', [name]) if configuration.autoload_helper_generator_locale
11
- end
12
-
13
- def generate_test_file
14
- framework = configuration.test_framework
7
+ def generate_locale_file
8
+ invoke('locale:helper', [name]) if configuration.autoload_helper_generator_locale
9
+ end
15
10
 
16
- return if framework.nil?
17
- invoke("#{framework}:helper", [name]) rescue nil
18
- end
11
+ def generate_test_file
12
+ framework = configuration.test_framework
19
13
 
20
- end
14
+ return if framework.nil?
15
+ invoke("#{framework}:helper", [name]) rescue nil
21
16
  end
17
+
22
18
  end
@@ -1,22 +1,18 @@
1
1
  require 'rails/generators/job/job_generator'
2
2
  require 'generators/rails/base'
3
3
 
4
- module Rails
5
- module Generators
6
- class JobGenerator
7
- include Rails::Base
4
+ class Rails::Generators::JobGenerator
5
+ include Rails::Base
8
6
 
9
- def generate_locale_file
10
- invoke('locale:job', [name]) if configuration.autoload_job_generator_locale
11
- end
12
-
13
- def generate_test_file
14
- framework = configuration.test_framework
7
+ def generate_locale_file
8
+ invoke('locale:job', [name]) if configuration.autoload_job_generator_locale
9
+ end
15
10
 
16
- return if framework.nil?
17
- invoke("#{framework}:job", [name]) rescue nil
18
- end
11
+ def generate_test_file
12
+ framework = configuration.test_framework
19
13
 
20
- end
14
+ return if framework.nil?
15
+ invoke("#{framework}:job", [name]) rescue nil
21
16
  end
17
+
22
18
  end
@@ -2,42 +2,34 @@ require 'rails/generators/erb/mailer/mailer_generator'
2
2
  require 'rails/generators/mailer/mailer_generator'
3
3
  require 'generators/rails/base'
4
4
 
5
- module Erb
6
- module Generators
7
- class MailerGenerator
8
- include Rails::Base
5
+ class Erb::Generators::MailerGenerator
6
+ include Rails::Base
9
7
 
10
- def generate_locale_file
11
- invoke('locale:view', [name]) if configuration.autoload_view_generator_locale
12
- end
13
-
14
- def generate_test_file
15
- framework = configuration.test_framework
8
+ def generate_locale_file
9
+ invoke('locale:view', [name]) if configuration.autoload_view_generator_locale
10
+ end
16
11
 
17
- return if framework.nil?
18
- invoke("#{framework}:view", [name]) rescue nil
19
- end
12
+ def generate_test_file
13
+ framework = configuration.test_framework
20
14
 
21
- end
15
+ return if framework.nil?
16
+ invoke("#{framework}:view", [name]) rescue nil
22
17
  end
23
- end
24
18
 
25
- module Rails
26
- module Generators
27
- class MailerGenerator
28
- include Rails::Base
19
+ end
29
20
 
30
- def generate_locale_file
31
- invoke('locale:mailer', [name]) if configuration.autoload_mailer_generator_locale
32
- end
21
+ class Rails::Generators::MailerGenerator
22
+ include Rails::Base
33
23
 
34
- def generate_test_file
35
- framework = configuration.test_framework
24
+ def generate_locale_file
25
+ invoke('locale:mailer', [name]) if configuration.autoload_mailer_generator_locale
26
+ end
36
27
 
37
- return if framework.nil?
38
- invoke("#{framework}:mailer", [name]) rescue nil
39
- end
28
+ def generate_test_file
29
+ framework = configuration.test_framework
40
30
 
41
- end
31
+ return if framework.nil?
32
+ invoke("#{framework}:mailer", [name]) rescue nil
42
33
  end
34
+
43
35
  end
@@ -1,32 +1,32 @@
1
1
  require 'rails/generators/active_record/model/model_generator'
2
2
  require 'generators/rails/base'
3
3
 
4
- module ActiveRecord
5
- module Generators
6
- class ModelGenerator
7
- include Rails::Base
4
+ class ActiveRecord::Generators::ModelGenerator
5
+ include Rails::Base
8
6
 
9
- def create_migration_file
10
- # return unless options[:migration] && options[:parent].nil?
7
+ def create_migration_file
8
+ # return unless options[:migration] && options[:parent].nil?
11
9
 
12
- if options[:indexes] == false
13
- attributes.each { |attr| attr.attr_options.delete(:index) if attr.reference? && !attr.has_index? }
14
- end
15
-
16
- migration_template('../../migration/templates/create_table_migration.rb', "db/migrate/create_#{table_name}.rb")
10
+ if options[:indexes] == false
11
+ attributes.each do |attr|
12
+ attr.attr_options.delete(:index) if attr.reference? && !attr.has_index?
17
13
  end
14
+ end
18
15
 
19
- def generate_locale_file
20
- invoke('locale:model', [name]) if configuration.autoload_model_generator_locale
21
- end
16
+ path = "db/migrate/create_#{table_name}.rb"
22
17
 
23
- def generate_test_file
24
- framework = configuration.test_framework
18
+ migration_template('../../migration/templates/create_table_migration.rb', path)
19
+ end
25
20
 
26
- return if framework.nil?
27
- invoke("#{framework}:model", [name]) rescue nil
28
- end
21
+ def generate_locale_file
22
+ invoke('locale:model', [name]) if configuration.autoload_model_generator_locale
23
+ end
29
24
 
30
- end
25
+ def generate_test_file
26
+ framework = configuration.test_framework
27
+
28
+ return if framework.nil?
29
+ invoke("#{framework}:model", [name]) rescue nil
31
30
  end
31
+
32
32
  end
@@ -1,22 +1,18 @@
1
1
  require 'rails/generators/erb/scaffold/scaffold_generator'
2
2
  require 'generators/rails/base'
3
3
 
4
- module Erb
5
- module Generators
6
- class ScaffoldGenerator
7
- include Rails::Base
4
+ class Erb::Generators::ScaffoldGenerator
5
+ include Rails::Base
8
6
 
9
- def generate_locale_file
10
- invoke('locale:view', [name]) if configuration.autoload_view_generator_locale
11
- end
12
-
13
- def generate_test_file
14
- framework = configuration.test_framework
7
+ def generate_locale_file
8
+ invoke('locale:view', [name]) if configuration.autoload_view_generator_locale
9
+ end
15
10
 
16
- return if framework.nil?
17
- invoke("#{framework}:view", [name]) rescue nil
18
- end
11
+ def generate_test_file
12
+ framework = configuration.test_framework
19
13
 
20
- end
14
+ return if framework.nil?
15
+ invoke("#{framework}:view", [name]) rescue nil
21
16
  end
17
+
22
18
  end
@@ -1,13 +1,10 @@
1
1
  require 'rails/generators/rails/task/task_generator'
2
2
 
3
- module Rails
4
- module Generators
5
- class TaskGenerator
3
+ class Rails::Generators::TaskGenerator
6
4
 
7
- def generate_locale_file
8
- invoke('locale:task', [name]) if ActiveGenerator::Settings.config.autoload_task_generator_locale
9
- end
10
-
11
- end
5
+ def generate_locale_file
6
+ return unless ActiveGenerator::Settings.config.autoload_task_generator_locale
7
+ invoke('locale:task', [name])
12
8
  end
9
+
13
10
  end
@@ -6,7 +6,9 @@ class ServiceGenerator < Rails::Generators::NamedBase
6
6
  end
7
7
 
8
8
  def generate_locale_file
9
- invoke('locale:service', [name]) if ActiveGenerator::Settings.config.autoload_service_generator_locale
9
+ if ActiveGenerator::Settings.config.autoload_service_generator_locale
10
+ invoke('locale:service', [name])
11
+ end
10
12
  end
11
13
 
12
14
  end
@@ -11,7 +11,9 @@ class ViewGenerator < Rails::Generators::NamedBase
11
11
  def create_view_file
12
12
  unless actions.empty?
13
13
  actions.each do |filename|
14
- template('view.html.erb', File.join('app/views', class_path, file_name, "#{filename}.html.erb"))
14
+ path = File.join('app/views', class_path, file_name, "#{filename}.html.erb")
15
+
16
+ template('view.html.erb', path)
15
17
  end
16
18
  end
17
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-02 00:00:00.000000000 Z
11
+ date: 2016-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: flay
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: reek
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -159,7 +145,6 @@ extra_rdoc_files: []
159
145
  files:
160
146
  - ".coveralls.yml"
161
147
  - ".fasterer.yml"
162
- - ".flayignore"
163
148
  - ".gitignore"
164
149
  - ".reek"
165
150
  - ".rspec"
data/.flayignore DELETED
@@ -1,2 +0,0 @@
1
- ./spec/lib/generators/**/*
2
- ./spec/support/generators/**/*