active_generator 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_generator.rb +36 -33
- data/lib/active_generator/configuration.rb +23 -0
- data/lib/active_generator/version.rb +1 -1
- data/lib/generators/locale/api/USAGE +1 -1
- data/lib/generators/locale/controller/USAGE +1 -1
- data/lib/generators/locale/helper/USAGE +1 -1
- data/lib/generators/locale/jbuilder/USAGE +8 -0
- data/lib/generators/locale/jbuilder/jbuilder_generator.rb +18 -0
- data/lib/generators/locale/jbuilder/templates/jbuilder.yml +41 -0
- data/lib/generators/locale/job/USAGE +1 -1
- data/lib/generators/locale/mailer/USAGE +1 -1
- data/lib/generators/locale/model/USAGE +1 -1
- data/lib/generators/locale/responders_controller/USAGE +8 -0
- data/lib/generators/locale/responders_controller/responders_controller_generator.rb +18 -0
- data/lib/generators/locale/responders_controller/templates/responders_controller.yml +41 -0
- data/lib/generators/locale/service/USAGE +1 -1
- data/lib/generators/locale/task/USAGE +8 -0
- data/lib/generators/locale/task/task_generator.rb +18 -0
- data/lib/generators/locale/task/templates/task.yml +14 -0
- data/lib/generators/locale/uploader/USAGE +1 -1
- data/lib/generators/locale/view/USAGE +1 -1
- metadata +11 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30f5c2d64b306b4fe28ab6e5e4e3d1eb317ce51b
|
4
|
+
data.tar.gz: 1545a9a6060381196f93dff33d760037974cc5f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 332e8c462a9a6bf53c9af03888afa0910a859c53fdf1043022723628d02b8984dfc11a5024d1421295b56d9715a1b76bbc18591e97e11d79e9ac281de214371c
|
7
|
+
data.tar.gz: a03e87e8712288c3da3a943f50087fb441fdcd2f1c18a60c505dff9388a347ab0800b92a69221bf53bc97778657b0debf8f96f8c7d73ffecadc28a6d07da4776
|
data/lib/active_generator.rb
CHANGED
@@ -1,47 +1,50 @@
|
|
1
1
|
require "rails/generators"
|
2
|
-
require 'rails/generators/rails/controller/controller_generator'
|
3
|
-
require 'rails/generators/rails/helper/helper_generator'
|
4
|
-
require 'rails/generators/rails/model/model_generator'
|
5
|
-
|
6
2
|
|
7
3
|
require "active_object"
|
8
4
|
require "active_generator/version"
|
5
|
+
require "active_generator/configuration"
|
9
6
|
|
10
7
|
require "generators/environment/environment_generator"
|
11
8
|
require "generators/initializer/initializer_generator"
|
12
9
|
require "generators/service/service_generator"
|
13
10
|
|
14
|
-
%w(api controller helper job mailer model service uploader view).each do |
|
15
|
-
require "generators/locale/#{
|
11
|
+
%w(api controller helper jbuilder job mailer model responders_controller service task uploader view).each do |generator_name|
|
12
|
+
require "generators/locale/#{generator_name}/#{generator_name}_generator"
|
16
13
|
end
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
module ActiveGenerator
|
16
|
+
|
17
|
+
class << self
|
18
|
+
attr_accessor :configuration
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.configuration
|
22
|
+
@configuration ||= Configuration.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.configuration=(config)
|
26
|
+
@configuration = config
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.configure
|
30
|
+
yield(configuration)
|
22
31
|
end
|
32
|
+
|
23
33
|
end
|
24
34
|
|
25
|
-
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
#
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
# end
|
42
|
-
|
43
|
-
# Rails::Generators::ModelGenerator.class_eval do
|
44
|
-
# def copy_locale_file
|
45
|
-
# invoke("locale:model", [name])
|
46
|
-
# end
|
47
|
-
# end
|
35
|
+
%w(controller helper jbuilder job mailer model responders_controller task).each do |generator_name|
|
36
|
+
if ActiveGenerator.configuration.send("autoload_#{generator_name}_generator_locale")
|
37
|
+
begin
|
38
|
+
require "rails/generators/rails/#{generator_name}/#{generator_name}_generator"
|
39
|
+
|
40
|
+
"Rails::Generators::#{generator_name.to_s.camelize}Generator".constantize.class_eval do
|
41
|
+
def copy_locale_file
|
42
|
+
invoke("locale:#{generator_name}", [name])
|
43
|
+
invoke("locale:helper", [name]) if generator_name == "controller"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
rescue LoadError => e
|
47
|
+
# Skip over missing files
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class ActiveGenerator::Configuration
|
2
|
+
|
3
|
+
attr_accessor :autoload_controller_generator_locale,
|
4
|
+
:autoload_helper_generator_locale,
|
5
|
+
:autoload_jbuilder_generator_locale,
|
6
|
+
:autoload_job_generator_locale,
|
7
|
+
:autoload_mailer_generator_locale,
|
8
|
+
:autoload_model_generator_locale,
|
9
|
+
:autoload_responders_controller_generator_locale,
|
10
|
+
:autoload_task_generator_locale
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@autoload_controller_generator_locale = true
|
14
|
+
@autoload_helper_generator_locale = true
|
15
|
+
@autoload_jbuilder_generator_locale = true
|
16
|
+
@autoload_job_generator_locale = true
|
17
|
+
@autoload_mailer_generator_locale = true
|
18
|
+
@autoload_model_generator_locale = true
|
19
|
+
@autoload_responders_controller_generator_locale = true
|
20
|
+
@autoload_task_generator_locale = true
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "active_generator/base"
|
2
|
+
require "generators/locale/base"
|
3
|
+
|
4
|
+
module Locale
|
5
|
+
class ControllerGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
8
|
+
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
|
11
|
+
|
12
|
+
def copy_jbuilder_file
|
13
|
+
assert_valid_language!
|
14
|
+
template("jbuilder.yml", "config/locales/#{language}/jbuilders/#{namespace_path}/#{file_name}.yml")
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#==================================================
|
2
|
+
# Table of Contents
|
3
|
+
#==================================================
|
4
|
+
# <%= namespace_human %>
|
5
|
+
<% if namespaced? -%>
|
6
|
+
# <%= file_name_human %>
|
7
|
+
# Actions
|
8
|
+
# Methods
|
9
|
+
|
10
|
+
<%= language %>:
|
11
|
+
jbuilders:
|
12
|
+
<%= namespace_table %>:
|
13
|
+
<%= file_name_table %>:
|
14
|
+
|
15
|
+
# Actions
|
16
|
+
#--------------------------------------------------
|
17
|
+
actions:
|
18
|
+
todo: "TODO"
|
19
|
+
|
20
|
+
# Methods
|
21
|
+
#--------------------------------------------------
|
22
|
+
methods:
|
23
|
+
todo: "TODO"
|
24
|
+
<% else -%>
|
25
|
+
# Actions
|
26
|
+
# Methods
|
27
|
+
|
28
|
+
<%= language %>:
|
29
|
+
jbuilders:
|
30
|
+
<%= file_name_table %>:
|
31
|
+
|
32
|
+
# Actions
|
33
|
+
#--------------------------------------------------
|
34
|
+
actions:
|
35
|
+
todo: "TODO"
|
36
|
+
|
37
|
+
# Methods
|
38
|
+
#--------------------------------------------------
|
39
|
+
methods:
|
40
|
+
todo: "TODO"
|
41
|
+
<% end -%>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "active_generator/base"
|
2
|
+
require "generators/locale/base"
|
3
|
+
|
4
|
+
module Locale
|
5
|
+
class RespondersControllerGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
8
|
+
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
|
11
|
+
|
12
|
+
def copy_responders_controller_file
|
13
|
+
assert_valid_language!
|
14
|
+
template("responders_controller.yml", "config/locales/#{language}/responders_controllers/#{namespace_path}/#{file_name}.yml")
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#==================================================
|
2
|
+
# Table of Contents
|
3
|
+
#==================================================
|
4
|
+
# <%= namespace_human %>
|
5
|
+
<% if namespaced? -%>
|
6
|
+
# <%= file_name_human %>
|
7
|
+
# Actions
|
8
|
+
# Methods
|
9
|
+
|
10
|
+
<%= language %>:
|
11
|
+
responder_controllers:
|
12
|
+
<%= namespace_table %>:
|
13
|
+
<%= file_name_table %>:
|
14
|
+
|
15
|
+
# Actions
|
16
|
+
#--------------------------------------------------
|
17
|
+
actions:
|
18
|
+
todo: "TODO"
|
19
|
+
|
20
|
+
# Methods
|
21
|
+
#--------------------------------------------------
|
22
|
+
methods:
|
23
|
+
todo: "TODO"
|
24
|
+
<% else -%>
|
25
|
+
# Actions
|
26
|
+
# Methods
|
27
|
+
|
28
|
+
<%= language %>:
|
29
|
+
responder_controllers:
|
30
|
+
<%= file_name_table %>:
|
31
|
+
|
32
|
+
# Actions
|
33
|
+
#--------------------------------------------------
|
34
|
+
actions:
|
35
|
+
todo: "TODO"
|
36
|
+
|
37
|
+
# Methods
|
38
|
+
#--------------------------------------------------
|
39
|
+
methods:
|
40
|
+
todo: "TODO"
|
41
|
+
<% end -%>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "active_generator/base"
|
2
|
+
require "generators/locale/base"
|
3
|
+
|
4
|
+
module Locale
|
5
|
+
class TaskGenerator < Rails::Generators::NamedBase
|
6
|
+
include ActiveGenerator::Base
|
7
|
+
include Locale::Base
|
8
|
+
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
|
11
|
+
|
12
|
+
def copy_task_file
|
13
|
+
assert_valid_language!
|
14
|
+
template("task.yml", "config/locales/#{language}/tasks/#{file_name}.yml")
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#==================================================
|
2
|
+
# Table of Contents
|
3
|
+
#==================================================
|
4
|
+
# <%= file_name_human %>
|
5
|
+
# Methods
|
6
|
+
|
7
|
+
<%= language %>:
|
8
|
+
task:
|
9
|
+
<%= file_name_table %>:
|
10
|
+
|
11
|
+
# Methods
|
12
|
+
#--------------------------------------------------
|
13
|
+
methods:
|
14
|
+
todo: "TODO"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- bin/setup
|
130
130
|
- lib/active_generator.rb
|
131
131
|
- lib/active_generator/base.rb
|
132
|
+
- lib/active_generator/configuration.rb
|
132
133
|
- lib/active_generator/version.rb
|
133
134
|
- lib/generators/environment/USAGE
|
134
135
|
- lib/generators/environment/environment_generator.rb
|
@@ -146,6 +147,9 @@ files:
|
|
146
147
|
- lib/generators/locale/helper/USAGE
|
147
148
|
- lib/generators/locale/helper/helper_generator.rb
|
148
149
|
- lib/generators/locale/helper/templates/helper.yml
|
150
|
+
- lib/generators/locale/jbuilder/USAGE
|
151
|
+
- lib/generators/locale/jbuilder/jbuilder_generator.rb
|
152
|
+
- lib/generators/locale/jbuilder/templates/jbuilder.yml
|
149
153
|
- lib/generators/locale/job/USAGE
|
150
154
|
- lib/generators/locale/job/job_generator.rb
|
151
155
|
- lib/generators/locale/job/templates/job.yml
|
@@ -155,9 +159,15 @@ files:
|
|
155
159
|
- lib/generators/locale/model/USAGE
|
156
160
|
- lib/generators/locale/model/model_generator.rb
|
157
161
|
- lib/generators/locale/model/templates/model.yml
|
162
|
+
- lib/generators/locale/responders_controller/USAGE
|
163
|
+
- lib/generators/locale/responders_controller/responders_controller_generator.rb
|
164
|
+
- lib/generators/locale/responders_controller/templates/responders_controller.yml
|
158
165
|
- lib/generators/locale/service/USAGE
|
159
166
|
- lib/generators/locale/service/service_generator.rb
|
160
167
|
- lib/generators/locale/service/templates/service.yml
|
168
|
+
- lib/generators/locale/task/USAGE
|
169
|
+
- lib/generators/locale/task/task_generator.rb
|
170
|
+
- lib/generators/locale/task/templates/task.yml
|
161
171
|
- lib/generators/locale/uploader/USAGE
|
162
172
|
- lib/generators/locale/uploader/templates/uploader.yml
|
163
173
|
- lib/generators/locale/uploader/uploader_generator.rb
|