active_generator 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.fasterer.yml +19 -0
  3. data/.flayignore +2 -0
  4. data/.reek +20 -0
  5. data/.rubocop.yml +37 -0
  6. data/Gemfile +1 -1
  7. data/README.md +12 -24
  8. data/Rakefile +1 -1
  9. data/active_generator.gemspec +21 -17
  10. data/bin/console +4 -4
  11. data/bin/rake +6 -7
  12. data/lib/active_generator.rb +4 -28
  13. data/lib/active_generator/base.rb +6 -6
  14. data/lib/active_generator/settings.rb +18 -0
  15. data/lib/active_generator/version.rb +1 -1
  16. data/lib/generators/active_generator/install/install_generator.rb +2 -2
  17. data/lib/generators/active_generator/install/templates/install.rb +2 -2
  18. data/lib/generators/environment/environment_generator.rb +5 -5
  19. data/lib/generators/initializer/initializer_generator.rb +2 -2
  20. data/lib/generators/locale/api/api_generator.rb +5 -5
  21. data/lib/generators/locale/api/templates/api.yml +2 -2
  22. data/lib/generators/locale/base.rb +1 -1
  23. data/lib/generators/locale/controller/controller_generator.rb +6 -5
  24. data/lib/generators/locale/controller/templates/controller.yml +4 -4
  25. data/lib/generators/locale/helper/helper_generator.rb +5 -5
  26. data/lib/generators/locale/helper/templates/helper.yml +2 -2
  27. data/lib/generators/locale/job/job_generator.rb +5 -5
  28. data/lib/generators/locale/job/templates/job.yml +2 -2
  29. data/lib/generators/locale/mailer/mailer_generator.rb +5 -5
  30. data/lib/generators/locale/mailer/templates/mailer.yml +2 -2
  31. data/lib/generators/locale/model/model_generator.rb +5 -5
  32. data/lib/generators/locale/model/templates/model.yml +4 -4
  33. data/lib/generators/locale/service/service_generator.rb +5 -5
  34. data/lib/generators/locale/service/templates/service.yml +2 -2
  35. data/lib/generators/locale/task/task_generator.rb +5 -5
  36. data/lib/generators/locale/task/templates/task.yml +2 -2
  37. data/lib/generators/locale/uploader/templates/uploader.yml +2 -2
  38. data/lib/generators/locale/uploader/uploader_generator.rb +5 -5
  39. data/lib/generators/locale/view/templates/view.yml +4 -4
  40. data/lib/generators/locale/view/view_generator.rb +5 -5
  41. data/lib/generators/rails/base.rb +11 -0
  42. data/lib/generators/rails/controller_generator.rb +15 -10
  43. data/lib/generators/rails/helper_generator.rb +8 -5
  44. data/lib/generators/rails/job_generator.rb +8 -5
  45. data/lib/generators/rails/mailer_generator.rb +15 -10
  46. data/lib/generators/rails/model_generator.rb +14 -7
  47. data/lib/generators/rails/scaffold_generator.rb +8 -5
  48. data/lib/generators/rails/task_generator.rb +2 -2
  49. data/lib/generators/service/service_generator.rb +3 -3
  50. data/lib/generators/view/view_generator.rb +16 -9
  51. metadata +64 -3
  52. data/lib/active_generator/configuration.rb +0 -25
@@ -1,17 +1,17 @@
1
- require "active_generator/base"
2
- require "generators/locale/base"
1
+ require 'active_generator/base'
2
+ require 'generators/locale/base'
3
3
 
4
4
  module Locale
5
5
  class ApiGenerator < Rails::Generators::NamedBase
6
6
  include ActiveGenerator::Base
7
7
  include Locale::Base
8
8
 
9
- source_root File.expand_path("../templates", __FILE__)
10
- argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
9
+ source_root File.expand_path('../templates', __FILE__)
10
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
11
 
12
12
  def create_api_file
13
13
  assert_valid_language!
14
- template("api.yml", File.join("config/locales/#{language}/apis", namespace_path, "#{file_name}.yml"))
14
+ template('api.yml', File.join("config/locales/#{language}/apis", namespace_path, "#{file_name}.yml"))
15
15
  end
16
16
 
17
17
  end
@@ -19,7 +19,7 @@
19
19
 
20
20
  # TODO
21
21
  #--------------------------------------------------
22
- todo: "TODO"
22
+ todo: 'TODO'
23
23
  <% else -%>
24
24
  # <%= file_name_human %>
25
25
  # Methods
@@ -36,5 +36,5 @@
36
36
 
37
37
  # TODO
38
38
  #--------------------------------------------------
39
- todo: "TODO"
39
+ todo: 'TODO'
40
40
  <% end -%>
@@ -6,7 +6,7 @@ module Locale
6
6
  def assert_valid_language!
