eac_tools 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +9 -9
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/lib/avm/application_stereotypes/base.rb +11 -1
  5. data/sub/avm/lib/avm/registry/application_stereotypes/build_available.rb +9 -6
  6. data/sub/avm/lib/avm/registry/application_stereotypes/stereotype_builder.rb +8 -5
  7. data/sub/avm/lib/avm/registry/source_generators.rb +16 -0
  8. data/sub/avm/lib/avm/registry.rb +2 -1
  9. data/sub/avm/lib/avm/source_generators/base.rb +29 -0
  10. data/sub/avm/lib/avm/source_generators.rb +9 -0
  11. data/sub/avm/lib/avm/version.rb +1 -1
  12. data/sub/avm/lib/avm/with_application_stereotype.rb +11 -1
  13. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/source_generators/base.rb +13 -0
  14. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
  15. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/Gemfile +11 -0
  16. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/Rakefile +8 -0
  17. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/config/manifest.js +3 -0
  18. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/javascripts/application.js +1 -0
  19. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/stylesheets/application.scss +1 -0
  20. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/controllers/application_controller.rb +4 -0
  21. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/controllers/welcome_controller.rb +5 -0
  22. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/views/welcome/index.html.erb +1 -0
  23. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/bundle +5 -0
  24. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/rails +11 -0
  25. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/rake +11 -0
  26. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/yarn +11 -0
  27. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/application.rb +11 -0
  28. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/boot.rb +5 -0
  29. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/cable.yml +8 -0
  30. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/credentials.yml.enc +1 -0
  31. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/environment.rb +7 -0
  32. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/puma.rb +39 -0
  33. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/routes.rb +5 -0
  34. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/spring.rb +8 -0
  35. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config.ru +7 -0
  36. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/db/schema.rb +1 -0
  37. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/lib/ability.rb +20 -0
  38. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/lib/ability_mapping.rb +10 -0
  39. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/public/favicon.ico +0 -0
  40. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/spec/ruby_style_spec.rb +3 -0
  41. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/spec/spec_helper.rb +8 -0
  42. data/sub/avm-tools/avm-tools.gemspec +1 -1
  43. data/sub/avm-tools/lib/avm/tools/runner/source_generate.rb +45 -0
  44. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  45. data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/base.rb +67 -0
  46. data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/sub_file.rb +68 -0
  47. data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +2 -125
  48. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  49. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{require_sub_spec → require_sub/base_spec}/stubbed_module_a.rb +0 -0
  50. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{require_sub_spec → require_sub/base_spec}/stubbed_not_module.rb +0 -0
  51. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{require_sub_spec.rb → require_sub/base_spec.rb} +1 -1
  52. metadata +49 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38f984e803945d01e0bd9befc7b53c3cbca3950a924195d50b50558f69812578
4
- data.tar.gz: 781bef8a0c526d89f19c70c042cbf6e6ddb461e297ca81cc64034288b2ebe3f4
3
+ metadata.gz: a8e7fe08b68334a93a53b8f91d2becce812f7e5489d36af3718477d77d651cbc
4
+ data.tar.gz: 484af66fe24d6907d195fb67af719ad79299d3ba978e2387e92737b2c1c72c8b
5
5
  SHA512:
6
- metadata.gz: 90ede8646c864d11fa0ccf495fc95307fca6e7707f5cb5649ab6b716cd95485a13dbe2db5d27ad80c0579e321b7cf6085be44e6784233a2b2f59bad63b877021
7
- data.tar.gz: d3c0986c5fcd2e5f89a8383974b2793f23e33a613c7a5e6cb76f6ee595a5fe3e635db49aff507bdd271343b9317ee0bab9a0b3669dc049beec18f3788027264d
6
+ metadata.gz: 76be1cd01e6f3874a9c3a0a987592cdee9957b723f0ed0dab109f95a0541abd49d62e76a1f3f6da2d633de6ba6bcc115893eb5b44f18180c1deba40c5c7c9b5d
7
+ data.tar.gz: 8d814b9bfa7c899a56a2721088e6285ca17af658c3e500ff64075682a59eccb0c7347145c2887313c2520cd9315916ff4c73529dc775f5714561b2c3581711b0
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.11.1)
4
+ eac_tools (0.12.0)
5
5
  avm-eac_generic_base0 (~> 0.4)
