active_generator 2.4.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -1
- data/.gitignore +1 -1
- data/.rspec +1 -1
- data/.travis.yml +1 -1
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +2 -2
- data/README.md +7 -5
- data/Rakefile +1 -1
- data/active_generator.gemspec +14 -15
- data/bin/console +1 -1
- data/bin/rake +6 -6
- data/bin/setup +1 -1
- data/lib/active_generator.rb +1 -2
- data/lib/active_generator/base.rb +7 -7
- data/lib/active_generator/configuration.rb +9 -9
- data/lib/active_generator/version.rb +2 -2
- data/lib/generators/active_generator/install/install_generator.rb +3 -3
- data/lib/generators/active_generator/install/templates/install.rb +9 -9
- data/lib/generators/environment/environment_generator.rb +4 -4
- data/lib/generators/environment/templates/environment.rb +1 -1
- data/lib/generators/initializer/initializer_generator.rb +3 -3
- data/lib/generators/initializer/templates/initializer.rb +1 -1
- data/lib/generators/locale/api/api_generator.rb +6 -6
- data/lib/generators/locale/api/templates/api.yml +1 -1
- data/lib/generators/locale/base.rb +1 -1
- data/lib/generators/locale/controller/controller_generator.rb +6 -6
- data/lib/generators/locale/controller/templates/controller.yml +1 -1
- data/lib/generators/locale/helper/helper_generator.rb +6 -6
- data/lib/generators/locale/helper/templates/helper.yml +1 -1
- data/lib/generators/locale/job/job_generator.rb +6 -6
- data/lib/generators/locale/job/templates/job.yml +1 -1
- data/lib/generators/locale/mailer/mailer_generator.rb +6 -6
- data/lib/generators/locale/mailer/templates/mailer.yml +1 -1
- data/lib/generators/locale/model/model_generator.rb +6 -6
- data/lib/generators/locale/model/templates/model.yml +1 -1
- data/lib/generators/locale/service/service_generator.rb +6 -6
- data/lib/generators/locale/service/templates/service.yml +1 -1
- data/lib/generators/locale/task/task_generator.rb +6 -6
- data/lib/generators/locale/task/templates/task.yml +1 -1
- data/lib/generators/locale/uploader/templates/uploader.yml +1 -1
- data/lib/generators/locale/uploader/uploader_generator.rb +6 -6
- data/lib/generators/locale/view/templates/view.yml +1 -1
- data/lib/generators/locale/view/view_generator.rb +6 -6
- data/lib/generators/rails/controller_generator.rb +5 -5
- data/lib/generators/rails/helper_generator.rb +3 -3
- data/lib/generators/rails/job_generator.rb +3 -3
- data/lib/generators/rails/mailer_generator.rb +5 -5
- data/lib/generators/rails/model_generator.rb +3 -3
- data/lib/generators/rails/scaffold_generator.rb +3 -3
- data/lib/generators/rails/task_generator.rb +3 -3
- data/lib/generators/service/service_generator.rb +4 -4
- data/lib/generators/service/templates/service.rb +1 -1
- data/lib/generators/view/templates/view.html.erb +1 -1
- data/lib/generators/view/view_generator.rb +7 -7
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44de9f0654eceba8035b7f78df2c501840f62507
|
4
|
+
data.tar.gz: 9e6e28cd6386142bdae69d01f6d61b1beb67fec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00c3c9d3aa43397d8fedca75dbef24c67ea0288d0ac4e249c0dc6fbac85c4b31935055407255638f342ee53523fa3f636a2fb5824db9d14f3f32b3142141fa0a
|
7
|
+
data.tar.gz: 7d5b9c97f1de258cf0ab1430d31ce0a5d4fbb2fb0083db1153a4b256293ec718241e992971701e48ece81988ceaa88bef3a51e5ed54d0c032bc0c79b08a61f8f
|
data/.coveralls.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
service_name: travis-ci
|
1
|
+
service_name: travis-ci
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
CHANGED
data/CODE_OF_CONDUCT.md
CHANGED
@@ -10,4 +10,4 @@ Project maintainers have the right and responsibility to remove, edit, or reject
|
|
10
10
|
|
11
11
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
12
|
|
13
|
-
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/active_generator.svg)](http://badge.fury.io/rb/active_generator)
|
4
4
|
[![Build Status](https://travis-ci.org/drexed/active_generator.svg?branch=master)](https://travis-ci.org/drexed/active_generator)
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/drexed/active_generator/badge.
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/github/drexed/active_generator/badge.svg?branch=master)](https://coveralls.io/github/drexed/active_generator?branch=master)
|
6
6
|
|
7
7
|
ActiveGenerator extends the base rails generators with commonly used generators.
|
8
8
|
|
@@ -11,7 +11,7 @@ ActiveGenerator extends the base rails generators with commonly used generators.
|
|
11
11
|
Add this line to your application's Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem
|
14
|
+
gem "active_generator"
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
@@ -175,8 +175,10 @@ Generates an view file in the `app/views` directory.
|
|
175
175
|
|
176
176
|
## Contributing
|
177
177
|
|
178
|
-
|
178
|
+
Your contribution is welcome.
|
179
|
+
|
180
|
+
1. Fork it
|
179
181
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
180
|
-
3. Commit your changes (`git commit -am '
|
182
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
181
183
|
4. Push to the branch (`git push origin my-new-feature`)
|
182
|
-
5. Create
|
184
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
data/active_generator.gemspec
CHANGED
@@ -1,30 +1,29 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "active_generator/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
7
|
+
spec.name = "active_generator"
|
8
|
+
spec.version = ActiveGenerator::VERSION
|
9
|
+
spec.authors = ["Juan Gomez"]
|
10
|
+
spec.email = ["j.gomez@drexed.com"]
|
11
11
|
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
12
|
+
spec.summary = %q{Gem for commonly used generators.}
|
13
|
+
spec.description = %q{Extend the base rails generators with commonly used generators.}
|
14
|
+
spec.homepage = "http://drexed.github.io/active_generator"
|
15
|
+
spec.license = "MIT"
|
16
16
|
|
17
|
-
spec.files
|
18
|
-
spec.bindir
|
19
|
-
spec.executables
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_runtime_dependency "rails"
|
23
|
-
spec.add_runtime_dependency "active_object"
|
24
23
|
|
25
24
|
spec.add_development_dependency "bundler"
|
26
25
|
spec.add_development_dependency "coveralls"
|
27
26
|
spec.add_development_dependency "rake"
|
28
27
|
spec.add_development_dependency "rspec"
|
29
28
|
spec.add_development_dependency "generator_spec"
|
30
|
-
end
|
29
|
+
end
|
data/bin/console
CHANGED
data/bin/rake
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
#
|
3
3
|
# This file was generated by Bundler.
|
4
4
|
#
|
5
|
-
# The application
|
5
|
+
# The application "rake" is installed as part of a gem, and
|
6
6
|
# this file is here to facilitate running it.
|
7
7
|
#
|
8
8
|
|
9
|
-
require
|
10
|
-
ENV[
|
9
|
+
require "pathname"
|
10
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
11
|
Pathname.new(__FILE__).realpath)
|
12
12
|
|
13
|
-
require
|
14
|
-
require
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler/setup"
|
15
15
|
|
16
|
-
load Gem.bin_path(
|
16
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/setup
CHANGED
data/lib/active_generator.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "rails/generators"
|
2
2
|
|
3
|
-
require "active_object"
|
4
3
|
require "active_generator/version"
|
5
4
|
require "active_generator/configuration"
|
6
5
|
|
@@ -36,4 +35,4 @@ end
|
|
36
35
|
|
37
36
|
%w(controller helper job mailer model scaffold task).each do |generator_name|
|
38
37
|
require "generators/rails/#{generator_name}_generator"
|
39
|
-
end
|
38
|
+
end
|
@@ -8,28 +8,28 @@ module ActiveGenerator
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def file_name_human
|
11
|
-
file_name_table.gsub(
|
11
|
+
file_name_table.gsub("_".freeze, " ".freeze).downcase.capitalize
|
12
12
|
end
|
13
13
|
|
14
14
|
def namespace
|
15
|
-
name.downcase.split(
|
15
|
+
name.downcase.split("/".freeze)[0...-1]
|
16
16
|
end
|
17
17
|
|
18
18
|
def namespaced?
|
19
|
-
name.include?(
|
19
|
+
name.include?("/".freeze)
|
20
20
|
end
|
21
21
|
|
22
22
|
def namespace_human
|
23
|
-
namespace.join(
|
23
|
+
namespace.join(" ".freeze).gsub("_".freeze, " ".freeze).downcase.capitalize
|
24
24
|
end
|
25
25
|
|
26
26
|
def namespace_table
|
27
|
-
namespace.join(
|
27
|
+
namespace.join("_".freeze)
|
28
28
|
end
|
29
29
|
|
30
30
|
def namespace_path
|
31
|
-
namespace.join(
|
31
|
+
namespace.join("/".freeze)
|
32
32
|
end
|
33
33
|
|
34
34
|
end
|
35
|
-
end
|
35
|
+
end
|
@@ -12,14 +12,14 @@ class ActiveGenerator::Configuration
|
|
12
12
|
|
13
13
|
def initialize
|
14
14
|
@autoload_controller_generator_locale = true
|
15
|
-
@autoload_helper_generator_locale
|
16
|
-
@autoload_job_generator_locale
|
17
|
-
@autoload_mailer_generator_locale
|
18
|
-
@autoload_model_generator_locale
|
19
|
-
@autoload_service_generator_locale
|
20
|
-
@autoload_task_generator_locale
|
21
|
-
@autoload_view_generator_locale
|
22
|
-
@test_framework
|
15
|
+
@autoload_helper_generator_locale = true
|
16
|
+
@autoload_job_generator_locale = true
|
17
|
+
@autoload_mailer_generator_locale = true
|
18
|
+
@autoload_model_generator_locale = true
|
19
|
+
@autoload_service_generator_locale = true
|
20
|
+
@autoload_task_generator_locale = true
|
21
|
+
@autoload_view_generator_locale = true
|
22
|
+
@test_framework = "test_unit"
|
23
23
|
end
|
24
24
|
|
25
|
-
end
|
25
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module ActiveGenerator
|
2
|
-
VERSION = "
|
3
|
-
end
|
2
|
+
VERSION = "3.0.0"
|
3
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module ActiveGenerator
|
2
2
|
class InstallGenerator < Rails::Generators::Base
|
3
|
-
source_root File.expand_path(
|
3
|
+
source_root File.expand_path("../templates", __FILE__)
|
4
4
|
|
5
5
|
def copy_initializer_file
|
6
|
-
copy_file(
|
6
|
+
copy_file("install.rb", "config/initializers/active_generator.rb")
|
7
7
|
end
|
8
8
|
|
9
9
|
end
|
10
|
-
end
|
10
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
ActiveGenerator.configure do |config|
|
2
2
|
config.autoload_controller_generator_locale = true
|
3
|
-
config.autoload_helper_generator_locale
|
4
|
-
config.autoload_job_generator_locale
|
5
|
-
config.autoload_mailer_generator_locale
|
6
|
-
config.autoload_model_generator_locale
|
7
|
-
config.autoload_service_generator_locale
|
8
|
-
config.autoload_task_generator_locale
|
9
|
-
config.autoload_view_generator_locale
|
10
|
-
config.test_framework
|
11
|
-
end
|
3
|
+
config.autoload_helper_generator_locale = true
|
4
|
+
config.autoload_job_generator_locale = true
|
5
|
+
config.autoload_mailer_generator_locale = true
|
6
|
+
config.autoload_model_generator_locale = true
|
7
|
+
config.autoload_service_generator_locale = true
|
8
|
+
config.autoload_task_generator_locale = true
|
9
|
+
config.autoload_view_generator_locale = true
|
10
|
+
config.test_framework = "test_unit"
|
11
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class EnvironmentGenerator < Rails::Generators::NamedBase
|
2
|
-
source_root File.expand_path(
|
3
|
-
argument :environment, type: :string, required: false, default: nil, desc:
|
2
|
+
source_root File.expand_path("../templates", __FILE__)
|
3
|
+
argument :environment, type: :string, required: false, default: nil, desc: "The environment template to copy"
|
4
4
|
|
5
5
|
def create_environment_file
|
6
6
|
assert_valid_environment!
|
7
|
-
template(
|
7
|
+
template("environment.rb", File.join("config/environments", class_path, "#{file_name}.rb"))
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
@@ -24,4 +24,4 @@ class EnvironmentGenerator < Rails::Generators::NamedBase
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
end
|
27
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class InitializerGenerator < Rails::Generators::NamedBase
|
2
|
-
source_root File.expand_path(
|
2
|
+
source_root File.expand_path("../templates", __FILE__)
|
3
3
|
|
4
4
|
def copy_initializer_file
|
5
|
-
copy_file(
|
5
|
+
copy_file("initializer.rb", File.join("config/initializers", class_path, "#{file_name}.rb"))
|
6
6
|
end
|
7
7
|
|
8
|
-
end
|
8
|
+
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
# TODO:
|
2
|
-
# Add initializer code here.
|
2
|
+
# Add initializer code here.
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
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(
|
10
|
-
argument :language, type: :string, required: false, default:
|
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(
|
14
|
+
template("api.yml", File.join("config/locales/#{language}/apis", namespace_path, "#{file_name}.yml"))
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
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(
|
10
|
-
argument :language, type: :string, required: false, default:
|
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(
|
14
|
+
template("controller.yml", File.join("config/locales/#{language}/controllers", namespace_path, "#{file_name}.yml"))
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
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(
|
10
|
-
argument :language, type: :string, required: false, default:
|
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(
|
14
|
+
template("helper.yml", File.join("config/locales/#{language}/helpers", namespace_path, "#{file_name}.yml"))
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
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(
|
10
|
-
argument :language, type: :string, required: false, default:
|
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(
|
14
|
+
template("job.yml", File.join("config/locales/#{language}/jobs", namespace_path, "#{file_name}.yml"))
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
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(
|
10
|
-
argument :language, type: :string, required: false, default:
|
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(
|
14
|
+
template("mailer.yml", File.join("config/locales/#{language}/mailers", namespace_path, "#{file_name}.yml"))
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
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(
|
10
|
-
argument :language, type: :string, required: false, default:
|
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(
|
14
|
+
template("model.yml", File.join("config/locales/#{language}/models", namespace_path, "#{file_name}.yml"))
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
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(
|
10
|
-
argument :language, type: :string, required: false, default:
|
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(
|
14
|
+
template("service.yml", File.join("config/locales/#{language}/services", namespace_path, "#{file_name}.yml"))
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
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(
|
10
|
-
argument :language, type: :string, required: false, default:
|
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(
|
14
|
+
template("task.yml", File.join("config/locales/#{language}/tasks", namespace_path, "#{file_name}.yml"))
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
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(
|
10
|
-
argument :language, type: :string, required: false, default:
|
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(
|
14
|
+
template("uploader.yml", File.join("config/locales/#{language}/uploaders", namespace_path, "#{file_name}.yml"))
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
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(
|
10
|
-
argument :language, type: :string, required: false, default:
|
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(
|
14
|
+
template("view.yml", File.join("config/locales/#{language}/views", namespace_path, "#{file_name}.yml"))
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rails/generators/erb/controller/controller_generator"
|
2
|
+
require "rails/generators/rails/controller/controller_generator"
|
3
3
|
|
4
4
|
module Erb
|
5
5
|
module Generators
|
6
6
|
class ControllerGenerator
|
7
7
|
|
8
8
|
def generate_locale_file
|
9
|
-
invoke(
|
9
|
+
invoke("locale:view", [name]) if ActiveGenerator.configuration.autoload_view_generator_locale
|
10
10
|
end
|
11
11
|
|
12
12
|
def generate_test_file
|
@@ -24,7 +24,7 @@ module Rails
|
|
24
24
|
class ControllerGenerator
|
25
25
|
|
26
26
|
def generate_locale_file
|
27
|
-
invoke(
|
27
|
+
invoke("locale:controller", [name]) if ActiveGenerator.configuration.autoload_controller_generator_locale
|
28
28
|
end
|
29
29
|
|
30
30
|
def generate_test_file
|
@@ -35,4 +35,4 @@ module Rails
|
|
35
35
|
|
36
36
|
end
|
37
37
|
end
|
38
|
-
end
|
38
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require "rails/generators/rails/helper/helper_generator"
|
2
2
|
|
3
3
|
module Rails
|
4
4
|
module Generators
|
5
5
|
class HelperGenerator
|
6
6
|
|
7
7
|
def generate_locale_file
|
8
|
-
invoke(
|
8
|
+
invoke("locale:helper", [name]) if ActiveGenerator.configuration.autoload_helper_generator_locale
|
9
9
|
end
|
10
10
|
|
11
11
|
def generate_test_file
|
@@ -16,4 +16,4 @@ module Rails
|
|
16
16
|
|
17
17
|
end
|
18
18
|
end
|
19
|
-
end
|
19
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require "rails/generators/job/job_generator"
|
2
2
|
|
3
3
|
module Rails
|
4
4
|
module Generators
|
5
5
|
class JobGenerator
|
6
6
|
|
7
7
|
def generate_locale_file
|
8
|
-
invoke(
|
8
|
+
invoke("locale:job", [name]) if ActiveGenerator.configuration.autoload_job_generator_locale
|
9
9
|
end
|
10
10
|
|
11
11
|
def generate_test_file
|
@@ -16,4 +16,4 @@ module Rails
|
|
16
16
|
|
17
17
|
end
|
18
18
|
end
|
19
|
-
end
|
19
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rails/generators/erb/mailer/mailer_generator"
|
2
|
+
require "rails/generators/mailer/mailer_generator"
|
3
3
|
|
4
4
|
module Erb
|
5
5
|
module Generators
|
6
6
|
class MailerGenerator
|
7
7
|
|
8
8
|
def generate_locale_file
|
9
|
-
invoke(
|
9
|
+
invoke("locale:view", [name]) if ActiveGenerator.configuration.autoload_view_generator_locale
|
10
10
|
end
|
11
11
|
|
12
12
|
def generate_test_file
|
@@ -24,7 +24,7 @@ module Rails
|
|
24
24
|
class MailerGenerator
|
25
25
|
|
26
26
|
def generate_locale_file
|
27
|
-
invoke(
|
27
|
+
invoke("locale:mailer", [name]) if ActiveGenerator.configuration.autoload_mailer_generator_locale
|
28
28
|
end
|
29
29
|
|
30
30
|
def generate_test_file
|
@@ -35,4 +35,4 @@ module Rails
|
|
35
35
|
|
36
36
|
end
|
37
37
|
end
|
38
|
-
end
|
38
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "rails/generators/active_record/model/model_generator"
|
2
2
|
|
3
3
|
module ActiveRecord
|
4
4
|
module Generators
|
@@ -11,7 +11,7 @@ module ActiveRecord
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def generate_locale_file
|
14
|
-
invoke(
|
14
|
+
invoke("locale:model", [name]) if ActiveGenerator.configuration.autoload_model_generator_locale
|
15
15
|
end
|
16
16
|
|
17
17
|
def generate_test_file
|
@@ -22,4 +22,4 @@ module ActiveRecord
|
|
22
22
|
|
23
23
|
end
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require "rails/generators/erb/scaffold/scaffold_generator"
|
2
2
|
|
3
3
|
module Erb
|
4
4
|
module Generators
|
5
5
|
class ScaffoldGenerator
|
6
6
|
|
7
7
|
def generate_locale_file
|
8
|
-
invoke(
|
8
|
+
invoke("locale:view", [name]) if ActiveGenerator.configuration.autoload_view_generator_locale
|
9
9
|
end
|
10
10
|
|
11
11
|
def generate_test_file
|
@@ -16,4 +16,4 @@ module Erb
|
|
16
16
|
|
17
17
|
end
|
18
18
|
end
|
19
|
-
end
|
19
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
1
|
+
require "rails/generators/rails/task/task_generator"
|
2
2
|
|
3
3
|
module Rails
|
4
4
|
module Generators
|
5
5
|
class TaskGenerator
|
6
6
|
|
7
7
|
def generate_locale_file
|
8
|
-
invoke(
|
8
|
+
invoke("locale:task", [name]) if ActiveGenerator.configuration.autoload_task_generator_locale
|
9
9
|
end
|
10
10
|
|
11
11
|
end
|
12
12
|
end
|
13
|
-
end
|
13
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class ServiceGenerator < Rails::Generators::NamedBase
|
2
|
-
source_root File.expand_path(
|
2
|
+
source_root File.expand_path("../templates", __FILE__)
|
3
3
|
|
4
4
|
def create_service_file
|
5
|
-
template(
|
5
|
+
template("service.rb", File.join("app/services", class_path, "#{file_name}.rb"))
|
6
6
|
end
|
7
7
|
|
8
8
|
def generate_locale_file
|
9
|
-
invoke(
|
9
|
+
invoke("locale:service", [name]) if ActiveGenerator.configuration.autoload_service_generator_locale
|
10
10
|
end
|
11
11
|
|
12
|
-
end
|
12
|
+
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<!-- TODO: -->
|
2
|
-
<!-- Add view code here. -->
|
2
|
+
<!-- Add view code here. -->
|
@@ -1,23 +1,23 @@
|
|
1
|
-
require
|
1
|
+
require "fileutils"
|
2
2
|
|
3
3
|
class ViewGenerator < Rails::Generators::NamedBase
|
4
|
-
source_root File.expand_path(
|
5
|
-
argument :actions, type: :array, required: false, default: [], desc:
|
4
|
+
source_root File.expand_path("../templates", __FILE__)
|
5
|
+
argument :actions, type: :array, required: false, default: [], desc: "The pages to generate"
|
6
6
|
|
7
7
|
def create_root_directory
|
8
|
-
empty_directory(File.join(
|
8
|
+
empty_directory(File.join("app/views", file_name)) if actions.empty?
|
9
9
|
end
|
10
10
|
|
11
11
|
def create_view_file
|
12
12
|
unless actions.empty?
|
13
13
|
actions.each do |filename|
|
14
|
-
template(
|
14
|
+
template("view.html.erb", File.join("app/views", class_path, file_name, "#{filename}.html.erb"))
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def generate_locale_file
|
20
|
-
invoke(
|
20
|
+
invoke("locale:view", [name]) if ActiveGenerator.configuration.autoload_view_generator_locale
|
21
21
|
end
|
22
22
|
|
23
23
|
def generate_test_file
|
@@ -26,4 +26,4 @@ class ViewGenerator < Rails::Generators::NamedBase
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
end
|
29
|
+
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
|
+
version: 3.0.0
|
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-
|
11
|
+
date: 2016-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: active_object
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: bundler
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,7 +169,7 @@ files:
|
|
183
169
|
- lib/generators/view/USAGE
|
184
170
|
- lib/generators/view/templates/view.html.erb
|
185
171
|
- lib/generators/view/view_generator.rb
|
186
|
-
homepage:
|
172
|
+
homepage: http://drexed.github.io/active_generator
|
187
173
|
licenses:
|
188
174
|
- MIT
|
189
175
|
metadata: {}
|
@@ -203,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
189
|
version: '0'
|
204
190
|
requirements: []
|
205
191
|
rubyforge_project:
|
206
|
-
rubygems_version: 2.
|
192
|
+
rubygems_version: 2.6.4
|
207
193
|
signing_key:
|
208
194
|
specification_version: 4
|
209
195
|
summary: Gem for commonly used generators.
|