7
7
  unless [2, 4, 5, 6].include?(language.size) && (language =~ /^[A-Za-z-]+$/)
8
8
  raise ArgumentError,
9
- "Unknown language format: #{language.inspect}. Valid format example is: 'en'"
9
+ "Unknown language format: #{language.inspect}. Valid format example is: 'en'"
10
10
  end
11
11
  end
12
12
 
@@ -1,17 +1,18 @@
1
- require "active_generator/base"
2
- require "generators/locale/base"
1
+ require 'active_generator/base'
2
+ require 'generators/locale/base'
3
3
 
4
4
  module Locale
5
5
  class ControllerGenerator < Rails::Generators::NamedBase
6
6
  include ActiveGenerator::Base
7
7
  include Locale::Base
8
8
 
9
- source_root File.expand_path("../templates", __FILE__)
10
- argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
9
+ source_root File.expand_path('../templates', __FILE__)
10
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
11
 
12
12
  def create_controller_file
13
13
  assert_valid_language!
14
- template("controller.yml", File.join("config/locales/#{language}/controllers", namespace_path, "#{file_name}.yml"))
14
+ template('controller.yml',
15
+ File.join("config/locales/#{language}/controllers", namespace_path, "#{file_name}.yml"))
15
16
  end
16
17
 
17
18
  end
@@ -21,7 +21,7 @@
21
21
 
22
22
  # TODO
23
23
  #--------------------------------------------------
24
- todo: "TODO"
24
+ todo: 'TODO'
25
25
 
26
26
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27
27
  # Methods
@@ -30,7 +30,7 @@
30
30
 
31
31
  # TODO
32
32
  #--------------------------------------------------
33
- todo: "TODO"
33
+ todo: 'TODO'
34
34
  <% else -%>
35
35
  # <%= file_name_human %>
36
36
  # Actions
@@ -49,7 +49,7 @@
49
49
 
50
50
  # TODO
51
51
  #--------------------------------------------------
52
- todo: "TODO"
52
+ todo: 'TODO'
53
53
 
54
54
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55
55
  # Methods
@@ -58,5 +58,5 @@
58
58
 
59
59
  # TODO
60
60
  #--------------------------------------------------
61
- todo: "TODO"
61
+ todo: 'TODO'
62
62
  <% end -%>
@@ -1,17 +1,17 @@
1
- require "active_generator/base"
2
- require "generators/locale/base"
1
+ require 'active_generator/base'
2
+ require 'generators/locale/base'
3
3
 
4
4
  module Locale
5
5
  class HelperGenerator < Rails::Generators::NamedBase
6
6
  include ActiveGenerator::Base
7
7
  include Locale::Base
8
8
 
9
- source_root File.expand_path("../templates", __FILE__)
10
- argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
9
+ source_root File.expand_path('../templates', __FILE__)
10
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
11
 
12
12
  def create_helper_file
13
13
  assert_valid_language!
14
- template("helper.yml", File.join("config/locales/#{language}/helpers", namespace_path, "#{file_name}.yml"))
14
+ template('helper.yml', File.join("config/locales/#{language}/helpers", namespace_path, "#{file_name}.yml"))
15
15
  end
16
16
 
17
17
  end
@@ -19,7 +19,7 @@
19
19
 
20
20
  # TODO
21
21
  #--------------------------------------------------
22
- todo: "TODO"
22
+ todo: 'TODO'
23
23
  <% else -%>
24
24
  # <%= file_name_human %>
25
25
  # Methods
@@ -36,5 +36,5 @@
36
36
 
37
37
  # TODO
38
38
  #--------------------------------------------------
39
- todo: "TODO"
39
+ todo: 'TODO'
40
40
  <% end -%>
@@ -1,17 +1,17 @@
1
- require "active_generator/base"
2
- require "generators/locale/base"
1
+ require 'active_generator/base'
2
+ require 'generators/locale/base'
3
3
 
4
4
  module Locale
5
5
  class JobGenerator < Rails::Generators::NamedBase
6
6
  include ActiveGenerator::Base
7
7
  include Locale::Base
8
8
 
9
- source_root File.expand_path("../templates", __FILE__)
10
- argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
9
+ source_root File.expand_path('../templates', __FILE__)
10
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
11
 
12
12
  def create_job_file
13
13
  assert_valid_language!
14
- template("job.yml", File.join("config/locales/#{language}/jobs", namespace_path, "#{file_name}.yml"))
14
+ template('job.yml', File.join("config/locales/#{language}/jobs", namespace_path, "#{file_name}.yml"))
15
15
  end
16
16
 
17
17
  end
@@ -19,7 +19,7 @@
19
19
 
20
20
  # TODO
21
21
  #--------------------------------------------------
22
- todo: "TODO"
22
+ todo: 'TODO'
23
23
  <% else -%>
24
24
  # <%= file_name_human %>
