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.
- checksums.yaml +4 -4
- data/.reek +6 -0
- data/.rubocop.yml +12 -8
- data/active_generator.gemspec +0 -1
- data/lib/active_generator/base.rb +23 -25
- data/lib/active_generator/settings.rb +11 -13
- data/lib/active_generator/version.rb +1 -1
- data/lib/generators/active_generator/install/install_generator.rb +5 -7
- data/lib/generators/environment/environment_generator.rb +6 -2
- data/lib/generators/locale/api/api_generator.rb +10 -10
- data/lib/generators/locale/controller/controller_generator.rb +10 -11
- data/lib/generators/locale/helper/helper_generator.rb +10 -10
- data/lib/generators/locale/job/job_generator.rb +10 -10
- data/lib/generators/locale/mailer/mailer_generator.rb +10 -10
- data/lib/generators/locale/model/model_generator.rb +10 -10
- data/lib/generators/locale/service/service_generator.rb +10 -10
- data/lib/generators/locale/task/task_generator.rb +10 -10
- data/lib/generators/locale/uploader/uploader_generator.rb +10 -10
- data/lib/generators/locale/view/view_generator.rb +10 -10
- data/lib/generators/rails/base.rb +5 -7
- data/lib/generators/rails/controller_generator.rb +20 -28
- data/lib/generators/rails/helper_generator.rb +10 -14
- data/lib/generators/rails/job_generator.rb +10 -14
- data/lib/generators/rails/mailer_generator.rb +20 -28
- data/lib/generators/rails/model_generator.rb +20 -20
- data/lib/generators/rails/scaffold_generator.rb +10 -14
- data/lib/generators/rails/task_generator.rb +5 -8
- data/lib/generators/service/service_generator.rb +3 -1
- data/lib/generators/view/view_generator.rb +3 -1
- metadata +2 -17
- data/.flayignore +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e03c2c9f0ff2757a54adbac0597bafd164c81576
|
4
|
+
data.tar.gz: a8bba9b3547e1e52c27021e0eb13aad63a82bd5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f8fcaf18b7239c97a6a310950858533237c2c16a0b2004902c5c7fc6d56a366cbe92a58c73c0117e36bcbeec2f2e2a7e40f6883dbe870ff1c0b268bdc07034a
|
7
|
+
data.tar.gz: 0ff3a24b029c62fc05950d794aa8d16f0f5726b8ad82a10138b33d48da870ea783a2057419adc3478461c0464ae07102c73d442ed62abda74ecef1d1012a07c1
|
data/.reek
CHANGED
data/.rubocop.yml
CHANGED
@@ -3,20 +3,20 @@ AllCops:
|
|
3
3
|
DisplayStyleGuide: true
|
4
4
|
TargetRubyVersion: 2.3
|
5
5
|
Exclude:
|
6
|
-
- 'lib
|
7
|
-
- '
|
8
|
-
- 'lib/generators/service/templates/*'
|
9
|
-
- 'spec/support/**/*'
|
6
|
+
- 'lib/**/**/templates/*'
|
7
|
+
- 'spec/**/**/*'
|
10
8
|
LineLength:
|
11
|
-
Max:
|
12
|
-
|
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
|
data/active_generator.gemspec
CHANGED
@@ -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
|
-
|
3
|
+
private
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
9
|
+
def file_name_human
|
10
|
+
file_name_table.tr('_', ' ').downcase.capitalize
|
11
|
+
end
|
17
12
|
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
def namespace
|
14
|
+
name.downcase.split('/')[0...-1]
|
15
|
+
end
|
21
16
|
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
def namespaced?
|
18
|
+
name.include?('/')
|
19
|
+
end
|
25
20
|
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
def namespace_human
|
22
|
+
namespace.join(' ').tr('_', ' ').downcase.capitalize
|
23
|
+
end
|
29
24
|
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
4
|
-
|
5
|
-
extend Dry::Configurable
|
3
|
+
class ActiveGenerator::Settings
|
4
|
+
extend Dry::Configurable
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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,10 +1,8 @@
|
|
1
|
-
|
2
|
-
|
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,
|
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
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
include Locale::Base
|
4
|
+
class Locale::ApiGenerator < Rails::Generators::NamedBase
|
5
|
+
include ActiveGenerator::Base
|
6
|
+
include Locale::Base
|
8
7
|
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
include Locale::Base
|
4
|
+
class Locale::ControllerGenerator < Rails::Generators::NamedBase
|
5
|
+
include ActiveGenerator::Base
|
6
|
+
include Locale::Base
|
8
7
|
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
include Locale::Base
|
4
|
+
class Locale::HelperGenerator < Rails::Generators::NamedBase
|
5
|
+
include ActiveGenerator::Base
|
6
|
+
include Locale::Base
|
8
7
|
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
include Locale::Base
|
4
|
+
class Locale::JobGenerator < Rails::Generators::NamedBase
|
5
|
+
include ActiveGenerator::Base
|
6
|
+
include Locale::Base
|
8
7
|
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
include Locale::Base
|
4
|
+
class Locale::MailerGenerator < Rails::Generators::NamedBase
|
5
|
+
include ActiveGenerator::Base
|
6
|
+
include Locale::Base
|
8
7
|
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
include Locale::Base
|
4
|
+
class Locale::ModelGenerator < Rails::Generators::NamedBase
|
5
|
+
include ActiveGenerator::Base
|
6
|
+
include Locale::Base
|
8
7
|
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
include Locale::Base
|
4
|
+
class Locale::ServiceGenerator < Rails::Generators::NamedBase
|
5
|
+
include ActiveGenerator::Base
|
6
|
+
include Locale::Base
|
8
7
|
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
include Locale::Base
|
4
|
+
class Locale::TaskGenerator < Rails::Generators::NamedBase
|
5
|
+
include ActiveGenerator::Base
|
6
|
+
include Locale::Base
|
8
7
|
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
include Locale::Base
|
4
|
+
class Locale::UploaderGenerator < Rails::Generators::NamedBase
|
5
|
+
include ActiveGenerator::Base
|
6
|
+
include Locale::Base
|
8
7
|
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
include Locale::Base
|
4
|
+
class Locale::ViewGenerator < Rails::Generators::NamedBase
|
5
|
+
include ActiveGenerator::Base
|
6
|
+
include Locale::Base
|
8
7
|
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
@@ -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
|
-
|
6
|
-
|
7
|
-
class ControllerGenerator
|
8
|
-
include Rails::Base
|
5
|
+
class Erb::Generators::ControllerGenerator
|
6
|
+
include Rails::Base
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
18
|
-
|
19
|
-
end
|
12
|
+
def generate_test_file
|
13
|
+
framework = configuration.test_framework
|
20
14
|
|
21
|
-
|
15
|
+
return if framework.nil?
|
16
|
+
invoke("#{framework}:view", [name]) rescue nil
|
22
17
|
end
|
23
|
-
end
|
24
18
|
|
25
|
-
|
26
|
-
module Generators
|
27
|
-
class ControllerGenerator
|
28
|
-
include Rails::Base
|
19
|
+
end
|
29
20
|
|
30
|
-
|
31
|
-
|
32
|
-
end
|
21
|
+
class Rails::Generators::ControllerGenerator
|
22
|
+
include Rails::Base
|
33
23
|
|
34
|
-
|
35
|
-
|
24
|
+
def generate_locale_file
|
25
|
+
invoke('locale:controller', [name]) if configuration.autoload_controller_generator_locale
|
26
|
+
end
|
36
27
|
|
37
|
-
|
38
|
-
|
39
|
-
end
|
28
|
+
def generate_test_file
|
29
|
+
framework = configuration.test_framework
|
40
30
|
|
41
|
-
|
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
|
-
|
5
|
-
|
6
|
-
class HelperGenerator
|
7
|
-
include Rails::Base
|
4
|
+
class Rails::Generators::HelperGenerator
|
5
|
+
include Rails::Base
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
17
|
-
|
18
|
-
end
|
11
|
+
def generate_test_file
|
12
|
+
framework = configuration.test_framework
|
19
13
|
|
20
|
-
|
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
|
-
|
5
|
-
|
6
|
-
class JobGenerator
|
7
|
-
include Rails::Base
|
4
|
+
class Rails::Generators::JobGenerator
|
5
|
+
include Rails::Base
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
17
|
-
|
18
|
-
end
|
11
|
+
def generate_test_file
|
12
|
+
framework = configuration.test_framework
|
19
13
|
|
20
|
-
|
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
|
-
|
6
|
-
|
7
|
-
class MailerGenerator
|
8
|
-
include Rails::Base
|
5
|
+
class Erb::Generators::MailerGenerator
|
6
|
+
include Rails::Base
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
18
|
-
|
19
|
-
end
|
12
|
+
def generate_test_file
|
13
|
+
framework = configuration.test_framework
|
20
14
|
|
21
|
-
|
15
|
+
return if framework.nil?
|
16
|
+
invoke("#{framework}:view", [name]) rescue nil
|
22
17
|
end
|
23
|
-
end
|
24
18
|
|
25
|
-
|
26
|
-
module Generators
|
27
|
-
class MailerGenerator
|
28
|
-
include Rails::Base
|
19
|
+
end
|
29
20
|
|
30
|
-
|
31
|
-
|
32
|
-
end
|
21
|
+
class Rails::Generators::MailerGenerator
|
22
|
+
include Rails::Base
|
33
23
|
|
34
|
-
|
35
|
-
|
24
|
+
def generate_locale_file
|
25
|
+
invoke('locale:mailer', [name]) if configuration.autoload_mailer_generator_locale
|
26
|
+
end
|
36
27
|
|
37
|
-
|
38
|
-
|
39
|
-
end
|
28
|
+
def generate_test_file
|
29
|
+
framework = configuration.test_framework
|
40
30
|
|
41
|
-
|
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
|
-
|
5
|
-
|
6
|
-
class ModelGenerator
|
7
|
-
include Rails::Base
|
4
|
+
class ActiveRecord::Generators::ModelGenerator
|
5
|
+
include Rails::Base
|
8
6
|
|
9
|
-
|
10
|
-
|
7
|
+
def create_migration_file
|
8
|
+
# return unless options[:migration] && options[:parent].nil?
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
20
|
-
invoke('locale:model', [name]) if configuration.autoload_model_generator_locale
|
21
|
-
end
|
16
|
+
path = "db/migrate/create_#{table_name}.rb"
|
22
17
|
|
23
|
-
|
24
|
-
|
18
|
+
migration_template('../../migration/templates/create_table_migration.rb', path)
|
19
|
+
end
|
25
20
|
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
def generate_locale_file
|
22
|
+
invoke('locale:model', [name]) if configuration.autoload_model_generator_locale
|
23
|
+
end
|
29
24
|
|
30
|
-
|
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
|
-
|
5
|
-
|
6
|
-
class ScaffoldGenerator
|
7
|
-
include Rails::Base
|
4
|
+
class Erb::Generators::ScaffoldGenerator
|
5
|
+
include Rails::Base
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
17
|
-
|
18
|
-
end
|
11
|
+
def generate_test_file
|
12
|
+
framework = configuration.test_framework
|
19
13
|
|
20
|
-
|
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
|
-
|
4
|
-
module Generators
|
5
|
-
class TaskGenerator
|
3
|
+
class Rails::Generators::TaskGenerator
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
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
|
-
|
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.
|
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-
|
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