rhino_project_core 0.20.0.beta.79 → 0.20.0.beta.81
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/commands/rhino/module/coverage_command.rb +44 -0
- data/lib/commands/rhino/module/dummy_command.rb +43 -0
- data/lib/commands/rhino/module/new_command.rb +34 -0
- data/lib/commands/rhino/module/rails_command.rb +43 -0
- data/lib/commands/rhino/module/test_command.rb +43 -0
- data/lib/generators/rhino/module/USAGE +6 -0
- data/lib/generators/rhino/module/module_generator.rb +51 -64
- data/lib/generators/rhino/module/templates/%name%.gemspec.tt +24 -0
- data/lib/generators/rhino/module/templates/lib/%namespaced_name%/engine.rb.tt +17 -0
- data/lib/generators/rhino/module/templates/{install_generator.rb.tt → lib/generators/%namespaced_name%/install/install_generator.rb.tt} +1 -1
- data/lib/generators/rhino/module/templates/lib/tasks/%namespaced_name%_tasks.rake.tt +13 -0
- data/lib/generators/rhino/module/templates/test/dummy/app/models/user.rb +4 -0
- data/lib/generators/rhino/module/templates/test/dummy/config/database.yml +25 -0
- data/lib/generators/rhino/module/templates/test/dummy/config/initializers/devise.rb +311 -0
- data/lib/generators/rhino/module/templates/test/dummy/config/initializers/devise_token_auth.rb +71 -0
- data/lib/generators/rhino/module/templates/test/test_helper.rb +54 -0
- data/lib/rhino/version.rb +1 -1
- data/lib/tasks/rhino.rake +0 -14
- metadata +18 -7
- data/lib/commands/rhino_command.rb +0 -59
- data/lib/generators/rhino/module/templates/engine.rb.tt +0 -19
- data/lib/generators/rhino/module/templates/module_tasks.rake.tt +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7520f275c9fd07c84bf318a9988b67c800786abeba61f4f477625c27fb8ae8b2
|
4
|
+
data.tar.gz: 8c9fa7dd8c821453e5704ae12d8ed5dc8bac8719564d3567335fb84006e5c24b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a955a636c91c58bc12f3ec216f8262a92129960138518a48947e8aca791dc33700b29d85454f2aed24c6213a64e859d65ac0fd429777576e3947b941485c4d3e
|
7
|
+
data.tar.gz: 6f1c65fe43c9abd00f7594cfe9cb3ee246cb63de1aa2fb3a6c635dd89e00e6d42a60b83aaaaa7b6efcaf5f8af1afbd6c9e0fe817d89bfc2bc8ce879a289673aa
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dotenv"
|
4
|
+
require "rails/command"
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
module Command
|
8
|
+
module Rhino
|
9
|
+
module Module
|
10
|
+
class CoverageCommand < Base # :nodoc:
|
11
|
+
include Thor::Actions
|
12
|
+
|
13
|
+
def perform(*args)
|
14
|
+
ENV["COVERAGE"] = "1"
|
15
|
+
test(*args)
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
def rhino_command(extra_path, base_command, *args) # rubocop:todo Metrics/MethodLength
|
20
|
+
module_name = if Dir.exist?(args[0])
|
21
|
+
args.shift
|
22
|
+
else
|
23
|
+
abort "No module specified"
|
24
|
+
end
|
25
|
+
module_path = [module_name, extra_path].compact.join("/")
|
26
|
+
db_name = "#{module_name}_dummy"
|
27
|
+
gem_file_path = File.join(Dir.pwd, "Gemfile")
|
28
|
+
|
29
|
+
# Getting existing variables and re-use
|
30
|
+
::Dotenv.load
|
31
|
+
|
32
|
+
inside(module_path) do
|
33
|
+
# Override DB_NAME so multiple can run in parallel
|
34
|
+
run(
|
35
|
+
"DB_NAME=#{db_name} BUNDLE_GEMFILE='#{gem_file_path}' bin/rails #{base_command} #{args.join(' ')}",
|
36
|
+
{ abort_on_failure: true }
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dotenv"
|
4
|
+
require "rails/command"
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
module Command
|
8
|
+
module Rhino
|
9
|
+
module Module
|
10
|
+
class DummyCommand < Base # :nodoc:
|
11
|
+
include Thor::Actions
|
12
|
+
|
13
|
+
def perform(*args)
|
14
|
+
rhino_command("test/dummy", nil, *args)
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
def rhino_command(extra_path, base_command, *args) # rubocop:todo Metrics/MethodLength
|
19
|
+
module_name = if Dir.exist?(args[0])
|
20
|
+
args.shift
|
21
|
+
else
|
22
|
+
abort "No module specified"
|
23
|
+
end
|
24
|
+
module_path = [module_name, extra_path].compact.join("/")
|
25
|
+
db_name = "#{module_name}_dummy"
|
26
|
+
gem_file_path = File.join(Dir.pwd, "Gemfile")
|
27
|
+
|
28
|
+
# Getting existing variables and re-use
|
29
|
+
::Dotenv.load
|
30
|
+
|
31
|
+
inside(module_path) do
|
32
|
+
# Override DB_NAME so multiple can run in parallel
|
33
|
+
run(
|
34
|
+
"DB_NAME=#{db_name} BUNDLE_GEMFILE='#{gem_file_path}' bin/rails #{base_command} #{args.join(' ')}",
|
35
|
+
{ abort_on_failure: true }
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dotenv"
|
4
|
+
require "rails/command"
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
module Command
|
8
|
+
module Rhino
|
9
|
+
module Module
|
10
|
+
class NewCommand < Base # :nodoc:
|
11
|
+
no_commands do
|
12
|
+
def help
|
13
|
+
run_module_generator %w[--help]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.banner(*) # :nodoc:
|
18
|
+
"#{executable} new [options]"
|
19
|
+
end
|
20
|
+
|
21
|
+
def perform(*args)
|
22
|
+
run_module_generator(args)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def run_module_generator(plugin_args)
|
27
|
+
require "generators/rhino/module/module_generator"
|
28
|
+
::Rhino::Generators::ModuleGenerator.start plugin_args
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dotenv"
|
4
|
+
require "rails/command"
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
module Command
|
8
|
+
module Rhino
|
9
|
+
module Module
|
10
|
+
class RailsCommand < Base # :nodoc:
|
11
|
+
include Thor::Actions
|
12
|
+
|
13
|
+
def perform(*args)
|
14
|
+
rhino_command(nil, nil, *args)
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
def rhino_command(extra_path, base_command, *args) # rubocop:todo Metrics/MethodLength
|
19
|
+
module_name = if Dir.exist?(args[0])
|
20
|
+
args.shift
|
21
|
+
else
|
22
|
+
abort "No module specified"
|
23
|
+
end
|
24
|
+
module_path = [module_name, extra_path].compact.join("/")
|
25
|
+
db_name = "#{module_name}_dummy"
|
26
|
+
gem_file_path = File.join(Dir.pwd, "Gemfile")
|
27
|
+
|
28
|
+
# Getting existing variables and re-use
|
29
|
+
::Dotenv.load
|
30
|
+
|
31
|
+
inside(module_path) do
|
32
|
+
# Override DB_NAME so multiple can run in parallel
|
33
|
+
run(
|
34
|
+
"DB_NAME=#{db_name} BUNDLE_GEMFILE='#{gem_file_path}' bin/rails #{base_command} #{args.join(' ')}",
|
35
|
+
{ abort_on_failure: true }
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dotenv"
|
4
|
+
require "rails/command"
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
module Command
|
8
|
+
module Rhino
|
9
|
+
module Module
|
10
|
+
class TestCommand < Base # :nodoc:
|
11
|
+
include Thor::Actions
|
12
|
+
|
13
|
+
def test(*args)
|
14
|
+
rhino_command(nil, "test", *args)
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
def rhino_command(extra_path, base_command, *args) # rubocop:todo Metrics/MethodLength
|
19
|
+
module_name = if Dir.exist?(args[0])
|
20
|
+
args.shift
|
21
|
+
else
|
22
|
+
abort "No module specified"
|
23
|
+
end
|
24
|
+
module_path = [module_name, extra_path].compact.join("/")
|
25
|
+
db_name = "#{module_name}_dummy"
|
26
|
+
gem_file_path = File.join(Dir.pwd, "Gemfile")
|
27
|
+
|
28
|
+
# Getting existing variables and re-use
|
29
|
+
::Dotenv.load
|
30
|
+
|
31
|
+
inside(module_path) do
|
32
|
+
# Override DB_NAME so multiple can run in parallel
|
33
|
+
run(
|
34
|
+
"DB_NAME=#{db_name} BUNDLE_GEMFILE='#{gem_file_path}' bin/rails #{base_command} #{args.join(' ')}",
|
35
|
+
{ abort_on_failure: true }
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,91 +1,78 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "rails/generators"
|
4
|
+
require "rails/generators/rails/plugin/plugin_generator"
|
5
|
+
require "rhino/version"
|
6
|
+
|
3
7
|
module Rhino
|
4
8
|
module Generators
|
5
|
-
class
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
desc: 'Full plugin generation'
|
10
|
-
|
11
|
-
class_option :skip_plugin, type: :boolean, default: false,
|
12
|
-
desc: 'Skip plugin generation'
|
13
|
-
|
14
|
-
source_root File.expand_path('templates', __dir__)
|
9
|
+
class ModuleBuilder < ::Rails::PluginBuilder
|
10
|
+
def lib
|
11
|
+
template "lib/%namespaced_name%.rb"
|
12
|
+
template "lib/%namespaced_name%/version.rb"
|
15
13
|
|
16
|
-
|
17
|
-
@module_name = ask('Module name?')
|
18
|
-
@module_name = "rhino_#{module_name}" unless module_name.starts_with?('rhino_')
|
19
|
-
@module_path = "rhino/#{module_name}"
|
14
|
+
template "lib/%namespaced_name%/engine.rb"
|
20
15
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
plugin_command = "plugin new #{module_path} --skip-git"
|
26
|
-
plugin_command = "#{plugin_command} --full" if options[:full]
|
27
|
-
rails_command(plugin_command)
|
16
|
+
# The install generator
|
17
|
+
empty_directory_with_keep_file "lib/generators/#{namespaced_name}/install/templates"
|
18
|
+
template "lib/generators/%namespaced_name%/install/install_generator.rb"
|
19
|
+
template "lib/tasks/%namespaced_name%_tasks.rake"
|
28
20
|
end
|
29
21
|
|
30
|
-
|
31
|
-
|
22
|
+
# FIXME: Hack because the engine.rb file is over aggressive in its checks
|
23
|
+
def rhino_hack
|
24
|
+
template "test/dummy/config/initializers/devise.rb"
|
25
|
+
template "test/dummy/config/initializers/devise_token_auth.rb"
|
26
|
+
template "test/dummy/app/models/user.rb"
|
27
|
+
remove_file "test/dummy/config/database.yml"
|
28
|
+
template "test/dummy/config/database.yml"
|
32
29
|
end
|
30
|
+
end
|
33
31
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
remove_file engine_file
|
38
|
-
template 'engine.rb', engine_file
|
39
|
-
end
|
40
|
-
|
41
|
-
def create_install_generator
|
42
|
-
generator_path = "#{module_path}/lib/generators/#{module_name}/install"
|
43
|
-
tasks_path = "#{module_path}/lib/tasks"
|
44
|
-
|
45
|
-
empty_directory "#{generator_path}/templates"
|
46
|
-
create_file("#{generator_path}/templates/.keep")
|
32
|
+
class ModuleGenerator < ::Rails::Generators::PluginGenerator
|
33
|
+
source_root File.expand_path("templates", __dir__)
|
47
34
|
|
48
|
-
|
49
|
-
|
35
|
+
class_option :database, type: :string, aliases: "-d", default: "postgresql"
|
36
|
+
remove_class_option :template
|
50
37
|
|
51
|
-
|
38
|
+
def self.banner
|
39
|
+
"rails rhino:module #{arguments.map(&:usage).join(' ')} [options]"
|
52
40
|
end
|
53
41
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
gsub_file gemspec_file, /spec.license.*/, 'spec.license = ""'
|
61
|
-
gsub_file gemspec_file, 'spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]', 'spec.files = Dir["{app,config,db,lib}/**/*", "Rakefile", "README.md"]' # rubocop:disable Layout/LineLength
|
42
|
+
# Parent source paths
|
43
|
+
def source_paths
|
44
|
+
[
|
45
|
+
File.expand_path("templates", __dir__),
|
46
|
+
Rails::Generators::PluginGenerator.source_root
|
47
|
+
]
|
62
48
|
end
|
63
49
|
|
64
|
-
#
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
'config/initializers/devise.rb',
|
69
|
-
'app/models/user.rb',
|
70
|
-
'db/migrate/20210111014230_devise_token_auth_create_users.rhino_engine.rb'
|
71
|
-
].freeze
|
50
|
+
# Has to be named this way as it overrides the default
|
51
|
+
def get_builder_class # rubocop:disable Naming/AccessorMethodName
|
52
|
+
ModuleBuilder
|
53
|
+
end
|
72
54
|
|
73
|
-
def
|
74
|
-
|
55
|
+
def rhino_version
|
56
|
+
::Rhino::VERSION::STRING
|
57
|
+
end
|
75
58
|
|
76
|
-
|
77
|
-
|
59
|
+
def rhino_setup
|
60
|
+
return unless with_dummy_app?
|
78
61
|
|
79
|
-
|
62
|
+
build(:rhino_hack)
|
80
63
|
|
81
|
-
|
82
|
-
|
64
|
+
inside(rails_app_path) do
|
65
|
+
run "rails rhino:module:dummy #{namespaced_name} rhino:install"
|
66
|
+
run "rails rhino:module:dummy #{namespaced_name} db:create"
|
67
|
+
run "rails rhino:module:dummy #{namespaced_name} db:migrate"
|
83
68
|
end
|
84
69
|
end
|
85
70
|
|
86
71
|
def rubocop
|
87
|
-
|
88
|
-
|
72
|
+
template ".rubocop.yml"
|
73
|
+
|
74
|
+
inside(File.join(rails_app_path, namespaced_name)) do
|
75
|
+
run "bundle exec rubocop -A ", capture: true
|
89
76
|
end
|
90
77
|
end
|
91
78
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative "lib/<%= namespaced_name %>/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = <%= name.inspect %>
|
5
|
+
spec.version = <%= camelized_modules %>::VERSION
|
6
|
+
spec.authors = [ <%= author.inspect %> ]
|
7
|
+
spec.email = [ <%= email.inspect %> ]
|
8
|
+
spec.summary = "Summary of <%= camelized_modules %>."
|
9
|
+
spec.description = "Description of <%= camelized_modules %>."
|
10
|
+
<%- unless inside_application? -%>
|
11
|
+
spec.license = "MIT"
|
12
|
+
<%- end -%>
|
13
|
+
|
14
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the "allowed_push_host"
|
15
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
16
|
+
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
17
|
+
|
18
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
|
+
Dir["{app,config,db,lib}/**/*", <%- unless inside_application? -%> "MIT-LICENSE", <%- end -%>"Rakefile", "README.md"]
|
20
|
+
end
|
21
|
+
|
22
|
+
<%= "# " if rails_prerelease? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>"
|
23
|
+
spec.add_dependency "rhino_project_core", ">= <%= rhino_version %>"
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rhino/engine"
|
4
|
+
|
5
|
+
module <%= camelized_modules %>
|
6
|
+
class Engine < ::Rails::Engine
|
7
|
+
config.autoload_paths << File.expand_path("../../lib", __dir__)
|
8
|
+
|
9
|
+
initializer "<%= namespaced_name %>.register_module" do
|
10
|
+
config.after_initialize do
|
11
|
+
Rhino.registered_modules[:<%= namespaced_name %>] = {
|
12
|
+
version: <%= camelized_modules %>::VERSION
|
13
|
+
}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :<%= namespaced_name %> do
|
4
|
+
# Prevent migration installation task from showing up twice.
|
5
|
+
Rake::Task["<%= namespaced_name %>_engine:install:migrations"].clear_comments if Rake::Task.task_defined?("<%= namespaced_name %>_engine:install:migrations")
|
6
|
+
|
7
|
+
desc "Install <%= namespaced_name %>"
|
8
|
+
task install: :environment do
|
9
|
+
Rake::Task["<%= namespaced_name %>_engine:install:migrations"].invoke if Rake::Task.task_defined?("<%= namespaced_name %>_engine:install:migrations")
|
10
|
+
|
11
|
+
Rails::Command.invoke :generate, ["<%= namespaced_name %>:install"]
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
default: &default
|
2
|
+
adapter: postgresql
|
3
|
+
encoding: unicode
|
4
|
+
pool: 5
|
5
|
+
username: <%%= ENV["DB_USERNAME"] %>
|
6
|
+
password: <%%= ENV["DB_PASSWORD"] %>
|
7
|
+
database: <%%= ENV["DB_NAME"] %>
|
8
|
+
port: <%%= ENV["DB_PORT"] || 5432 %>
|
9
|
+
host: <%%= ENV["DB_HOST"] || "localhost" %>
|
10
|
+
|
11
|
+
development:
|
12
|
+
<<: *default
|
13
|
+
database: <%%= ENV["DB_NAME"] %>_development
|
14
|
+
|
15
|
+
# Warning: The database defined as "test" will be erased and
|
16
|
+
# re-generated from your development database when you run "rake".
|
17
|
+
# Do not set this db to the same as development or production.
|
18
|
+
test:
|
19
|
+
<<: *default
|
20
|
+
# https://github.com/ged/ruby-pg/issues/311#issuecomment-1615084569
|
21
|
+
gssencmode: disable
|
22
|
+
database: <%%= ENV["DB_NAME"] %>_test
|
23
|
+
|
24
|
+
production:
|
25
|
+
<<: *default
|
@@ -0,0 +1,311 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Assuming you have not yet modified this file, each configuration option below
|
4
|
+
# is set to its default value. Note that some are commented out while others
|
5
|
+
# are not: uncommented lines are intended to protect your configuration from
|
6
|
+
# breaking changes in upgrades (i.e., in the event that future versions of
|
7
|
+
# Devise change the default values for those options).
|
8
|
+
#
|
9
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
10
|
+
# Many of these configuration options can be set straight in your model.
|
11
|
+
Devise.setup do |config|
|
12
|
+
# The secret key used by Devise. Devise uses this key to generate
|
13
|
+
# random tokens. Changing this key will render invalid all existing
|
14
|
+
# confirmation, reset password and unlock tokens in the database.
|
15
|
+
# Devise will use the `secret_key_base` as its `secret_key`
|
16
|
+
# by default. You can change it below and use your own secret key.
|
17
|
+
# config.secret_key = '1b7b3cb6c9406b83c9dee1e2408d312241fcf7228320bd533d8f619531abdc5203f74296f2fc560753c2117f37f8533d841ced6be9ed6c9fe2f913d576db6dd2'
|
18
|
+
|
19
|
+
# ==> Controller configuration
|
20
|
+
# Configure the parent class to the devise controllers.
|
21
|
+
# config.parent_controller = 'DeviseController'
|
22
|
+
|
23
|
+
# ==> Mailer Configuration
|
24
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
25
|
+
# note that it will be overwritten if you use your own mailer class
|
26
|
+
# with default "from" parameter.
|
27
|
+
config.mailer_sender = ENV.fetch("DEFAULT_EMAIL_SENDER", "from@example.com")
|
28
|
+
|
29
|
+
# Configure the class responsible to send e-mails.
|
30
|
+
# config.mailer = 'Devise::Mailer'
|
31
|
+
|
32
|
+
# Configure the parent class responsible to send e-mails.
|
33
|
+
# config.parent_mailer = 'ActionMailer::Base'
|
34
|
+
|
35
|
+
# ==> ORM configuration
|
36
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
37
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
38
|
+
# available as additional gems.
|
39
|
+
require 'devise/orm/active_record'
|
40
|
+
|
41
|
+
# ==> Configuration for any authentication mechanism
|
42
|
+
# Configure which keys are used when authenticating a user. The default is
|
43
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
44
|
+
# authenticating a user, both parameters are required. Remember that those
|
45
|
+
# parameters are used only when authenticating and not when retrieving from
|
46
|
+
# session. If you need permissions, you should implement that in a before filter.
|
47
|
+
# You can also supply a hash where the value is a boolean determining whether
|
48
|
+
# or not authentication should be aborted when the value is not present.
|
49
|
+
# config.authentication_keys = [:email]
|
50
|
+
|
51
|
+
# Configure parameters from the request object used for authentication. Each entry
|
52
|
+
# given should be a request method and it will automatically be passed to the
|
53
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
54
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
55
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
56
|
+
# config.request_keys = []
|
57
|
+
|
58
|
+
# Configure which authentication keys should be case-insensitive.
|
59
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
60
|
+
# to authenticate or find a user. Default is :email.
|
61
|
+
config.case_insensitive_keys = [:email]
|
62
|
+
|
63
|
+
# Configure which authentication keys should have whitespace stripped.
|
64
|
+
# These keys will have whitespace before and after removed upon creating or
|
65
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
66
|
+
config.strip_whitespace_keys = [:email]
|
67
|
+
|
68
|
+
# Tell if authentication through request.params is enabled. True by default.
|
69
|
+
# It can be set to an array that will enable params authentication only for the
|
70
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
71
|
+
# enable it only for database (email + password) authentication.
|
72
|
+
# config.params_authenticatable = true
|
73
|
+
|
74
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
75
|
+
# It can be set to an array that will enable http authentication only for the
|
76
|
+
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
77
|
+
# enable it only for database authentication.
|
78
|
+
# For API-only applications to support authentication "out-of-the-box", you will likely want to
|
79
|
+
# enable this with :database unless you are using a custom strategy.
|
80
|
+
# The supported strategies are:
|
81
|
+
# :database = Support basic authentication with authentication key + password
|
82
|
+
# config.http_authenticatable = false
|
83
|
+
|
84
|
+
# If 401 status code should be returned for AJAX requests. True by default.
|
85
|
+
# config.http_authenticatable_on_xhr = true
|
86
|
+
|
87
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
88
|
+
# config.http_authentication_realm = 'Application'
|
89
|
+
|
90
|
+
# It will change confirmation, password recovery and other workflows
|
91
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
92
|
+
# Does not affect registerable.
|
93
|
+
# config.paranoid = true
|
94
|
+
|
95
|
+
# By default Devise will store the user in session. You can skip storage for
|
96
|
+
# particular strategies by setting this option.
|
97
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
98
|
+
# may want to disable generating routes to Devise's sessions controller by
|
99
|
+
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
100
|
+
config.skip_session_storage = [:http_auth]
|
101
|
+
|
102
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
103
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
104
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
105
|
+
# from the server. You can disable this option at your own risk.
|
106
|
+
# config.clean_up_csrf_token_on_authentication = true
|
107
|
+
|
108
|
+
# When false, Devise will not attempt to reload routes on eager load.
|
109
|
+
# This can reduce the time taken to boot the app but if your application
|
110
|
+
# requires the Devise mappings to be loaded during boot time the application
|
111
|
+
# won't boot properly.
|
112
|
+
# config.reload_routes = true
|
113
|
+
|
114
|
+
# ==> Configuration for :database_authenticatable
|
115
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 12. If
|
116
|
+
# using other algorithms, it sets how many times you want the password to be hashed.
|
117
|
+
# The number of stretches used for generating the hashed password are stored
|
118
|
+
# with the hashed password. This allows you to change the stretches without
|
119
|
+
# invalidating existing passwords.
|
120
|
+
#
|
121
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
122
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
123
|
+
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
124
|
+
# algorithm), the cost increases exponentially with the number of stretches (e.g.
|
125
|
+
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
126
|
+
config.stretches = Rails.env.test? ? 1 : 12
|
127
|
+
|
128
|
+
# Set up a pepper to generate the hashed password.
|
129
|
+
# config.pepper = '82ac2dcad675b91cf651a60b4bbc6c44403cd3ef47af621fca84f8e91d7bf0d45a058e6444eb4dbf787c3d9f7b9ed42a86a469d20dc67046816815c6f40cbb6d'
|
130
|
+
|
131
|
+
# Send a notification to the original email when the user's email is changed.
|
132
|
+
# config.send_email_changed_notification = false
|
133
|
+
|
134
|
+
# Send a notification email when the user's password is changed.
|
135
|
+
# config.send_password_change_notification = false
|
136
|
+
|
137
|
+
# ==> Configuration for :confirmable
|
138
|
+
# A period that the user is allowed to access the website even without
|
139
|
+
# confirming their account. For instance, if set to 2.days, the user will be
|
140
|
+
# able to access the website for two days without confirming their account,
|
141
|
+
# access will be blocked just in the third day.
|
142
|
+
# You can also set it to nil, which will allow the user to access the website
|
143
|
+
# without confirming their account.
|
144
|
+
# Default is 0.days, meaning the user cannot access the website without
|
145
|
+
# confirming their account.
|
146
|
+
# config.allow_unconfirmed_access_for = 2.days
|
147
|
+
|
148
|
+
# A period that the user is allowed to confirm their account before their
|
149
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
150
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
151
|
+
# their account can't be confirmed with the token any more.
|
152
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
153
|
+
# before confirming their account.
|
154
|
+
# config.confirm_within = 3.days
|
155
|
+
|
156
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
157
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
158
|
+
# db field (see migrations). Until confirmed, new email is stored in
|
159
|
+
# unconfirmed_email column, and copied to email column on successful confirmation.
|
160
|
+
config.reconfirmable = true
|
161
|
+
|
162
|
+
# Defines which key will be used when confirming an account
|
163
|
+
# config.confirmation_keys = [:email]
|
164
|
+
|
165
|
+
# ==> Configuration for :rememberable
|
166
|
+
# The time the user will be remembered without asking for credentials again.
|
167
|
+
# config.remember_for = 2.weeks
|
168
|
+
|
169
|
+
# Invalidates all the remember me tokens when the user signs out.
|
170
|
+
config.expire_all_remember_me_on_sign_out = true
|
171
|
+
|
172
|
+
# If true, extends the user's remember period when remembered via cookie.
|
173
|
+
# config.extend_remember_period = false
|
174
|
+
|
175
|
+
# Options to be passed to the created cookie. For instance, you can set
|
176
|
+
# secure: true in order to force SSL only cookies.
|
177
|
+
# config.rememberable_options = {}
|
178
|
+
|
179
|
+
# ==> Configuration for :validatable
|
180
|
+
# Range for password length.
|
181
|
+
config.password_length = 6..128
|
182
|
+
|
183
|
+
# Email regex used to validate email formats. It simply asserts that
|
184
|
+
# one (and only one) @ exists in the given string. This is mainly
|
185
|
+
# to give user feedback and not to assert the e-mail validity.
|
186
|
+
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
187
|
+
|
188
|
+
# ==> Configuration for :timeoutable
|
189
|
+
# The time you want to timeout the user session without activity. After this
|
190
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
191
|
+
# config.timeout_in = 30.minutes
|
192
|
+
|
193
|
+
# ==> Configuration for :lockable
|
194
|
+
# Defines which strategy will be used to lock an account.
|
195
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
196
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
197
|
+
# config.lock_strategy = :failed_attempts
|
198
|
+
|
199
|
+
# Defines which key will be used when locking and unlocking an account
|
200
|
+
# config.unlock_keys = [:email]
|
201
|
+
|
202
|
+
# Defines which strategy will be used to unlock an account.
|
203
|
+
# :email = Sends an unlock link to the user email
|
204
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
205
|
+
# :both = Enables both strategies
|
206
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
207
|
+
# config.unlock_strategy = :both
|
208
|
+
|
209
|
+
# Number of authentication tries before locking an account if lock_strategy
|
210
|
+
# is failed attempts.
|
211
|
+
# config.maximum_attempts = 20
|
212
|
+
|
213
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
214
|
+
# config.unlock_in = 1.hour
|
215
|
+
|
216
|
+
# Warn on the last attempt before the account is locked.
|
217
|
+
# config.last_attempt_warning = true
|
218
|
+
|
219
|
+
# ==> Configuration for :recoverable
|
220
|
+
#
|
221
|
+
# Defines which key will be used when recovering the password for an account
|
222
|
+
# config.reset_password_keys = [:email]
|
223
|
+
|
224
|
+
# Time interval you can reset your password with a reset password key.
|
225
|
+
# Don't put a too small interval or your users won't have the time to
|
226
|
+
# change their passwords.
|
227
|
+
config.reset_password_within = 6.hours
|
228
|
+
|
229
|
+
# When set to false, does not sign a user in automatically after their password is
|
230
|
+
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
231
|
+
# config.sign_in_after_reset_password = true
|
232
|
+
|
233
|
+
# ==> Configuration for :encryptable
|
234
|
+
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
|
235
|
+
# You can use :sha1, :sha512 or algorithms from others authentication tools as
|
236
|
+
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
|
237
|
+
# for default behavior) and :restful_authentication_sha1 (then you should set
|
238
|
+
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
|
239
|
+
#
|
240
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
241
|
+
# config.encryptor = :sha512
|
242
|
+
|
243
|
+
# ==> Scopes configuration
|
244
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
245
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
246
|
+
# are using only default views.
|
247
|
+
# config.scoped_views = false
|
248
|
+
|
249
|
+
# Configure the default scope given to Warden. By default it's the first
|
250
|
+
# devise role declared in your routes (usually :user).
|
251
|
+
# config.default_scope = :user
|
252
|
+
|
253
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
254
|
+
# only the current scope. By default, Devise signs out all scopes.
|
255
|
+
# config.sign_out_all_scopes = true
|
256
|
+
|
257
|
+
# ==> Navigation configuration
|
258
|
+
# Lists the formats that should be treated as navigational. Formats like
|
259
|
+
# :html, should redirect to the sign in page when the user does not have
|
260
|
+
# access, but formats like :xml or :json, should return 401.
|
261
|
+
#
|
262
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
263
|
+
# should add them to the navigational formats lists.
|
264
|
+
#
|
265
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
266
|
+
# config.navigational_formats = ['*/*', :html]
|
267
|
+
|
268
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
269
|
+
config.sign_out_via = :delete
|
270
|
+
|
271
|
+
# ==> OmniAuth
|
272
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
273
|
+
# up on your models and hooks.
|
274
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
275
|
+
|
276
|
+
# ==> Warden configuration
|
277
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
278
|
+
# change the failure app, you can configure them inside the config.warden block.
|
279
|
+
#
|
280
|
+
# config.warden do |manager|
|
281
|
+
# manager.intercept_401 = false
|
282
|
+
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
283
|
+
# end
|
284
|
+
|
285
|
+
# ==> Mountable engine configurations
|
286
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
287
|
+
# is mountable, there are some extra configurations to be taken into account.
|
288
|
+
# The following options are available, assuming the engine is mounted as:
|
289
|
+
#
|
290
|
+
# mount MyEngine, at: '/my_engine'
|
291
|
+
#
|
292
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
293
|
+
# config.router_name = :my_engine
|
294
|
+
#
|
295
|
+
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
296
|
+
# so you need to do it manually. For the users scope, it would be:
|
297
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
298
|
+
|
299
|
+
# ==> Turbolinks configuration
|
300
|
+
# If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
|
301
|
+
#
|
302
|
+
# ActiveSupport.on_load(:devise_failure_app) do
|
303
|
+
# include Turbolinks::Controller
|
304
|
+
# end
|
305
|
+
|
306
|
+
# ==> Configuration for :registerable
|
307
|
+
|
308
|
+
# When set to false, does not sign a user in automatically after their password is
|
309
|
+
# changed. Defaults to true, so a user is signed in automatically after changing a password.
|
310
|
+
# config.sign_in_after_change_password = true
|
311
|
+
end
|
data/lib/generators/rhino/module/templates/test/dummy/config/initializers/devise_token_auth.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
DeviseTokenAuth.setup do |config|
|
4
|
+
config.cookie_enabled = true
|
5
|
+
config.cookie_attributes = {
|
6
|
+
secure: true,
|
7
|
+
httponly: true,
|
8
|
+
expires: 1.day,
|
9
|
+
same_site: "None"
|
10
|
+
# WARNING: the :domain attribute specifies to whom the cookie will be sent to. It's recommended to leave it empty, so it acts in the most restrictive way as per https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html#domain-and-path-attributes
|
11
|
+
}
|
12
|
+
# By default the authorization headers will change after each request. The
|
13
|
+
# client is responsible for keeping track of the changing tokens. Change
|
14
|
+
# this to false to prevent the Authorization header from changing after
|
15
|
+
# each request.
|
16
|
+
config.change_headers_on_each_request = false
|
17
|
+
|
18
|
+
# By default, users will need to re-authenticate after 2 weeks. This setting
|
19
|
+
# determines how long tokens will remain valid after they are issued.
|
20
|
+
# config.token_lifespan = 2.weeks
|
21
|
+
|
22
|
+
# Limiting the token_cost to just 4 in testing will increase the performance of
|
23
|
+
# your test suite dramatically. The possible cost value is within range from 4
|
24
|
+
# to 31. It is recommended to not use a value more than 10 in other environments.
|
25
|
+
config.token_cost = Rails.env.test? ? 4 : 10
|
26
|
+
|
27
|
+
# Sets the max number of concurrent devices per user, which is 10 by default.
|
28
|
+
# After this limit is reached, the oldest tokens will be removed.
|
29
|
+
# config.max_number_of_devices = 10
|
30
|
+
|
31
|
+
# Sometimes it's necessary to make several requests to the API at the same
|
32
|
+
# time. In this case, each request in the batch will need to share the same
|
33
|
+
# auth token. This setting determines how far apart the requests can be while
|
34
|
+
# still using the same auth token.
|
35
|
+
# config.batch_request_buffer_throttle = 5.seconds
|
36
|
+
|
37
|
+
# This route will be the prefix for all oauth2 redirect callbacks. For
|
38
|
+
# example, using the default '/omniauth', the github oauth2 provider will
|
39
|
+
# redirect successful authentications to '/omniauth/github/callback'
|
40
|
+
config.omniauth_prefix = "/api/auth/omniauth"
|
41
|
+
|
42
|
+
# By default sending current password is not needed for the password update.
|
43
|
+
# Uncomment to enforce current_password param to be checked before all
|
44
|
+
# attribute updates. Set it to :password if you want it to be checked only if
|
45
|
+
# password is updated.
|
46
|
+
# config.check_current_password_before_update = :attributes
|
47
|
+
|
48
|
+
# By default we will use callbacks for single omniauth.
|
49
|
+
# It depends on fields like email, provider and uid.
|
50
|
+
# config.default_callbacks = true
|
51
|
+
|
52
|
+
# Makes it possible to change the headers names
|
53
|
+
# config.headers_names = {:'access-token' => 'access-token',
|
54
|
+
# :'client' => 'client',
|
55
|
+
# :'expiry' => 'expiry',
|
56
|
+
# :'uid' => 'uid',
|
57
|
+
# :'token-type' => 'token-type' }
|
58
|
+
|
59
|
+
# By default, only Bearer Token authentication is implemented out of the box.
|
60
|
+
# If, however, you wish to integrate with legacy Devise authentication, you can
|
61
|
+
# do so by enabling this flag. NOTE: This feature is highly experimental!
|
62
|
+
# config.enable_standard_devise_support = false
|
63
|
+
|
64
|
+
# By default DeviseTokenAuth will not send confirmation email, even when including
|
65
|
+
# devise confirmable module. If you want to use devise confirmable module and
|
66
|
+
# send email, set it to true. (This is a setting for compatibility)
|
67
|
+
# config.send_confirmation_email = true
|
68
|
+
|
69
|
+
config.default_confirm_success_url = "#{ENV['FRONT_END_URL']}/auth/signin"
|
70
|
+
config.default_password_reset_url = "#{ENV['FRONT_END_URL']}/auth/reset-password"
|
71
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "simplecov" if ENV["COVERAGE"]
|
4
|
+
|
5
|
+
# Configure Rails Environment
|
6
|
+
ENV["RAILS_ENV"] = "test"
|
7
|
+
|
8
|
+
require_relative "../test/dummy/config/environment"
|
9
|
+
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)]
|
10
|
+
require "rails/test_help"
|
11
|
+
|
12
|
+
require "rhino/test_case"
|
13
|
+
|
14
|
+
# Filter out the backtrace from minitest while preserving the one from other libraries.
|
15
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
16
|
+
|
17
|
+
# Load fixtures from the engine
|
18
|
+
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
19
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("fixtures", __dir__)
|
20
|
+
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
21
|
+
ActiveSupport::TestCase.file_fixture_path = File.expand_path("fixtures/files", __dir__)
|
22
|
+
ActiveSupport::TestCase.fixtures :all
|
23
|
+
end
|
24
|
+
|
25
|
+
# Load all test helpers
|
26
|
+
# https://guides.rubyonrails.org/testing.html#eagerly-requiring-helpers
|
27
|
+
# But we are in an engine so use that root - Rails.root would point to dummy
|
28
|
+
Dir[Rhino::Engine.root.join("test", "test_helpers", "**", "*.rb")].each { |file| require file }
|
29
|
+
|
30
|
+
class ActiveSupport::TestCase
|
31
|
+
# Run tests in parallel with specified workers
|
32
|
+
parallelize(workers: :number_of_processors)
|
33
|
+
|
34
|
+
# make each process running tests a separate command for simple cov.
|
35
|
+
# in the end, they will all get merged and not overwrite each other's results
|
36
|
+
# https://github.com/simplecov-ruby/simplecov/issues/718#issuecomment-538201587
|
37
|
+
|
38
|
+
parallelize_setup do |worker|
|
39
|
+
SimpleCov.command_name "#{SimpleCov.command_name}-#{worker}" if ENV["COVERAGE"]
|
40
|
+
|
41
|
+
# https://guides.rubyonrails.org/active_storage_overview.html#discarding-files-created-during-tests
|
42
|
+
ActiveStorage::Blob.service.root = "#{ActiveStorage::Blob.service.root}-#{worker}"
|
43
|
+
end
|
44
|
+
|
45
|
+
parallelize_teardown do |_worker|
|
46
|
+
SimpleCov.result if ENV["COVERAGE"]
|
47
|
+
|
48
|
+
# https://guides.rubyonrails.org/active_storage_overview.html#cleaning-up-fixtures
|
49
|
+
FileUtils.rm_rf(ActiveStorage::Blob.services.fetch(:test).root)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Add more helper methods to be used by all tests here...
|
53
|
+
include FactoryBot::Syntax::Methods
|
54
|
+
end
|
data/lib/rhino/version.rb
CHANGED
data/lib/tasks/rhino.rake
CHANGED
@@ -7,12 +7,6 @@ namespace :rhino do
|
|
7
7
|
desc 'Install Rhino'
|
8
8
|
task install: %w[environment run_installer]
|
9
9
|
|
10
|
-
desc 'Generate Rhino module'
|
11
|
-
task module: %w[environment run_module]
|
12
|
-
|
13
|
-
desc 'Generate fulle Rhino module'
|
14
|
-
task module_full: %w[environment run_module_full]
|
15
|
-
|
16
10
|
desc 'Export Rhino Open API information for client'
|
17
11
|
task open_api_export: :environment do
|
18
12
|
static_file = Rails.root.parent.join('client', 'src', 'models', 'static.js')
|
@@ -27,12 +21,4 @@ namespace :rhino do
|
|
27
21
|
|
28
22
|
Rails::Command.invoke :generate, ['rhino:install']
|
29
23
|
end
|
30
|
-
|
31
|
-
task run_module: :environment do
|
32
|
-
Rails::Command.invoke :generate, ['rhino:module']
|
33
|
-
end
|
34
|
-
|
35
|
-
task run_module_full: :environment do
|
36
|
-
Rails::Command.invoke :generate, ['rhino:module', '--full']
|
37
|
-
end
|
38
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhino_project_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.0.beta.
|
4
|
+
version: 0.20.0.beta.81
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Rosevear
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -168,7 +168,11 @@ files:
|
|
168
168
|
- db/migrate/20180622142754_add_allow_change_password_to_users.rb
|
169
169
|
- db/migrate/20191217010224_add_approved_to_users.rb
|
170
170
|
- db/migrate/20200503182019_change_tokens_to_json_b.rb
|
171
|
-
- lib/commands/
|
171
|
+
- lib/commands/rhino/module/coverage_command.rb
|
172
|
+
- lib/commands/rhino/module/dummy_command.rb
|
173
|
+
- lib/commands/rhino/module/new_command.rb
|
174
|
+
- lib/commands/rhino/module/rails_command.rb
|
175
|
+
- lib/commands/rhino/module/test_command.rb
|
172
176
|
- lib/generators/rhino/dev/setup/setup_generator.rb
|
173
177
|
- lib/generators/rhino/dev/setup/templates/env.client.tt
|
174
178
|
- lib/generators/rhino/dev/setup/templates/env.root.tt
|
@@ -179,10 +183,17 @@ files:
|
|
179
183
|
- lib/generators/rhino/install/templates/rhino.rb
|
180
184
|
- lib/generators/rhino/install/templates/user.rb
|
181
185
|
- lib/generators/rhino/model/model_generator.rb
|
186
|
+
- lib/generators/rhino/module/USAGE
|
182
187
|
- lib/generators/rhino/module/module_generator.rb
|
183
|
-
- lib/generators/rhino/module/templates
|
184
|
-
- lib/generators/rhino/module/templates/
|
185
|
-
- lib/generators/rhino/module/templates/
|
188
|
+
- lib/generators/rhino/module/templates/%name%.gemspec.tt
|
189
|
+
- lib/generators/rhino/module/templates/lib/%namespaced_name%/engine.rb.tt
|
190
|
+
- lib/generators/rhino/module/templates/lib/generators/%namespaced_name%/install/install_generator.rb.tt
|
191
|
+
- lib/generators/rhino/module/templates/lib/tasks/%namespaced_name%_tasks.rake.tt
|
192
|
+
- lib/generators/rhino/module/templates/test/dummy/app/models/user.rb
|
193
|
+
- lib/generators/rhino/module/templates/test/dummy/config/database.yml
|
194
|
+
- lib/generators/rhino/module/templates/test/dummy/config/initializers/devise.rb
|
195
|
+
- lib/generators/rhino/module/templates/test/dummy/config/initializers/devise_token_auth.rb
|
196
|
+
- lib/generators/rhino/module/templates/test/test_helper.rb
|
186
197
|
- lib/generators/rhino/policy/policy_generator.rb
|
187
198
|
- lib/generators/rhino/policy/templates/policy.rb.tt
|
188
199
|
- lib/generators/test_unit/rhino_policy_generator.rb
|
@@ -257,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
268
|
- !ruby/object:Gem::Version
|
258
269
|
version: 1.3.1
|
259
270
|
requirements: []
|
260
|
-
rubygems_version: 3.3.
|
271
|
+
rubygems_version: 3.3.27
|
261
272
|
signing_key:
|
262
273
|
specification_version: 4
|
263
274
|
summary: ''
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "dotenv"
|
4
|
-
require "rails/command"
|
5
|
-
|
6
|
-
module Rails
|
7
|
-
module Command
|
8
|
-
class RhinoCommand < Base # :nodoc:
|
9
|
-
include Thor::Actions
|
10
|
-
|
11
|
-
no_commands do
|
12
|
-
def help
|
13
|
-
say "rails rhino::dummy [module] command # Run rails command in dummy application, defaults to rhino"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def dummy(*args)
|
18
|
-
rhino_command("test/dummy", nil, *args)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test(*args)
|
22
|
-
rhino_command(nil, "test", *args)
|
23
|
-
end
|
24
|
-
|
25
|
-
def rails(*args)
|
26
|
-
rhino_command(nil, nil, *args)
|
27
|
-
end
|
28
|
-
|
29
|
-
def coverage(*args)
|
30
|
-
ENV["COVERAGE"] = "1"
|
31
|
-
test(*args)
|
32
|
-
end
|
33
|
-
|
34
|
-
protected
|
35
|
-
def rhino_command(extra_path, base_command, *args) # rubocop:todo Metrics/MethodLength
|
36
|
-
# Default to just rhino/rhino if no obvious module
|
37
|
-
module_name = if Dir.exist?("rhino/rhino_#{args[0]}")
|
38
|
-
args.shift
|
39
|
-
else
|
40
|
-
nil
|
41
|
-
end
|
42
|
-
module_base = ["rhino", module_name].compact.join("_")
|
43
|
-
module_path = ["rhino/#{module_base}", extra_path].compact.join("/")
|
44
|
-
db_name = "#{module_base}_dummy"
|
45
|
-
|
46
|
-
# Getting existing variables and re-use
|
47
|
-
::Dotenv.load
|
48
|
-
|
49
|
-
inside(module_path) do
|
50
|
-
# Override DB_NAME so multiple can run in parallel
|
51
|
-
run(
|
52
|
-
"DB_NAME=#{db_name} BUNDLE_GEMFILE='#{__dir__}/../../../../Gemfile' bin/rails #{base_command} #{args.join(' ')}",
|
53
|
-
{ abort_on_failure: true }
|
54
|
-
)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rhino/engine"
|
4
|
-
|
5
|
-
module <%= module_name.camelize %>
|
6
|
-
class Engine < ::Rails::Engine
|
7
|
-
config.autoload_paths << File.expand_path("../../lib", __dir__)
|
8
|
-
|
9
|
-
initializer "<%= module_name %>.register_module" do
|
10
|
-
config.after_initialize do
|
11
|
-
if true
|
12
|
-
Rhino.registered_modules[:<%= module_name %>] = {
|
13
|
-
version: <%= module_name.camelize %>::VERSION
|
14
|
-
}
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
namespace :<%= module_name %> do
|
4
|
-
# Prevent migration installation task from showing up twice.
|
5
|
-
if Rake::Task.task_defined?("<%= module_name %>_engine:install:migrations")
|
6
|
-
Rake::Task["<%= module_name %>_engine:install:migrations"].clear_comments
|
7
|
-
end
|
8
|
-
|
9
|
-
desc "Install <%= module_name %>"
|
10
|
-
task install: :environment do
|
11
|
-
if Rake::Task.task_defined?("<%= module_name %>_engine:install:migrations")
|
12
|
-
Rake::Task["<%= module_name %>_engine:install:migrations"].invoke
|
13
|
-
end
|
14
|
-
|
15
|
-
Rails::Command.invoke :generate, ["<%= module_name %>:install"]
|
16
|
-
end
|
17
|
-
end
|