6
- avm-eac_rails_base0 (~> 0.5)
6
+ avm-eac_rails_base0 (~> 0.6)
7
7
  avm-eac_rails_base1 (~> 0.4, >= 0.4.1)
8
8
  avm-eac_redmine_base0 (~> 0.11)
9
9
  avm-eac_redmine_plugin_base0 (~> 0.3)
10
10
  avm-eac_ruby_base1 (~> 0.11)
11
- avm-tools (~> 0.126)
12
- eac_ruby_utils (~> 0.96)
11
+ avm-tools (~> 0.127)
12
+ eac_ruby_utils (~> 0.96, >= 0.96.1)
13
13
 
14
14
  PATH
15
15
  remote: sub/avm-eac_generic_base0
@@ -21,7 +21,7 @@ PATH
21
21
  PATH
22
22
  remote: sub/avm-eac_rails_base0
23
23
  specs:
24
- avm-eac_rails_base0 (0.5.0)
24
+ avm-eac_rails_base0 (0.6.0)
25
25
  avm-eac_rails_base1 (~> 0.3)
26
26
  eac_ruby_utils (~> 0.80, >= 0.80.2)
27
27
 
@@ -64,9 +64,9 @@ PATH
64
64
  PATH
65
65
  remote: sub/avm-tools
66
66
  specs:
67
- avm-tools (0.126.0)
67
+ avm-tools (0.127.0)
68
68
  aranha-parsers (~> 0.4)
69
- avm (~> 0.27)
69
+ avm (~> 0.30)
70
70
  avm-eac_asciidoctor_base0 (~> 0.3, >= 0.3.4)
71
71
  avm-eac_ruby_base1 (~> 0.8)
72
72
  avm-eac_ubuntu_base0 (~> 0.3)
@@ -81,7 +81,7 @@ PATH
81
81
  PATH
82
82
  remote: sub/avm
83
83
  specs:
84
- avm (0.29.0)
84
+ avm (0.30.0)
85
85
  eac_cli (~> 0.27, >= 0.27.6)
86
86
  eac_config (~> 0.9)
87
87
  eac_docker (~> 0.3)
@@ -134,7 +134,7 @@ PATH
134
134
  PATH
135
135
  remote: sub/eac_ruby_utils
136
136
  specs:
137
- eac_ruby_utils (0.96.0)
137
+ eac_ruby_utils (0.96.1)
138
138
  activesupport (>= 4, < 7)
139
139
  addressable (~> 2.6)
140
140
  bundler
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.11.1'
4
+ VERSION = '0.12.0'
5
5
  end
@@ -5,7 +5,11 @@ require 'eac_ruby_utils/core_ext'
5
5
  module Avm
6
6
  module ApplicationStereotypes
7
7
  class Base
8
- common_constructor :namespace_module, :instance_class, :source_class
8
+ enable_listable
9
+ lists.add_symbol :resource, :instance, :source, :source_generator
10
+ common_constructor :namespace_module, :resources do
11
+ self.resources = self.class.lists.resource.hash_keys_validate!(resources)
12
+ end
9
13
 
10
14
  # @return [String]
11
15
  def name
@@ -16,6 +20,12 @@ module Avm
16
20
  def to_s
17
21
  name
18
22
  end
23
+
24
+ lists.resource.each_value do |resource|
25
+ define_method "#{resource}_class" do
26
+ resources[resource]
27
+ end
28
+ end
19
29
  end
20
30
  end