25
25
  # Methods
@@ -36,5 +36,5 @@
36
36
 
37
37
  # TODO
38
38
  #--------------------------------------------------
39
- todo: "TODO"
39
+ todo: 'TODO'
40
40
  <% end -%>
@@ -1,17 +1,17 @@
1
- require "active_generator/base"
2
- require "generators/locale/base"
1
+ require 'active_generator/base'
2
+ require 'generators/locale/base'
3
3
 
4
4
  module Locale
5
5
  class MailerGenerator < Rails::Generators::NamedBase
6
6
  include ActiveGenerator::Base
7
7
  include Locale::Base
8
8
 
9
- source_root File.expand_path("../templates", __FILE__)
10
- argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
9
+ source_root File.expand_path('../templates', __FILE__)
10
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
11
 
12
12
  def create_mailer_file
13
13
  assert_valid_language!
14
- template("mailer.yml", File.join("config/locales/#{language}/mailers", namespace_path, "#{file_name}.yml"))
14
+ template('mailer.yml', File.join("config/locales/#{language}/mailers", namespace_path, "#{file_name}.yml"))
15
15
  end
16
16
 
17
17
  end
@@ -19,7 +19,7 @@
19
19
 
20
20
  # TODO
21
21
  #--------------------------------------------------
22
- todo: "TODO"
22
+ todo: 'TODO'
23
23
  <% else -%>
24
24
  # <%= file_name_human %>
25
25
  # Methods
@@ -36,5 +36,5 @@
36
36
 
37
37
  # TODO
38
38
  #--------------------------------------------------
39
- todo: "TODO"
39
+ todo: 'TODO'
40
40
  <% end -%>
@@ -1,17 +1,17 @@
1
- require "active_generator/base"
2
- require "generators/locale/base"
1
+ require 'active_generator/base'
2
+ require 'generators/locale/base'
3
3
 
4
4
  module Locale
5
5
  class ModelGenerator < Rails::Generators::NamedBase
6
6
  include ActiveGenerator::Base
7
7
  include Locale::Base
8
8
 
9
- source_root File.expand_path("../templates", __FILE__)
10
- argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
9
+ source_root File.expand_path('../templates', __FILE__)
10
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
11
 
12
12
  def create_model_file
13
13
  assert_valid_language!
14
- template("model.yml", File.join("config/locales/#{language}/models", namespace_path, "#{file_name}.yml"))
14
+ template('model.yml', File.join("config/locales/#{language}/models", namespace_path, "#{file_name}.yml"))
15
15
  end
16
16
 
17
17
  end
@@ -17,7 +17,7 @@
17
17
  # Attributes
18
18
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19
19
  attr:
20
- todo: "TODO"
20
+ todo: 'TODO'
21
21
 
22
22
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
23
  # Methods
@@ -26,7 +26,7 @@
26
26
 
27
27
  # TODO
28
28
  #--------------------------------------------------
29
- todo: "TODO"
29
+ todo: 'TODO'
30
30
  <% else -%>
31
31
  # <%= file_name_human %>
32
32
  # Attributes
@@ -41,7 +41,7 @@
41
41
  # Attributes
42
42
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43
43
  attr:
44
- todo: "TODO"
44
+ todo: 'TODO'
45
45
 
46
46
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47
47
  # Methods
@@ -50,5 +50,5 @@
50
50
 
51
51
  # TODO
52
52
  #--------------------------------------------------
53
- todo: "TODO"
53
+ todo: 'TODO'
54
54
  <% end -%>
@@ -1,17 +1,17 @@
1
- require "active_generator/base"
2
- require "generators/locale/base"
1
+ require 'active_generator/base'
2
+ require 'generators/locale/base'
3
3
 
4
4
  module Locale
5
5
  class ServiceGenerator < Rails::Generators::NamedBase
6
6
  include ActiveGenerator::Base
7
7
  include Locale::Base
8
8
 
9
- source_root File.expand_path("../templates", __FILE__)
10
- argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
9
+ source_root File.expand_path('../templates', __FILE__)
10
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
11
 
12
12
  def create_service_file
13
13
  assert_valid_language!
14
- template("service.yml", File.join("config/locales/#{language}/services", namespace_path, "#{file_name}.yml"))
14
+ template('service.yml', File.join("config/locales/#{language}/services", namespace_path, "#{file_name}.yml"))
15
15
  end
16
16
 
17
17
  end
@@ -19,7 +19,7 @@
19
19
 
20
20
  # TODO
21
21
  #--------------------------------------------------
22
- todo: "TODO"
22
+ todo: 'TODO'
23
23
  <% else -%>
24
24
  # <%= file_name_human %>
25
25
  # Methods
@@ -36,5 +36,5 @@
36
36
 
37
37
  # TODO
38
38
  #--------------------------------------------------
