active_generator 4.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -4
- data/lib/active_generator/base.rb +25 -23
- data/lib/active_generator/settings.rb +13 -11
- data/lib/active_generator/version.rb +1 -1
- data/lib/generators/active_generator/install/install_generator.rb +7 -5
- data/lib/generators/locale/api/api_generator.rb +12 -10
- data/lib/generators/locale/controller/controller_generator.rb +11 -10
- data/lib/generators/locale/helper/helper_generator.rb +12 -10
- data/lib/generators/locale/job/job_generator.rb +12 -10
- data/lib/generators/locale/mailer/mailer_generator.rb +12 -10
- data/lib/generators/locale/model/model_generator.rb +12 -10
- data/lib/generators/locale/service/service_generator.rb +12 -10
- data/lib/generators/locale/task/task_generator.rb +12 -10
- data/lib/generators/locale/uploader/uploader_generator.rb +12 -10
- data/lib/generators/locale/view/view_generator.rb +12 -10
- data/lib/generators/rails/base.rb +7 -5
- data/lib/generators/rails/controller_generator.rb +28 -20
- data/lib/generators/rails/helper_generator.rb +14 -10
- data/lib/generators/rails/job_generator.rb +13 -10
- data/lib/generators/rails/mailer_generator.rb +28 -20
- data/lib/generators/rails/model_generator.rb +24 -20
- data/lib/generators/rails/scaffold_generator.rb +14 -10
- data/lib/generators/rails/task_generator.rb +9 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaf1c1e12a16b1b8eeb76c1e3bc84cab50b51f6e
|
4
|
+
data.tar.gz: 8e2c58e99340d39afdd422295790e741adc3d85e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2db97c82034ce58252d3c1898c9511d67dd6a9430df84192bdd87bd6e1bc7b0d29335ee5b20df680873452289958ca86e228677b3f2bf4530e50ce14a6bd4bb2
|
7
|
+
data.tar.gz: 5b0f8e12f0112be6e0e88d403b264fc89c1e60219dba9d56ed2d060368ba015915308615a57518c0f4b0c99e0225d3c4c53254d17f578f1d1a7ed1dd04548725
|
data/.rubocop.yml
CHANGED
@@ -13,10 +13,6 @@ Style/Alias:
|
|
13
13
|
EnforcedStyle: prefer_alias_method
|
14
14
|
Style/BracesAroundHashParameters:
|
15
15
|
Enabled: false
|
16
|
-
Style/ClassAndModuleChildren:
|
17
|
-
EnforcedStyle: compact
|
18
|
-
Exclude:
|
19
|
-
- 'lib/generators/locale/base.rb'
|
20
16
|
Style/ClosingParenthesisIndentation:
|
21
17
|
Enabled: false
|
22
18
|
Style/Documentation:
|
@@ -1,33 +1,35 @@
|
|
1
|
-
module ActiveGenerator
|
1
|
+
module ActiveGenerator
|
2
|
+
module Base
|
2
3
|
|
3
|
-
|
4
|
+
private
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
def file_name_table
|
7
|
+
file_name.underscore
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
def file_name_human
|
11
|
+
file_name_table.tr('_', ' ').downcase.capitalize
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
def namespace
|
15
|
+
name.downcase.split('/')[0...-1]
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
def namespaced?
|
19
|
+
name.include?('/')
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
def namespace_human
|
23
|
+
namespace.join(' ').tr('_', ' ').downcase.capitalize
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
def namespace_table
|
27
|
+
namespace.join('_')
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
def namespace_path
|
31
|
+
namespace.join('/')
|
32
|
+
end
|
32
33
|
|
34
|
+
end
|
33
35
|
end
|
@@ -1,16 +1,18 @@
|
|
1
1
|
require 'dry-configurable'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
module ActiveGenerator
|
4
|
+
class Settings
|
5
|
+
extend Dry::Configurable
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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'
|
15
16
|
|
17
|
+
end
|
16
18
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module ActiveGenerator
|
2
|
+
class InstallGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
5
|
+
def copy_initializer_file
|
6
|
+
copy_file('install.rb', 'config/initializers/active_generator.rb')
|
7
|
+
end
|
7
8
|
|
9
|
+
end
|
8
10
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'active_generator/base'
|
2
2
|
require 'generators/locale/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Locale
|
5
|
+
class ApiGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def create_api_file
|
13
|
+
assert_valid_language!
|
14
|
+
path = File.join("config/locales/#{language}/apis", namespace_path, "#{file_name}.yml")
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
template('api.yml', path)
|
17
|
+
end
|
17
18
|
|
19
|
+
end
|
18
20
|
end
|
@@ -1,18 +1,19 @@
|
|
1
1
|
require 'active_generator/base'
|
2
2
|
require 'generators/locale/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Locale
|
5
|
+
class ControllerGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def create_controller_file
|
13
|
+
assert_valid_language!
|
14
|
+
path = File.join("config/locales/#{language}/controllers", namespace_path, "#{file_name}.yml")
|
14
15
|
|
15
|
-
|
16
|
+
template('controller.yml', path)
|
17
|
+
end
|
16
18
|
end
|
17
|
-
|
18
19
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'active_generator/base'
|
2
2
|
require 'generators/locale/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Locale
|
5
|
+
class HelperGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def create_helper_file
|
13
|
+
assert_valid_language!
|
14
|
+
path = File.join("config/locales/#{language}/helpers", namespace_path, "#{file_name}.yml")
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
template('helper.yml', path)
|
17
|
+
end
|
17
18
|
|
19
|
+
end
|
18
20
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'active_generator/base'
|
2
2
|
require 'generators/locale/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Locale
|
5
|
+
class JobGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def create_job_file
|
13
|
+
assert_valid_language!
|
14
|
+
path = File.join("config/locales/#{language}/jobs", namespace_path, "#{file_name}.yml")
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
template('job.yml', path)
|
17
|
+
end
|
17
18
|
|
19
|
+
end
|
18
20
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'active_generator/base'
|
2
2
|
require 'generators/locale/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Locale
|
5
|
+
class MailerGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def create_mailer_file
|
13
|
+
assert_valid_language!
|
14
|
+
path = File.join("config/locales/#{language}/mailers", namespace_path, "#{file_name}.yml")
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
template('mailer.yml', path)
|
17
|
+
end
|
17
18
|
|
19
|
+
end
|
18
20
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'active_generator/base'
|
2
2
|
require 'generators/locale/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Locale
|
5
|
+
class ModelGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def create_model_file
|
13
|
+
assert_valid_language!
|
14
|
+
path = File.join("config/locales/#{language}/models", namespace_path, "#{file_name}.yml")
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
template('model.yml', path)
|
17
|
+
end
|
17
18
|
|
19
|
+
end
|
18
20
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'active_generator/base'
|
2
2
|
require 'generators/locale/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Locale
|
5
|
+
class ServiceGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def create_service_file
|
13
|
+
assert_valid_language!
|
14
|
+
path = File.join("config/locales/#{language}/services", namespace_path, "#{file_name}.yml")
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
template('service.yml', path)
|
17
|
+
end
|
17
18
|
|
19
|
+
end
|
18
20
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'active_generator/base'
|
2
2
|
require 'generators/locale/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Locale
|
5
|
+
class TaskGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def copy_task_file
|
13
|
+
assert_valid_language!
|
14
|
+
path = File.join("config/locales/#{language}/tasks", namespace_path, "#{file_name}.yml")
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
template('task.yml', path)
|
17
|
+
end
|
17
18
|
|
19
|
+
end
|
18
20
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'active_generator/base'
|
2
2
|
require 'generators/locale/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Locale
|
5
|
+
class UploaderGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def create_uploader_file
|
13
|
+
assert_valid_language!
|
14
|
+
path = File.join("config/locales/#{language}/uploaders", namespace_path, "#{file_name}.yml")
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
template('uploader.yml', path)
|
17
|
+
end
|
17
18
|
|
19
|
+
end
|
18
20
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'active_generator/base'
|
2
2
|
require 'generators/locale/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Locale
|
5
|
+
class ViewGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def create_view_file
|
13
|
+
assert_valid_language!
|
14
|
+
path = File.join("config/locales/#{language}/views", namespace_path, "#{file_name}.yml")
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
template('view.yml', path)
|
17
|
+
end
|
17
18
|
|
19
|
+
end
|
18
20
|
end
|
@@ -2,34 +2,42 @@ 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
|
-
|
5
|
+
module Erb
|
6
|
+
module Generators
|
7
|
+
class ControllerGenerator
|
8
|
+
include Rails::Base
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
def generate_locale_file
|
11
|
+
invoke('locale:view', [name]) if configuration.autoload_view_generator_locale
|
12
|
+
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
+
def generate_test_file
|
15
|
+
framework = configuration.test_framework
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
return if framework.nil?
|
18
|
+
invoke("#{framework}:view", [name]) rescue nil
|
19
|
+
end
|
18
20
|
|
21
|
+
end
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
|
-
|
22
|
-
|
25
|
+
module Rails
|
26
|
+
module Generators
|
27
|
+
class ControllerGenerator
|
28
|
+
include Rails::Base
|
23
29
|
|
24
|
-
|
25
|
-
|
26
|
-
|
30
|
+
def generate_locale_file
|
31
|
+
invoke('locale:controller', [name]) if configuration.autoload_controller_generator_locale
|
32
|
+
end
|
27
33
|
|
28
|
-
|
29
|
-
|
34
|
+
def generate_test_file
|
35
|
+
framework = configuration.test_framework
|
30
36
|
|
31
|
-
|
32
|
-
|
33
|
-
|
37
|
+
return if framework.nil?
|
38
|
+
invoke("#{framework}:controller", [name]) rescue nil
|
39
|
+
end
|
34
40
|
|
41
|
+
end
|
42
|
+
end
|
35
43
|
end
|
@@ -1,18 +1,22 @@
|
|
1
1
|
require 'rails/generators/rails/helper/helper_generator'
|
2
2
|
require 'generators/rails/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
module Rails
|
5
|
+
module Generators
|
6
|
+
class HelperGenerator
|
7
|
+
include Rails::Base
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
def generate_locale_file
|
10
|
+
invoke('locale:helper', [name]) if configuration.autoload_helper_generator_locale
|
11
|
+
end
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
def generate_test_file
|
14
|
+
framework = configuration.test_framework
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
return if framework.nil?
|
17
|
+
invoke("#{framework}:helper", [name]) rescue nil
|
18
|
+
end
|
17
19
|
|
20
|
+
end
|
21
|
+
end
|
18
22
|
end
|
@@ -1,18 +1,21 @@
|
|
1
1
|
require 'rails/generators/job/job_generator'
|
2
2
|
require 'generators/rails/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
module Rails
|
5
|
+
module Generators
|
6
|
+
class JobGenerator
|
7
|
+
include Rails::Base
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
def generate_locale_file
|
10
|
+
invoke('locale:job', [name]) if configuration.autoload_job_generator_locale
|
11
|
+
end
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
def generate_test_file
|
14
|
+
framework = configuration.test_framework
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
+
return if framework.nil?
|
17
|
+
invoke("#{framework}:job", [name]) rescue nil
|
18
|
+
end
|
19
|
+
end
|
16
20
|
end
|
17
|
-
|
18
21
|
end
|
@@ -2,34 +2,42 @@ 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
|
-
|
5
|
+
module Erb
|
6
|
+
module Generators
|
7
|
+
class MailerGenerator
|
8
|
+
include Rails::Base
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
def generate_locale_file
|
11
|
+
invoke('locale:view', [name]) if configuration.autoload_view_generator_locale
|
12
|
+
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
+
def generate_test_file
|
15
|
+
framework = configuration.test_framework
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
return if framework.nil?
|
18
|
+
invoke("#{framework}:view", [name]) rescue nil
|
19
|
+
end
|
18
20
|
|
21
|
+
end
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
|
-
|
22
|
-
|
25
|
+
module Rails
|
26
|
+
module Generators
|
27
|
+
class MailerGenerator
|
28
|
+
include Rails::Base
|
23
29
|
|
24
|
-
|
25
|
-
|
26
|
-
|
30
|
+
def generate_locale_file
|
31
|
+
invoke('locale:mailer', [name]) if configuration.autoload_mailer_generator_locale
|
32
|
+
end
|
27
33
|
|
28
|
-
|
29
|
-
|
34
|
+
def generate_test_file
|
35
|
+
framework = configuration.test_framework
|
30
36
|
|
31
|
-
|
32
|
-
|
33
|
-
|
37
|
+
return if framework.nil?
|
38
|
+
invoke("#{framework}:mailer", [name]) rescue nil
|
39
|
+
end
|
34
40
|
|
41
|
+
end
|
42
|
+
end
|
35
43
|
end
|
@@ -1,32 +1,36 @@
|
|
1
1
|
require 'rails/generators/active_record/model/model_generator'
|
2
2
|
require 'generators/rails/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
module ActiveRecord
|
5
|
+
module Generators
|
6
|
+
class ModelGenerator
|
7
|
+
include Rails::Base
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
def create_migration_file
|
10
|
+
# return unless options[:migration] && options[:parent].nil?
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
if options[:indexes] == false
|
13
|
+
attributes.each do |attr|
|
14
|
+
attr.attr_options.delete(:index) if attr.reference? && !attr.has_index?
|
15
|
+
end
|
16
|
+
end
|
15
17
|
|
16
|
-
|
18
|
+
path = "db/migrate/create_#{table_name}.rb"
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
+
migration_template('../../migration/templates/create_table_migration.rb', path)
|
21
|
+
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
def generate_locale_file
|
24
|
+
invoke('locale:model', [name]) if configuration.autoload_model_generator_locale
|
25
|
+
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
+
def generate_test_file
|
28
|
+
framework = configuration.test_framework
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
return if framework.nil?
|
31
|
+
invoke("#{framework}:model", [name]) rescue nil
|
32
|
+
end
|
31
33
|
|
34
|
+
end
|
35
|
+
end
|
32
36
|
end
|
@@ -1,18 +1,22 @@
|
|
1
1
|
require 'rails/generators/erb/scaffold/scaffold_generator'
|
2
2
|
require 'generators/rails/base'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
module Erb
|
5
|
+
module Generators
|
6
|
+
class ScaffoldGenerator
|
7
|
+
include Rails::Base
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
def generate_locale_file
|
10
|
+
invoke('locale:view', [name]) if configuration.autoload_view_generator_locale
|
11
|
+
end
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
def generate_test_file
|
14
|
+
framework = configuration.test_framework
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
return if framework.nil?
|
17
|
+
invoke("#{framework}:view", [name]) rescue nil
|
18
|
+
end
|
17
19
|
|
20
|
+
end
|
21
|
+
end
|
18
22
|
end
|
@@ -1,10 +1,14 @@
|
|
1
1
|
require 'rails/generators/rails/task/task_generator'
|
2
2
|
|
3
|
-
|
3
|
+
module Rails
|
4
|
+
module Generators
|
5
|
+
class TaskGenerator
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
def generate_locale_file
|
8
|
+
return unless ActiveGenerator::Settings.config.autoload_task_generator_locale
|
9
|
+
invoke('locale:task', [name])
|
10
|
+
end
|
9
11
|
|
12
|
+
end
|
13
|
+
end
|
10
14
|
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.2
|
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-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|