21
31
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/application_stereotypes/base'
3
4
  require 'avm/registry/application_stereotypes/stereotype_builder'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
@@ -13,8 +14,7 @@ module Avm
13
14
 
14
15
  def result
15
16
  reset_buffer
16
- read_instances_registry
17
- read_sources_registry
17
+ read_registries
18
18
  buffer.values.map(&:build)
19
19
  end
20
20
 
@@ -29,12 +29,15 @@ module Avm
29
29
  buffer[object.stereotype_namespace_module].add_object(type, object)
30
30
  end
31
31
 
32
- def read_instances_registry
33
- ::Avm::Registry.instances.available.each { |instance| read_object(:instance, instance) }
32
+ def read_registries
33
+ ::Avm::ApplicationStereotypes::Base.lists.resource.each_value do |resource|
34
+ read_registry(resource)
35
+ end
34
36
  end
35
37
 
36
- def read_sources_registry
37
- ::Avm::Registry.sources.available.each { |source| read_object(:source, source) }
38
+ def read_registry(resource)
39
+ ::Avm::Registry.send(resource.to_s.pluralize).available
40
+ .each { |obj| read_object(resource, obj) }
38
41
  end
39
42
 
40
43
  def reset_buffer
@@ -10,20 +10,23 @@ module Avm
10
10
  common_constructor :namespace_module
11
11
 
12
12
  def add_object(type, object)
13
- attr_method = "#{type}_class"
14
- raise "#{attr_method} is already present" if send(attr_method).present?
13
+ type = type.to_sym
14
+ raise "#{attr_method} is already present" if resources.key?(type)
15
15
 
16
- send("#{attr_method}=", object)
16
+ resources[::Avm::ApplicationStereotypes::Base.lists.resource.value_validate!(type)] =
17
+ object
17
18
  end
18
19
 
19
20
  # @return [Avm::ApplicationStereotypes::Base]
20
21
  def build
21
- ::Avm::ApplicationStereotypes::Base.new(namespace_module, instance_class, source_class)
22
+ ::Avm::ApplicationStereotypes::Base.new(namespace_module, resources)
22
23
  end
23
24
 
24
25
  private
25
26
 
26
- attr_accessor :instance_class, :source_class
27
+ def resources
28
+ @resources ||= {}
29
+ end
27
30
  end
28
31
  end
29
32
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/base'
4
+ require 'avm/registry/from_gems'
5
+
6
+ module Avm
7
+ module Registry
8
+ class SourceGenerators < ::Avm::Registry::FromGems
9
+ # @return [Avm::Instances::Base, nil]
10
+ def class_detect(klass, detect_args)
11
+ stereotype_name, target_path = detect_args
12
+ klass.application_stereotype.name == stereotype_name ? klass.new(target_path) : nil
13
+ end
14
+ end
15
+ end
16
+ end
@@ -7,7 +7,8 @@ module Avm
7
7
  module Registry
8
8
  require_sub __FILE__
9
9
  enable_listable
10
- lists.add_symbol :category, :application_stereotypes, :instances, :runners, :scms, :sources
10
+ lists.add_symbol :category, :application_stereotypes, :instances, :runners, :scms,
11
+ :source_generators, :sources
11
12
 
12
13
  WITH_PATH = [CATEGORY_SCMS, CATEGORY_SOURCES].freeze
13
14
 
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/with_application_stereotype'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module SourceGenerators
8
+ class Base
9
+ include ::Avm::WithApplicationStereotype
10
+ common_constructor :target_path do
11
+ self.target_path = target_path.to_pathname
12
+ end
13
+
14
+ def perform
15
+ assert_clear_directory
16
+ apply_template
17
+ end
18
+
19
+ def assert_clear_directory
20
+ target_path.mkpath
21
+ raise "\"#{target_path}\" is not empty" if target_path.children.any?
22
+ end
23
+
24
+ def apply_template
25
+ template.apply(self, target_path)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module SourceGenerators
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.29.0'
4
+ VERSION = '0.30.0'
5
5
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/runner_with/subcommands'
4
3
  require 'eac_ruby_utils/core_ext'