39
- todo: "TODO"
39
+ todo: 'TODO'
40
40
  <% end -%>
@@ -1,17 +1,17 @@
1
- require "active_generator/base"
2
- require "generators/locale/base"
1
+ require 'active_generator/base'
2
+ require 'generators/locale/base'
3
3
 
4
4
  module Locale
5
5
  class TaskGenerator < Rails::Generators::NamedBase
6
6
  include ActiveGenerator::Base
7
7
  include Locale::Base
8
8
 
9
- source_root File.expand_path("../templates", __FILE__)
10
- argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
9
+ source_root File.expand_path('../templates', __FILE__)
10
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
11
 
12
12
  def copy_task_file
13
13
  assert_valid_language!
14
- template("task.yml", File.join("config/locales/#{language}/tasks", namespace_path, "#{file_name}.yml"))
14
+ template('task.yml', File.join("config/locales/#{language}/tasks", namespace_path, "#{file_name}.yml"))
15
15
  end
16
16
 
17
17
  end
@@ -19,7 +19,7 @@
19
19
 
20
20
  # TODO
21
21
  #--------------------------------------------------
22
- todo: "TODO"
22
+ todo: 'TODO'
23
23
  <% else -%>
24
24
  # <%= file_name_human %>
25
25
  # Methods
@@ -36,5 +36,5 @@
36
36
 
37
37
  # TODO
38
38
  #--------------------------------------------------
39
- todo: "TODO"
39
+ todo: 'TODO'
40
40
  <% end -%>
@@ -19,7 +19,7 @@
19
19
 
20
20
  # TODO
21
21
  #--------------------------------------------------
22
- todo: "TODO"
22
+ todo: 'TODO'
23
23
  <% else -%>
24
24
  # <%= file_name_human %>
25
25
  # Methods
@@ -36,5 +36,5 @@
36
36
 
37
37
  # TODO
38
38
  #--------------------------------------------------
39
- todo: "TODO"
39
+ todo: 'TODO'
40
40
  <% end -%>
@@ -1,17 +1,17 @@
1
- require "active_generator/base"
2
- require "generators/locale/base"
1
+ require 'active_generator/base'
2
+ require 'generators/locale/base'
3
3
 
4
4
  module Locale
5
5
  class UploaderGenerator < Rails::Generators::NamedBase
6
6
  include ActiveGenerator::Base
7
7
  include Locale::Base
8
8
 
9
- source_root File.expand_path("../templates", __FILE__)
10
- argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
9
+ source_root File.expand_path('../templates', __FILE__)
10
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
11
 
12
12
  def create_uploader_file
13
13
  assert_valid_language!
14
- template("uploader.yml", File.join("config/locales/#{language}/uploaders", namespace_path, "#{file_name}.yml"))
14
+ template('uploader.yml', File.join("config/locales/#{language}/uploaders", namespace_path, "#{file_name}.yml"))
15
15
  end
16
16
 
17
17
  end
@@ -21,7 +21,7 @@
21
21
 
22
22
  # TODO
23
23
  #--------------------------------------------------
24
- todo: "TODO"
24
+ todo: 'TODO'
25
25
 
26
26
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27
27
  # Concenrs
@@ -30,7 +30,7 @@
30
30
 
31
31
  # TODO
32
32
  #--------------------------------------------------
33
- todo: "TODO"
33
+ todo: 'TODO'
34
34
  <% else -%>
35
35
  # <%= file_name_human %>
36
36
  # Actions
@@ -49,7 +49,7 @@
49
49
 
50
50
  # TODO
51
51
  #--------------------------------------------------
52
- todo: "TODO"
52
+ todo: 'TODO'
53
53
 
54
54
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55
55
  # Concenrs
@@ -58,5 +58,5 @@
58
58
 
59
59
  # TODO
60
60
  #--------------------------------------------------
61
- todo: "TODO"
61
+ todo: 'TODO'
62
62
  <% end -%>
@@ -1,17 +1,17 @@
1
- require "active_generator/base"
2
- require "generators/locale/base"
1
+ require 'active_generator/base'
2
+ require 'generators/locale/base'
3
3
 
4
4
  module Locale
5
5
  class ViewGenerator < Rails::Generators::NamedBase
6
6
  include ActiveGenerator::Base
7
7
  include Locale::Base
8
8
 
9
- source_root File.expand_path("../templates", __FILE__)
10
- argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code"
9
+ source_root File.expand_path('../templates', __FILE__)
10
+ argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'
11
11
 
12
12
  def create_view_file
13
13
  assert_valid_language!
14
- template("view.yml", File.join("config/locales/#{language}/views", namespace_path, "#{file_name}.yml"))
14
+ template('view.yml', File.join("config/locales/#{language}/views", namespace_path, "#{file_name}.yml"))
15
15
  end
16
16
 
17
17
  end