eac_tools 0.11.1 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -22
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +2 -2
- data/sub/avm/lib/avm/application_stereotypes/base.rb +11 -1
- data/sub/avm/lib/avm/instances/base/auto_values/admin.rb +2 -2
- data/sub/avm/lib/avm/instances/base/auto_values/database.rb +1 -1
- data/sub/avm/lib/avm/instances/base/auto_values/filesystem.rb +9 -8
- data/sub/avm/lib/avm/instances/base/auto_values/install.rb +48 -0
- data/sub/avm/lib/avm/instances/base/auto_values/mailer.rb +2 -2
- data/sub/avm/lib/avm/instances/base/auto_values/ruby.rb +1 -1
- data/sub/avm/lib/avm/instances/base/auto_values/system.rb +3 -3
- data/sub/avm/lib/avm/instances/base/auto_values.rb +4 -5
- data/sub/avm/lib/avm/instances/base.rb +8 -8
- data/sub/avm/lib/avm/instances/entry_keys.rb +8 -7
- data/sub/avm/lib/avm/instances.rb +3 -2
- data/sub/avm/lib/avm/registry/application_stereotypes/build_available.rb +9 -6
- data/sub/avm/lib/avm/registry/application_stereotypes/stereotype_builder.rb +8 -5
- data/sub/avm/lib/avm/registry/source_generators.rb +16 -0
- data/sub/avm/lib/avm/registry.rb +2 -1
- data/sub/avm/lib/avm/scms/base.rb +2 -2
- data/sub/avm/lib/avm/source_generators/base.rb +29 -0
- data/sub/avm/lib/avm/source_generators.rb +9 -0
- data/sub/avm/lib/avm/sources/base.rb +4 -4
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm/lib/avm/with/application_stereotype.rb +35 -0
- data/sub/avm/lib/avm/with/extra_subcommands.rb +44 -0
- data/sub/avm/spec/lib/avm/instances/base_spec.rb +50 -50
- data/sub/avm/spec/lib/avm/instances/base_spec_configs_storage.yml +5 -3
- data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +3 -3
- data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/source_generators/base.rb +13 -0
- data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/Gemfile +11 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/Rakefile +8 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/config/manifest.js +3 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/javascripts/application.js +1 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/stylesheets/application.scss +1 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/controllers/application_controller.rb +4 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/controllers/welcome_controller.rb +5 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/views/welcome/index.html.erb +1 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/bundle +5 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/rails +11 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/rake +11 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/yarn +11 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/application.rb +11 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/boot.rb +5 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/cable.yml +8 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/credentials.yml.enc +1 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/environment.rb +7 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/puma.rb +39 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/routes.rb +5 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/spring.rb +8 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config.ru +7 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/db/schema.rb +1 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/lib/ability.rb +20 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/lib/ability_mapping.rb +10 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/public/favicon.ico +0 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/spec/code/rubocop_spec.rb +3 -0
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/spec/spec_helper.rb +8 -0
- data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +3 -2
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit.rb +1 -1
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec/add_or_replace_gem_line.rb +62 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec/dependency.rb +19 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec.rb +42 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
- data/sub/avm-tools/avm-tools.gemspec +1 -1
- data/sub/avm-tools/lib/avm/tools/runner/source_generate.rb +45 -0
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- data/sub/eac_config/eac_config.gemspec +1 -1
- data/sub/eac_config/lib/eac_config/entry_path.rb +15 -4
- data/sub/eac_config/lib/eac_config/version.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +5 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/base.rb +67 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/sub_file.rb +68 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +2 -125
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{require_sub_spec → require_sub/base_spec}/stubbed_module_a.rb +0 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{require_sub_spec → require_sub/base_spec}/stubbed_not_module.rb +0 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{require_sub_spec.rb → require_sub/base_spec.rb} +1 -1
- metadata +61 -18
- data/sub/avm/lib/avm/instances/base/auto_values/access.rb +0 -40
- data/sub/avm/lib/avm/with_application_stereotype.rb +0 -23
- data/sub/avm/lib/avm/with_dynamic_runners.rb +0 -42
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner_with/subcommands'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module With
|
8
|
+
module ExtraSubcommands
|
9
|
+
# @return [Hash<String, EacCli::Runner>]
|
10
|
+
def extra_available_subcommands
|
11
|
+
extra_available_subcommands_from_runners_module
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Hash<String, EacCli::Runner>]
|
15
|
+
def extra_available_subcommands_from_runners_module
|
16
|
+
self.class.ancestors.reverse.inject({}) do |a, e|
|
17
|
+
a.merge(RunnersFromModule.new(e).result)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class RunnersFromModule
|
22
|
+
enable_simple_cache
|
23
|
+
common_constructor :the_module
|
24
|
+
|
25
|
+
# @return [Hash<String, EacCli::Runner>]
|
26
|
+
def result
|
27
|
+
return {} if runners_module.blank?
|
28
|
+
|
29
|
+
::EacCli::RunnerWith::Subcommands.subcommands_from_module(runners_module)
|
30
|
+
end
|
31
|
+
|
32
|
+
def runners_module_uncached
|
33
|
+
return nil if the_module.module_parent.blank?
|
34
|
+
|
35
|
+
begin
|
36
|
+
the_module.module_parent.const_get('Runners')
|
37
|
+
rescue ::NameError
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -13,56 +13,56 @@ RSpec.describe ::Avm::Instances::Base do
|
|
13
13
|
.stub_eac_config_node(self, ::File.join(__dir__, 'base_spec_configs_storage.yml'))
|
14
14
|
|
15
15
|
describe '#read_entry' do
|
16
|
-
|
17
|
-
{
|
18
|
-
'app_0'
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
it "
|
16
|
+
{
|
17
|
+
'app_0' => {
|
18
|
+
fs_path: '/fs_root/app_0',
|
19
|
+
data_fs_path: '/data_fs_root/app_0',
|
20
|
+
::Avm::Instances::EntryKeys::DATABASE_NAME => 'app_0',
|
21
|
+
::Avm::Instances::EntryKeys::DATABASE_USERNAME => 'user1',
|
22
|
+
::Avm::Instances::EntryKeys::DATABASE_PASSWORD => 'pass1',
|
23
|
+
::Avm::Instances::EntryKeys::DATABASE_HOSTNAME => 'database.net',
|
24
|
+
::Avm::Instances::EntryKeys::DATABASE_PORT => 5432,
|
25
|
+
::Avm::Instances::EntryKeys::INSTALL_HOSTNAME => 'myhost.com',
|
26
|
+
::Avm::Instances::EntryKeys::INSTALL_USERNAME => 'myuser',
|
27
|
+
::Avm::Instances::EntryKeys::INSTALL_URL => 'ssh://otheruser@otherhost.com'
|
28
|
+
},
|
29
|
+
'app_2' => {
|
30
|
+
::Avm::Instances::EntryKeys::DATABASE_HOSTNAME => '127.0.0.1',
|
31
|
+
::Avm::Instances::EntryKeys::SOURCE_INSTANCE_ID => 'app_dev'
|
32
|
+
},
|
33
|
+
'app_3' => {
|
34
|
+
::Avm::Instances::EntryKeys::DATABASE_SYSTEM => 'postgresql',
|
35
|
+
::Avm::Instances::EntryKeys::DATABASE_NAME => 'app_1_db',
|
36
|
+
::Avm::Instances::EntryKeys::DATABASE_USERNAME => 'user1',
|
37
|
+
::Avm::Instances::EntryKeys::DATABASE_PASSWORD => 'pass1',
|
38
|
+
::Avm::Instances::EntryKeys::DATABASE_HOSTNAME => 'database.net',
|
39
|
+
::Avm::Instances::EntryKeys::DATABASE_PORT => 5432,
|
40
|
+
::Avm::Instances::EntryKeys::MAILER_ID => 'mailer_0',
|
41
|
+
::Avm::Instances::EntryKeys::MAILER_FROM => 'noreply@example.net',
|
42
|
+
::Avm::Instances::EntryKeys::MAILER_REPLY_TO => nil,
|
43
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_ADDRESS => 'smtp.example.net',
|
44
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_PORT => '587',
|
45
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_DOMAIN => 'example.net',
|
46
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_USERNAME => 'a_user',
|
47
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_PASSWORD => 'a_secret',
|
48
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_AUTHENTICATION => 'plain',
|
49
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_STARTTLS_AUTO => 'true'
|
50
|
+
},
|
51
|
+
'mailer_0' => {
|
52
|
+
::Avm::Instances::EntryKeys::MAILER_FROM => 'noreply@example.net',
|
53
|
+
::Avm::Instances::EntryKeys::MAILER_REPLY_TO => '',
|
54
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_ADDRESS => 'smtp.example.net',
|
55
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_PORT => '587',
|
56
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_DOMAIN => 'example.net',
|
57
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_USERNAME => 'a_user',
|
58
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_PASSWORD => 'a_secret',
|
59
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_AUTHENTICATION => 'plain',
|
60
|
+
::Avm::Instances::EntryKeys::MAILER_SMTP_STARTTLS_AUTO => 'true'
|
61
|
+
}
|
62
|
+
}.each do |instance_id, values|
|
63
|
+
values.each do |input, expected|
|
64
|
+
context "when a auto value is requested for \"#{instance_id}.#{input}\"" do
|
65
|
+
it ".read_entry should return \"#{expected}\"" do
|
66
66
|
expect(described_class.by_id(instance_id).read_entry(input)).to eq(expected)
|
67
67
|
end
|
68
68
|
end
|
@@ -1,17 +1,19 @@
|
|
1
1
|
---
|
2
2
|
app_0:
|
3
|
-
|
3
|
+
install:
|
4
|
+
id: app_1
|
4
5
|
app_1:
|
5
6
|
fs_path: /fs_root
|
6
7
|
data_fs_path: /data_fs_root
|
7
|
-
|
8
|
+
install:
|
9
|
+
id: app_2
|
8
10
|
database:
|
9
11
|
name: app_1_db
|
10
12
|
username: user1
|
11
13
|
password: pass1
|
12
14
|
hostname: database.net
|
13
15
|
app_2:
|
14
|
-
|
16
|
+
install:
|
15
17
|
hostname: myhost.com
|
16
18
|
username: myuser
|
17
19
|
url: ssh://otheruser@otherhost.com
|
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm-eac_rails_base1', '~> 0.
|
16
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
15
|
+
s.add_dependency 'avm-eac_rails_base1', '~> 0.4', '>= 0.4.2'
|
16
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.97'
|
17
17
|
|
18
|
-
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.
|
18
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
19
19
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
gem 'eac_rails_base0'
|
6
|
+
gem 'eac_rails_gem_support', group: :development
|
7
|
+
|
8
|
+
# Local gems
|
9
|
+
::Dir["#{__dir__}/{sub/gems,engines}/*/*.gemspec"].each do |file|
|
10
|
+
gem ::File.basename(::File.dirname(file)), path: ::File.dirname(file)
|
11
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
4
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
5
|
+
|
6
|
+
require_relative 'config/application'
|
7
|
+
|
8
|
+
Rails.application.load_tasks
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require eac_rails_base0
|
@@ -0,0 +1 @@
|
|
1
|
+
@import "eac_rails_base0";
|
@@ -0,0 +1 @@
|
|
1
|
+
<p>Bem-vindo!</p>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
begin
|
5
|
+
load File.expand_path('spring', __dir__)
|
6
|
+
rescue LoadError => e
|
7
|
+
raise unless e.message.include?('spring')
|
8
|
+
end
|
9
|
+
APP_PATH = File.expand_path('../config/application', __dir__)
|
10
|
+
require_relative '../config/boot'
|
11
|
+
require 'rails/commands'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
5
|
+
Dir.chdir(APP_ROOT) do
|
6
|
+
exec 'yarnpkg', *ARGV
|
7
|
+
rescue Errno::ENOENT
|
8
|
+
warn 'Yarn executable was not detected in the system.'
|
9
|
+
warn 'Download Yarn at https://yarnpkg.com/en/docs/install'
|
10
|
+
exit 1
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
APP_PATH = ::File.dirname(__dir__) unless defined?(APP_PATH)
|
4
|
+
require File.expand_path('boot', __dir__)
|
5
|
+
require 'eac_rails_base0/app_base/application.rb'
|
6
|
+
|
7
|
+
module EacRailsBase0App
|
8
|
+
class Application
|
9
|
+
config.load_defaults 5.2
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
XKDkD3DioFn69hXAhH88mw9ZFRjDdarYU+7htxgTJmBB/vg45Hsb7pBJQaySoc7VD0Vb838ShDeVbhDlSc3PMtIcV6fU/nkYqc+Nu8heKF5mhJmgJmf2Vlp2ZgqVA04PxvmZ/U2FRx40c9welNpABmDn0V33qUsjkrVMqKuyxD9aTpuAFd4SiH7SzA8Is1v7ltr3+Rx0lA/LI2u87uxYBawE7G3sNQA9siEnSPNm24uEK+4GcIuVG0qIvx36uYyBjB8dfn9FaMec/+22EFNKO0JWjIFXRl+TosE3VLFssaMQ2sl0rRkesLzb2DMFO/7kp0T3c1EcvRmy0AJ3UQmKZCtYBzy2a/9rx8sh1a+AUHObSeSeaP4eu+sMnMhSsDhveUiYMnV8viJXj0G0V6UIWP4j+Bv96H/AFgNi--OD4Iuvmt7P3BlyOR--nzDLthG3dBOX14A2J5s4CA==
|
data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/puma.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Puma can serve each request in a thread from an internal thread pool.
|
4
|
+
# The `threads` method setting takes two numbers: a minimum and maximum.
|
5
|
+
# Any libraries that use thread pools should be configured to match
|
6
|
+
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
7
|
+
# and maximum; this matches the default thread size of Active Record.
|
8
|
+
#
|
9
|
+
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
|
10
|
+
threads threads_count, threads_count
|
11
|
+
|
12
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
13
|
+
#
|
14
|
+
port ENV.fetch('PORT') { 3000 }
|
15
|
+
|
16
|
+
# Specifies the `environment` that Puma will run in.
|
17
|
+
#
|
18
|
+
environment ENV.fetch('RAILS_ENV') { 'development' }
|
19
|
+
|
20
|
+
# Specifies the `pidfile` that Puma will use.
|
21
|
+
pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' }
|
22
|
+
|
23
|
+
# Specifies the number of `workers` to boot in clustered mode.
|
24
|
+
# Workers are forked webserver processes. If using threads and workers together
|
25
|
+
# the concurrency of the application would be max `threads` * `workers`.
|
26
|
+
# Workers do not work on JRuby or Windows (both of which do not support
|
27
|
+
# processes).
|
28
|
+
#
|
29
|
+
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
30
|
+
|
31
|
+
# Use the `preload_app!` method when specifying a `workers` number.
|
32
|
+
# This directive tells Puma to first boot the application and load code
|
33
|
+
# before forking the application. This takes advantage of Copy On Write
|
34
|
+
# process behavior so workers use less memory.
|
35
|
+
#
|
36
|
+
# preload_app!
|
37
|
+
|
38
|
+
# Allow puma to be restarted by `rails restart` command.
|
39
|
+
plugin :tmp_restart
|
@@ -0,0 +1 @@
|
|
1
|
+
|
data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/lib/ability.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Ability < ::EacRailsBase0::AppBase::Ability
|
4
|
+
def initialize(user)
|
5
|
+
super(user)
|
6
|
+
user ||= ::EacUsersSupport::User.new
|
7
|
+
for_all_permissions(user)
|
8
|
+
logged_permissions(user) unless user.new_record?
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def for_all_permissions(_user)
|
14
|
+
can :read, :welcome
|
15
|
+
end
|
16
|
+
|
17
|
+
def logged_permissions(_user)
|
18
|
+
can :manage, :all
|
19
|
+
end
|
20
|
+
end
|
data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/public/favicon.ico
ADDED
File without changes
|
@@ -12,9 +12,10 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm
|
15
|
+
s.add_dependency 'avm', '~> 0.31'
|
16
|
+
s.add_dependency 'avm-eac_ruby_base1', '~> 0.11'
|
16
17
|
s.add_dependency 'avm-eac_webapp_base0', '~> 0.3'
|
17
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
18
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.97'
|
18
19
|
|
19
20
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
20
21
|
end
|
data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec/add_or_replace_gem_line.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacRubyBase1
|
7
|
+
module Rubygems
|
8
|
+
class Gemspec
|
9
|
+
class AddOrReplaceGemLine
|
10
|
+
enable_method_class
|
11
|
+
common_constructor :sender, :gem_name, :gem_specs
|
12
|
+
delegate :lines, to: :sender
|
13
|
+
|
14
|
+
DEPENDENCY_PREFIX = ' s.add_dependency'
|
15
|
+
|
16
|
+
def existing_gem_line_index
|
17
|
+
lines.index { |line| line.start_with?(gem_line_prefix) }
|
18
|
+
end
|
19
|
+
|
20
|
+
def result
|
21
|
+
if existing_gem_line_index.present?
|
22
|
+
replace_line
|
23
|
+
else
|
24
|
+
add_line
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_line
|
29
|
+
lines.insert(add_line_index, new_gem_line)
|
30
|
+
end
|
31
|
+
|
32
|
+
def add_line_index
|
33
|
+
(gems_lines_start_index..(lines.count - 1)).each do |e|
|
34
|
+
return e if new_gem_line < lines[e]
|
35
|
+
end
|
36
|
+
lines.count
|
37
|
+
end
|
38
|
+
|
39
|
+
def gems_lines_start_index
|
40
|
+
lines.index { |line| line.start_with?(DEPENDENCY_PREFIX) } || lines.count
|
41
|
+
end
|
42
|
+
|
43
|
+
def new_gem_line
|
44
|
+
([gem_line_prefix] + quoted_gem_specs).join(', ')
|
45
|
+
end
|
46
|
+
|
47
|
+
def gem_line_prefix
|
48
|
+
"#{DEPENDENCY_PREFIX} '#{gem_name}'"
|
49
|
+
end
|
50
|
+
|
51
|
+
def replace_line
|
52
|
+
lines[existing_gem_line_index] = new_gem_line
|
53
|
+
end
|
54
|
+
|
55
|
+
def quoted_gem_specs
|
56
|
+
gem_specs.map { |gem_spec| "'#{gem_spec}'" }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacRubyBase1
|
7
|
+
module Rubygems
|
8
|
+
class Gemspec
|
9
|
+
class Dependency
|
10
|
+
common_constructor :gemspec, :gem_name
|
11
|
+
|
12
|
+
def version_specs=(version_specs)
|
13
|
+
gemspec.add_or_replace_gem_line(gem_name, version_specs)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacRubyBase1
|
7
|
+
module Rubygems
|
8
|
+
class Gemspec
|
9
|
+
require_sub __FILE__, require_dependency: true
|
10
|
+
|
11
|
+
DEPENDENCY_LINE_PARSER = /s\.add_dependency\s*'(\S+)'/.to_parser { |m| m[1] }
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def from_file(path)
|
15
|
+
new(path.read.each_line.map(&:rstrip))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
common_constructor :lines
|
20
|
+
|
21
|
+
# @return [Avm::EacRubyBase1::Bundler::Gemfile::Dependency]
|
22
|
+
def dependency(gem_name)
|
23
|
+
::Avm::EacRubyBase1::Rubygems::Gemspec::Dependency.new(self, gem_name)
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Array<Avm::EacRubyBase1::Bundler::Gemfile::Dependency>]
|
27
|
+
def dependencies
|
28
|
+
lines.lazy.map { |line| DEPENDENCY_LINE_PARSER.parse(line) }.reject(&:blank?)
|
29
|
+
.map { |gem_name| dependency(gem_name) }.to_a
|
30
|
+
end
|
31
|
+
|
32
|
+
def write(path)
|
33
|
+
path.to_pathname.write(to_text)
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_text
|
37
|
+
lines.map { |line| "#{line}\n" }.join
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|