5
4
 
6
5
  module Avm
@@ -10,6 +9,17 @@ module Avm
10
9
  end
11
10
 
12
11
  module ClassMethods
12
+ # @return [Avm::ApplicationStereotype::Base]
13
+ def application_stereotype
14
+ @application_stereotype ||=
15
+ ::Avm::Registry.application_stereotypes.detect(application_stereotype_name)
16
+ end
17
+
18
+ # @return [String]
19
+ def application_stereotype_name
20
+ stereotype_namespace_module.name.demodulize
21
+ end
22
+
13
23
  # @return [Module]
14
24
  def stereotype_namespace_module
15
25
  module_parent.module_parent
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/source_generators/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRailsBase0
8
+ module SourceGenerators
9
+ class Base < ::Avm::SourceGenerators::Base
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase0
5
- VERSION = '0.5.0'
5
+ VERSION = '0.6.0'
6
6
  end
7
7
  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,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationController < ::EacRailsBase0::ApplicationController
4
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class WelcomeController < ApplicationController
4
+ def index; end
5
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
5
+ load Gem.bin_path('bundler', 'bundle')
@@ -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
+ begin
5
+ load File.expand_path('spring', __dir__)
6
+ rescue LoadError => e
7
+ raise unless e.message.include?('spring')
8
+ end
9
+ require_relative '../config/boot'
10
+ require 'rake'
11
+ Rake.application.run
@@ -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,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
4
+
5
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1,8 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: async
6
+
7
+ production:
8
+ adapter: async
@@ -0,0 +1 @@
1
+ XKDkD3DioFn69hXAhH88mw9ZFRjDdarYU+7htxgTJmBB/vg45Hsb7pBJQaySoc7VD0Vb838ShDeVbhDlSc3PMtIcV6fU/nkYqc+Nu8heKF5mhJmgJmf2Vlp2ZgqVA04PxvmZ/U2FRx40c9welNpABmDn0V33qUsjkrVMqKuyxD9aTpuAFd4SiH7SzA8Is1v7ltr3+Rx0lA/LI2u87uxYBawE7G3sNQA9siEnSPNm24uEK+4GcIuVG0qIvx36uYyBjB8dfn9FaMec/+22EFNKO0JWjIFXRl+TosE3VLFssaMQ2sl0rRkesLzb2DMFO/7kp0T3c1EcvRmy0AJ3UQmKZCtYBzy2a/9rx8sh1a+AUHObSeSeaP4eu+sMnMhSsDhveUiYMnV8viJXj0G0V6UIWP4j+Bv96H/AFgNi--OD4Iuvmt7P3BlyOR--nzDLthG3dBOX14A2J5s4CA==
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the Rails application.
4
+ require_relative 'application'
5
+
6
+ # Initialize the Rails application.
7
+ Rails.application.initialize!
@@ -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,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::Rails.application.routes.draw do
4
+ root 'welcome#index'
5
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ %w[
4
+ .ruby-version
5
+ .rbenv-vars
6
+ tmp/restart.txt
7
+ tmp/caching-dev.txt
8
+ ].each { |path| Spring.watch(path) }
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is used by Rack-based servers to start the application.
4
+
5
+ require_relative 'config/environment'
6
+
7
+ run Rails.application
@@ -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
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/simple_cache'
4
+
5
+ class AbilityMapping < ::EacRailsBase0::AppBase::AbilityMapping
6
+ def initialize
7
+ super
8
+ map_action 'Welcome', 'index', :read, :welcome
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/rspec/default_setup'
4
+ ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
5
+
6
+ ::RSpec.configure do |conf|
7
+ conf.global_fixtures = :all
8
+ end
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
16
16
 
17
17
  s.add_dependency 'aranha-parsers', '~> 0.4'
18
- s.add_dependency 'avm', '~> 0.27'
18
+ s.add_dependency 'avm', '~> 0.30'
19
19
  s.add_dependency 'avm-eac_asciidoctor_base0', '~> 0.3', '>= 0.3.4'
20
20
  s.add_dependency 'avm-eac_ruby_base1', '~> 0.8'
21
21
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/runners/base'
4
+ require 'eac_cli/core_ext'
5
+
6
+ module Avm
7
+ module Tools
8
+ class Runner
9
+ class SourceGenerate
10
+ runner_with :help do
11
+ pos_arg :stereotype_name
12
+ pos_arg :target_path
13
+ end
14
+
15
+ def run
16
+ start_banner
17
+ generate
18
+ end
19
+
20
+ def generate
21
+ infom 'Generating...'
22
+ generator.perform
23
+ success "Source generated in \"#{generator.target_path}\""
24
+ end
25
+
26
+ def start_banner
27
+ infov 'Stereotype', stereotype_name
28
+ infov 'Target path', target_path
29
+ infov 'Generator', generator.class
30
+ end
31
+
32
+ def generator_uncached
33
+ ::Avm::Registry.source_generators.detect_optional(stereotype_name, target_path) ||
34
+ fatal_error("No generator found for stereotype \"#{stereotype_name}\"")
35
+ end
36
+
37
+ delegate :stereotype_name, to: :parsed
38
+
39
+ def target_path
40
+ parsed.target_path.to_pathname
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.126.0'
5
+ VERSION = '0.127.0'
6
6
  end
7
7
  end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/listable'
4
+ require 'eac_ruby_utils/require_sub/sub_file'
5
+
6
+ module EacRubyUtils
7
+ module RequireSub
8
+ class Base
9
+ INCLUDE_MODULES_MAP = {
10
+ nil => nil,
11
+ false => nil,
12
+ true => :include,
13
+ include: :include,
14
+ prepend: :prepend
15
+ }.freeze
16
+
17
+ include ::EacRubyUtils::Listable
18
+ lists.add_symbol :option, :base, :include_modules, :require_dependency
19
+
20
+ attr_reader :file, :options
21
+
22
+ def initialize(file, options = {})
23
+ @file = file
24
+ @options = self.class.lists.option.hash_keys_validate!(options)
25
+ end
26
+
27
+ # @return [Boolean]
28
+ def active_support_require?
29
+ options[OPTION_REQUIRE_DEPENDENCY] ? true : false
30
+ end
31
+
32
+ def apply
33
+ require_sub_files
34
+ include_modules
35
+ end
36
+
37
+ def base
38
+ options[OPTION_BASE] || raise('Option :base not setted')
39
+ end
40
+
41
+ def base?
42
+ options[OPTION_BASE] ? true : false
43
+ end
44
+
45
+ def include_modules
46
+ sub_files.each(&:include_module)
47
+ end
48
+
49
+ def include_or_prepend_method
50
+ return INCLUDE_MODULES_MAP.fetch(options[OPTION_INCLUDE_MODULES]) if
51
+ INCLUDE_MODULES_MAP.key?(options[OPTION_INCLUDE_MODULES])
52
+
53
+ raise ::ArgumentError, "Invalid value for 'options[OPTION_INCLUDE_MODULES]':" \
54
+ " \"#{options[OPTION_INCLUDE_MODULES]}\""
55
+ end
56
+
57
+ def require_sub_files
58
+ sub_files.each(&:require_file)
59
+ end
60
+
61
+ def sub_files
62
+ @sub_files ||= Dir["#{File.dirname(file)}/#{::File.basename(file, '.*')}/*.rb"].sort
63
+ .map { |path| ::EacRubyUtils::RequireSub::SubFile.new(self, path) }
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/dependencies'
4
+ require 'active_support/inflector'
5
+
6
+ module EacRubyUtils
7
+ module RequireSub
8
+ class SubFile
9
+ attr_reader :owner, :path
10
+
11
+ def initialize(owner, path)
12
+ @owner = owner
13
+ @path = path
14
+ end
15
+
16
+ def base_constant
17
+ return nil unless owner.base?
18
+
19
+ owner.base.const_get(constant_name)
20
+ rescue ::NameError
21
+ nil
22
+ end
23
+
24
+ def constant_name
25
+ ::ActiveSupport::Inflector.camelize(::File.basename(path, '.rb'))
26
+ end
27
+
28
+ def include_module
29
+ return unless module?
30
+
31
+ owner.include_or_prepend_method.if_present do |v|
32
+ owner.base.send(v, base_constant)
33
+ end
34
+ end
35
+
36
+ def module?
37
+ base_constant.is_a?(::Module) && !base_constant.is_a?(::Class)
38
+ end
39
+
40
+ def require_file
41
+ active_support_require || autoload_require || kernel_require
42
+ end
43
+
44
+ private
45
+
46
+ def active_support_require
47
+ return false unless owner.active_support_require?
48
+
49
+ ::Kernel.require_dependency(path)
50
+ true
51
+ end
52
+
53
+ def autoload_require
54
+ return false unless owner.base?
55
+
56
+ basename = ::File.basename(path, '.*')
57
+ return false if basename.start_with?('_')
58
+
59
+ owner.base.autoload ::ActiveSupport::Inflector.camelize(basename), path
60
+ true
61
+ end
62
+
63
+ def kernel_require
64
+ ::Kernel.require(path)
65
+ end
66
+ end
67
+ end
68
+ end
@@ -1,134 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/inflector'
4
- require 'active_support/dependencies'
5
- require 'eac_ruby_utils/listable'
3
+ require 'eac_ruby_utils/require_sub/base'
6
4
 
7
5
  module EacRubyUtils
8
6
  class << self
9
7
  def require_sub(file, options = {})
10
- ::EacRubyUtils::RequireSub.new(file, options).apply
11
- end
12
- end
13
-
14
- class RequireSub
15
- INCLUDE_MODULES_MAP = {
16
- nil => nil,
17
- false => nil,
18
- true => :include,
19
- include: :include,
20
- prepend: :prepend
21
- }.freeze
22
-
23
- include ::EacRubyUtils::Listable
24
- lists.add_symbol :option, :base, :include_modules, :require_dependency
25
-
26
- attr_reader :file, :options
27
-
28
- def initialize(file, options = {})
29
- @file = file
30
- @options = self.class.lists.option.hash_keys_validate!(options)
31
- end
32
-
33
- def apply
34
- require_sub_files
35
- include_modules
36
- end
37
-
38
- def base
39
- options[OPTION_BASE] || raise('Option :base not setted')
40
- end
41
-
42
- def base?
43
- options[OPTION_BASE] ? true : false
44
- end
45
-
46
- def include_modules
47
- sub_files.each(&:include_module)
48
- end
49
-
50
- def include_or_prepend_method
51
- return INCLUDE_MODULES_MAP.fetch(options[OPTION_INCLUDE_MODULES]) if
52
- INCLUDE_MODULES_MAP.key?(options[OPTION_INCLUDE_MODULES])
53
-
54
- raise ::ArgumentError, "Invalid value for 'options[OPTION_INCLUDE_MODULES]':" \
55
- " \"#{options[OPTION_INCLUDE_MODULES]}\""
56
- end
57
-
58
- def require_sub_files
59
- sub_files.each(&:require_file)
60
- end
61
-
62
- def sub_files
63
- @sub_files ||= Dir["#{File.dirname(file)}/#{::File.basename(file, '.*')}/*.rb"].sort
64
- .map { |path| SubFile.new(self, path) }
65
- end
66
-
67
- class SubFile
68
- attr_reader :owner, :path
69
-
70
- def initialize(owner, path)
71
- @owner = owner
72
- @path = path
73
- end
74
-
75
- def base_constant
76
- return nil unless owner.base?
77
-
78
- owner.base.const_get(constant_name)
79
- rescue ::NameError
80
- nil
81
- end
82
-
83
- def constant_name
84
- ::ActiveSupport::Inflector.camelize(::File.basename(path, '.rb'))
85
- end
86
-
87
- def include_module
88
- return unless module?
89
-
90
- owner.include_or_prepend_method.if_present do |v|
91
- owner.base.send(v, base_constant)
92
- end
93
- end
94
-
95
- def include_or_prepend_method
96
- return :include if owner.options[OPTION_INCLUDE_MODULES]
97
- return :prepend if owner.options[OPTION_PREPEND_MODULES]
98
-
99
- nil
100
- end
101
-
102
- def module?
103
- base_constant.is_a?(::Module) && !base_constant.is_a?(::Class)
104
- end
105
-
106
- def require_file
107
- active_support_require || autoload_require || kernel_require
108
- end
109
-
110
- private
111
-
112
- def active_support_require
113
- return false unless owner.options[OPTION_REQUIRE_DEPENDENCY]
114
-
115
- ::Kernel.require_dependency(path)
116
- true
117
- end
118
-
119
- def autoload_require
120
- return false unless owner.base?
121
-
122
- basename = ::File.basename(path, '.*')
123
- return false if basename.start_with?('_')
124
-
125
- owner.base.autoload ::ActiveSupport::Inflector.camelize(basename), path
126
- true
127
- end
128
-
129
- def kernel_require
130
- ::Kernel.require(path)
131
- end
8
+ ::EacRubyUtils::RequireSub::Base.new(file, options).apply
132
9
  end
133
10
  end
134
11
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.96.0'
4
+ VERSION = '0.96.1'
5
5
  end
@@ -5,7 +5,7 @@ require 'eac_ruby_utils/require_sub'
5
5
  class RequireSubStubClass
6
6
  end
7
7
 
8
- RSpec.describe ::EacRubyUtils::RequireSub do
8
+ RSpec.describe ::EacRubyUtils::RequireSub::Base do
9
9
  let(:instance) { described_class.new(__FILE__, base: RequireSubStubClass, include_modules: true) }
10
10
 
11
11
  before do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-26 00:00:00.000000000 Z
11
+ date: 2022-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm-eac_generic_base0
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.5'
33
+ version: '0.6'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.5'
40
+ version: '0.6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: avm-eac_rails_base1
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -106,14 +106,14 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '0.126'
109
+ version: '0.127'
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '0.126'
116
+ version: '0.127'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: eac_ruby_utils
119
119
  requirement: !ruby/object:Gem::Requirement
@@ -121,6 +121,9 @@ dependencies:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0.96'
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: 0.96.1
124
127
  type: :runtime
125
128
  prerelease: false
126
129
  version_requirements: !ruby/object:Gem::Requirement
@@ -128,6 +131,9 @@ dependencies:
128
131
  - - "~>"
129
132
  - !ruby/object:Gem::Version
130
133
  version: '0.96'
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: 0.96.1
131
137
  - !ruby/object:Gem::Dependency
132
138
  name: eac_ruby_gem_support
133
139
  requirement: !ruby/object:Gem::Requirement
@@ -175,6 +181,7 @@ files:
175
181
  - sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/instance.rb
176
182
  - sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/runners.rb
177
183
  - sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/runners/base.rb
184
+ - sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/source_generators/base.rb
178
185
  - sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/sources/base.rb
179
186
  - sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb
180
187
  - sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_host_spec.rb
@@ -186,6 +193,33 @@ files:
186
193
  - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/apache_path/extra_content.conf
187
194
  - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/deploy/config/database.yml.template
188
195
  - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/deploy/config/envvars.d/email.yml.template
196
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/Gemfile
197
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/Rakefile
198
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/config/manifest.js
199
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/javascripts/application.js
200
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/stylesheets/application.scss
201
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/controllers/application_controller.rb
202
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/controllers/welcome_controller.rb
203
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/views/welcome/index.html.erb
204
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/bundle
205
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/rails
206
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/rake
207
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/yarn
208
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config.ru
209
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/application.rb
210
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/boot.rb
211
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/cable.yml
212
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/credentials.yml.enc
213
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/environment.rb
214
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/puma.rb
215
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/routes.rb
216
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/spring.rb
217
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/db/schema.rb
218
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/lib/ability.rb
219
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/lib/ability_mapping.rb
220
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/public/favicon.ico
221
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/spec/ruby_style_spec.rb
222
+ - sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/spec/spec_helper.rb
189
223
  - sub/avm-eac_rails_base1/Gemfile
190
224
  - sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec
191
225
  - sub/avm-eac_rails_base1/lib/avm/eac_rails_base1.rb
@@ -455,6 +489,7 @@ files:
455
489
  - sub/avm-tools/lib/avm/tools/runner/self.rb
456
490
  - sub/avm-tools/lib/avm/tools/runner/self/docker.rb
457
491
  - sub/avm-tools/lib/avm/tools/runner/self/registry.rb
492
+ - sub/avm-tools/lib/avm/tools/runner/source_generate.rb
458
493
  - sub/avm-tools/lib/avm/tools/self.rb
459
494
  - sub/avm-tools/lib/avm/tools/version.rb
460
495
  - sub/avm-tools/locale/en.yml
@@ -1024,6 +1059,7 @@ files:
1024
1059
  - sub/avm/lib/avm/registry/instances.rb
1025
1060
  - sub/avm/lib/avm/registry/runners.rb
1026
1061
  - sub/avm/lib/avm/registry/scms.rb
1062
+ - sub/avm/lib/avm/registry/source_generators.rb
1027
1063
  - sub/avm/lib/avm/registry/sources.rb
1028
1064
  - sub/avm/lib/avm/registry/with_path.rb
1029
1065
  - sub/avm/lib/avm/registry/with_path/cache.rb
@@ -1040,6 +1076,8 @@ files:
1040
1076
  - sub/avm/lib/avm/self/docker_image.rb
1041
1077
  - sub/avm/lib/avm/self/instance.rb
1042
1078
  - sub/avm/lib/avm/self/instance/entry_keys.rb
1079
+ - sub/avm/lib/avm/source_generators.rb
1080
+ - sub/avm/lib/avm/source_generators/base.rb
1043
1081
  - sub/avm/lib/avm/sources.rb
1044
1082
  - sub/avm/lib/avm/sources/base.rb
1045
1083
  - sub/avm/lib/avm/sources/base/configuration.rb
@@ -1379,6 +1417,8 @@ files:
1379
1417
  - sub/eac_ruby_utils/lib/eac_ruby_utils/recursive_builder.rb
1380
1418
  - sub/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb
1381
1419
  - sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb
1420
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/base.rb
1421
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/sub_file.rb
1382
1422
  - sub/eac_ruby_utils/lib/eac_ruby_utils/rspec.rb
1383
1423
  - sub/eac_ruby_utils/lib/eac_ruby_utils/rspec/default_setup.rb
1384
1424
  - sub/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup.rb
@@ -1441,9 +1481,9 @@ files:
1441
1481
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
1442
1482
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/string/delimited_spec.rb
1443
1483
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/recursive_builder_spec.rb
1444
- - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec.rb
1445
- - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec/stubbed_module_a.rb
1446
- - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec/stubbed_not_module.rb
1484
+ - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub/base_spec.rb
1485
+ - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub/base_spec/stubbed_module_a.rb
1486
+ - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub/base_spec/stubbed_not_module.rb
1447
1487
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/ruby_spec.rb
1448
1488
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb
1449
1489
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb