eac_tools 0.41.0 → 0.43.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 -23
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +4 -4
- data/sub/avm/lib/avm/applications/base.rb +24 -3
- data/sub/avm/lib/avm/entries/entry.rb +5 -0
- data/sub/avm/lib/avm/instances/base.rb +5 -12
- data/sub/avm/lib/avm/instances/ids.rb +30 -0
- data/sub/avm/lib/avm/rspec/setup.rb +8 -0
- data/sub/avm/lib/avm/sources/base/instance.rb +2 -14
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm/spec/spec_helper.rb +1 -1
- data/sub/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +1 -1
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/base.rb +18 -0
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/header_macro_value.rb +78 -0
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/pre_process_line.rb +50 -0
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document.rb +71 -0
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/{sources → instances}/build.rb +10 -3
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/deploy.rb +4 -4
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document/title.rb +28 -0
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb +47 -0
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/theme.rb +40 -0
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb +7 -0
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/build.rb +5 -3
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec.rb +32 -0
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec_files/pre_processed_root_body.adoc +16 -0
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec.rb +48 -0
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/{sources → instances}/build_spec_files/doc1.html +0 -0
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/{sources → instances}/build_spec_files/doc2/doc2_1.html +0 -0
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/{sources → instances}/build_spec_files/doc2.html +0 -0
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/{sources → instances}/build_spec_files/index.html +0 -0
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/content/body.adoc +1 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/content/title +1 -0
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/theme/main.css +0 -0
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/base_spec.rb +14 -0
- data/sub/avm-eac_asciidoctor_base0/spec/spec_helper.rb +1 -4
- data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/content/body.adoc +1 -1
- data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/content/title +1 -0
- data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/theme/main.css +0 -0
- data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base/dependencies.rb +27 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base/gemfile_lock.rb +27 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base/options.rb +30 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base/version_builder.rb +52 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base.rb +1 -66
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
- data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec.rb +2 -1
- data/sub/eac_cli/eac_cli.gemspec +2 -2
- data/sub/eac_cli/lib/eac_cli/config/entry.rb +4 -0
- data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
- data/sub/eac_config/eac_config.gemspec +2 -2
- data/sub/eac_config/lib/eac_config/entry/not_found_error.rb +13 -0
- data/sub/eac_config/lib/eac_config/entry.rb +7 -0
- data/sub/eac_config/lib/eac_config/version.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +15 -6
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +5 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +9 -2
- metadata +34 -29
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build/document.rb +0 -84
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/build_spec.rb +0 -32
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'asciidoctor'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacAsciidoctorBase0
|
8
|
+
module Sources
|
9
|
+
class Base
|
10
|
+
class Document
|
11
|
+
enable_simple_cache
|
12
|
+
enable_speaker
|
13
|
+
require_sub __FILE__, include_modules: true
|
14
|
+
common_constructor :source, :parent_document, :basename
|
15
|
+
|
16
|
+
# Absolute path to the Asciidoctor file.
|
17
|
+
#
|
18
|
+
# @return [Pathname]
|
19
|
+
def body_path
|
20
|
+
root_path.join(
|
21
|
+
::Avm::EacAsciidoctorBase0::Sources::Base::CONTENT_DOCUMENT_BASENAME
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Absolute path to the document's source root.
|
26
|
+
#
|
27
|
+
# @return [Pathname]
|
28
|
+
def root_path
|
29
|
+
source.content_directory.join(subpath)
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Pathname]
|
33
|
+
def subpath
|
34
|
+
parent_document.if_present('.'.to_pathname) { |pd| pd.subpath.join(basename) }
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def children_uncached
|
40
|
+
root_path.children.select(&:directory?)
|
41
|
+
.map { |path| self.class.new(source, self, path.basename) }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'asciidoctor'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacAsciidoctorBase0
|
8
|
+
module Sources
|
9
|
+
class Base
|
10
|
+
module Theme
|
11
|
+
CONFIGURATION_THEME_KEY = 'theme'
|
12
|
+
DEFAULT_THEME_DIRECTORY_SUBPATH = 'theme'
|
13
|
+
THEME_STYLESHEET_BASENAME = 'main.css'
|
14
|
+
|
15
|
+
# @return [Pathname]
|
16
|
+
def default_theme_directory
|
17
|
+
path.join(DEFAULT_THEME_DIRECTORY_SUBPATH)
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [Pathname]
|
21
|
+
def theme_directory
|
22
|
+
theme_directory_by_configuration || default_theme_directory
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Pathname]
|
26
|
+
def theme_directory_by_configuration
|
27
|
+
configuration_entry(CONFIGURATION_THEME_KEY).value.if_present do |v|
|
28
|
+
v.to_pathname.expand_path(path)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Pathname]
|
33
|
+
def theme_stylesheet_path
|
34
|
+
theme_directory.join(THEME_STYLESHEET_BASENAME)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -12,10 +12,17 @@ module Avm
|
|
12
12
|
CONTENT_DOCUMENT_BASENAME = ::Pathname.new('body.adoc')
|
13
13
|
MAIN_FILE_SUBPATH = CONTENT_DIRECTORY_SUBPATH.join(CONTENT_DOCUMENT_BASENAME)
|
14
14
|
|
15
|
+
require_sub __FILE__, include_modules: true
|
16
|
+
|
15
17
|
def content_directory
|
16
18
|
path.join(CONTENT_DIRECTORY_SUBPATH)
|
17
19
|
end
|
18
20
|
|
21
|
+
# @return [Avm::EacAsciidoctorBase0::Sources::Base::Document
|
22
|
+
def root_document
|
23
|
+
::Avm::EacAsciidoctorBase0::Sources::Base::Document.new(self, nil, nil)
|
24
|
+
end
|
25
|
+
|
19
26
|
def valid?
|
20
27
|
path.join(MAIN_FILE_SUBPATH).file?
|
21
28
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/eac_asciidoctor_base0/
|
3
|
+
require 'avm/eac_asciidoctor_base0/instances/build'
|
4
4
|
require 'eac_cli/core_ext'
|
5
5
|
require 'os'
|
6
6
|
|
@@ -24,8 +24,10 @@ module Avm
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def build_uncached
|
27
|
-
::Avm::EacAsciidoctorBase0::
|
28
|
-
|
27
|
+
::Avm::EacAsciidoctorBase0::Instances::Build.new(
|
28
|
+
runner_context.call(:source).instance,
|
29
|
+
target_directory: parsed.target_dir
|
30
|
+
)
|
29
31
|
end
|
30
32
|
|
31
33
|
def default_target_directory
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_asciidoctor_base0/sources/base'
|
4
|
+
require 'avm/eac_asciidoctor_base0/instances/build'
|
5
|
+
|
6
|
+
::RSpec.describe ::Avm::EacAsciidoctorBase0::Instances::Build::Document do
|
7
|
+
let(:application) { ::Avm::Applications::Base.new('myapp') }
|
8
|
+
let(:application_instance) do
|
9
|
+
::Avm::EacAsciidoctorBase0::Instances::Base
|
10
|
+
.new(application, 'stub')
|
11
|
+
end
|
12
|
+
let(:build) { ::Avm::EacAsciidoctorBase0::Instances::Build.new(application_instance) }
|
13
|
+
let(:fixtures_dir) { __dir__.to_pathname.join('document_spec_files') }
|
14
|
+
let(:instance) { build.root_document }
|
15
|
+
let(:source) { avm_source('EacAsciidoctorBase0', target_basename: application.id) }
|
16
|
+
let(:target_file) { fixtures_dir.join('pre_processed_root_body.adoc') }
|
17
|
+
|
18
|
+
before do
|
19
|
+
application.entry('stereotype').write('EacAsciidoctorBase0')
|
20
|
+
::EacConfig::Node.context.current.entry("#{application.id}_dev.install.path")
|
21
|
+
.value = source.path.to_path
|
22
|
+
application_instance.entry('install.path').write(source.path.to_path)
|
23
|
+
application_instance.entry('install.name').write('The Author')
|
24
|
+
application_instance.entry('install.name_initials').write('T.A.')
|
25
|
+
application_instance.entry('install.email').write('theauthor@example.net')
|
26
|
+
application_instance.entry('web.url').write('https://www.example.net')
|
27
|
+
end
|
28
|
+
|
29
|
+
it do
|
30
|
+
expect(instance.pre_processed_body_source_content).to eq(target_file.read)
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
:stylesheet: ../theme/main.css
|
2
|
+
= EacAsciidoctorBase0 Generated Source
|
3
|
+
The Author <theauthor@example.net>
|
4
|
+
:Author Initials: T.A.
|
5
|
+
:toc: left
|
6
|
+
:icons:
|
7
|
+
:numbered:
|
8
|
+
:website: https://www.example.net
|
9
|
+
|
10
|
+
== First Section
|
11
|
+
|
12
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sapien.
|
13
|
+
|
14
|
+
== Second Section
|
15
|
+
|
16
|
+
Nam faucibus quis dui at laoreet. Pellentesque ut sapien est.
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_asciidoctor_base0/sources/base'
|
4
|
+
require 'avm/eac_asciidoctor_base0/instances/build'
|
5
|
+
require 'eac_fs/comparator'
|
6
|
+
|
7
|
+
::RSpec.describe ::Avm::EacAsciidoctorBase0::Instances::Build do # rubocop:disable Metrics/BlockLength
|
8
|
+
let(:application) { ::Avm::Applications::Base.new('myapp') }
|
9
|
+
let(:application_instance) do
|
10
|
+
::Avm::EacAsciidoctorBase0::Instances::Base
|
11
|
+
.new(application, 'stub')
|
12
|
+
end
|
13
|
+
let(:fixtures_dir) { __dir__.to_pathname.join('build_spec_files') }
|
14
|
+
let(:fs_comparator) { ::EacFs::Comparator.new.truncate_file('*.html') }
|
15
|
+
let(:instance) { described_class.new(application_instance) }
|
16
|
+
let(:source) { avm_source('EacAsciidoctorBase0', target_basename: application.id) }
|
17
|
+
let(:target_dir) { fixtures_dir }
|
18
|
+
let(:main_document) do
|
19
|
+
source.path.join(::Avm::EacAsciidoctorBase0::Sources::Base::MAIN_FILE_SUBPATH)
|
20
|
+
end
|
21
|
+
|
22
|
+
before do
|
23
|
+
application.entry('stereotype').write('EacAsciidoctorBase0')
|
24
|
+
::EacConfig::Node.context.current.entry("#{application.id}_dev.install.path")
|
25
|
+
.value = source.path.to_path
|
26
|
+
application_instance.entry('install.name').write('The Author')
|
27
|
+
application_instance.entry('install.name_initials').write('T.A.')
|
28
|
+
application_instance.entry('install.email').write('theauthor@example.net')
|
29
|
+
application_instance.entry('web.url').write('https://www.example.net')
|
30
|
+
%w[doc1 doc2 doc2/doc2_1].each do |subpath|
|
31
|
+
target_dir = source.content_directory.join(subpath)
|
32
|
+
target_dir.mkpath
|
33
|
+
::FileUtils.cp(
|
34
|
+
main_document,
|
35
|
+
target_dir.join(::Avm::EacAsciidoctorBase0::Sources::Base::CONTENT_DOCUMENT_BASENAME)
|
36
|
+
)
|
37
|
+
::FileUtils.cp(
|
38
|
+
source.root_document.title_path,
|
39
|
+
target_dir.join(::Avm::EacAsciidoctorBase0::Sources::Base::Document::TITLE_BASENAME)
|
40
|
+
)
|
41
|
+
end
|
42
|
+
instance.perform
|
43
|
+
end
|
44
|
+
|
45
|
+
it do
|
46
|
+
expect(fs_comparator.build(instance.target_directory)).to eq(fs_comparator.build(target_dir))
|
47
|
+
end
|
48
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
EacAsciidoctorBase0 Generated Source
|
File without changes
|
@@ -1,7 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/eac_asciidoctor_base0/instances/base'
|
3
4
|
require 'avm/eac_asciidoctor_base0/sources/base'
|
4
5
|
|
5
6
|
::RSpec.describe ::Avm::EacAsciidoctorBase0::Sources::Base do
|
6
7
|
include_examples 'in_avm_registry', 'sources'
|
8
|
+
|
9
|
+
describe '#instance' do
|
10
|
+
let(:application) { ::Avm::Applications::Base.new('myapp') }
|
11
|
+
let(:source) { avm_source('EacAsciidoctorBase0', target_basename: application.id) }
|
12
|
+
|
13
|
+
before do
|
14
|
+
application.local_source_path_entry.value = source.path
|
15
|
+
end
|
16
|
+
|
17
|
+
it do
|
18
|
+
expect(source.instance).to be_a(::Avm::EacAsciidoctorBase0::Instances::Base)
|
19
|
+
end
|
20
|
+
end
|
7
21
|
end
|
@@ -2,7 +2,4 @@
|
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/rspec/default_setup'
|
4
4
|
::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
|
5
|
-
|
6
|
-
require 'eac_ruby_utils/speaker'
|
7
|
-
require 'eac_ruby_utils/rspec/stub_speaker'
|
8
|
-
::EacRubyUtils::Speaker.context.push(::EacRubyUtils::Rspec::StubSpeaker.new)
|
5
|
+
.stub_avm_contexts
|
@@ -0,0 +1 @@
|
|
1
|
+
EacAsciidoctorBase0 Generated Source
|
File without changes
|
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,locale,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm', '~> 0.
|
15
|
+
s.add_dependency 'avm', '~> 0.55'
|
16
16
|
s.add_dependency 'avm-eac_generic_base0', '~> 0.8'
|
17
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
17
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.107'
|
18
18
|
|
19
19
|
s.add_development_dependency 'aranha-parsers', '~> 0.14', '>= 0.14.1'
|
20
20
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_ruby_base1/source_generators/base/version_builder'
|
4
|
+
require 'avm/source_generators/base'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module EacRubyBase1
|
9
|
+
module SourceGenerators
|
10
|
+
class Base < ::Avm::SourceGenerators::Base
|
11
|
+
module Dependencies
|
12
|
+
def eac_ruby_gem_support_version
|
13
|
+
dependency_version('eac_ruby_gem_support')
|
14
|
+
end
|
15
|
+
|
16
|
+
def eac_ruby_utils_version
|
17
|
+
dependency_version('eac_ruby_utils')
|
18
|
+
end
|
19
|
+
|
20
|
+
def dependency_version(gem_name)
|
21
|
+
::Avm::EacRubyBase1::SourceGenerators::Base::VersionBuilder.new(gem_name, options).to_s
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_ruby_base1/source_generators/base/options'
|
4
|
+
require 'avm/source_generators/base'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module EacRubyBase1
|
9
|
+
module SourceGenerators
|
10
|
+
class Base < ::Avm::SourceGenerators::Base
|
11
|
+
module GemfileLock
|
12
|
+
def generate_gemfile_lock
|
13
|
+
return unless generate_gemfile_lock?
|
14
|
+
|
15
|
+
self_gem.bundle('install').chdir_root.execute!
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Boolean]
|
19
|
+
def generate_gemfile_lock?
|
20
|
+
options[::Avm::EacRubyBase1::SourceGenerators::Base::Options::GEMFILE_LOCK_OPTION]
|
21
|
+
.to_bool
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,30 @@
|
|
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 EacRubyBase1
|
8
|
+
module SourceGenerators
|
9
|
+
class Base < ::Avm::SourceGenerators::Base
|
10
|
+
module Options
|
11
|
+
common_concern
|
12
|
+
|
13
|
+
GEMFILE_LOCK_OPTION = 'gemfile-lock'.to_sym
|
14
|
+
|
15
|
+
OPTIONS = {
|
16
|
+
'eac-ruby-utils-version'.to_sym => 'Version for "eac_ruby_utils" gem.',
|
17
|
+
'eac-ruby-gem-support-version'.to_sym => 'Version for "eac_ruby_gem_support" gem.',
|
18
|
+
GEMFILE_LOCK_OPTION => 'Run "bundle install" at the end'
|
19
|
+
}.freeze
|
20
|
+
|
21
|
+
module ClassMethods
|
22
|
+
def option_list
|
23
|
+
OPTIONS.inject(super) { |a, e| a.option(*e) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,52 @@
|
|
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 EacRubyBase1
|
8
|
+
module SourceGenerators
|
9
|
+
class Base < ::Avm::SourceGenerators::Base
|
10
|
+
class VersionBuilder
|
11
|
+
enable_simple_cache
|
12
|
+
common_constructor :gem_name, :options
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
r = "'~> #{two_segments}'"
|
16
|
+
r += ", '>= #{three_segments}'" if segments.count >= 3 && segments[2].positive?
|
17
|
+
r
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [Gem::Version]
|
21
|
+
def version
|
22
|
+
(options_version || default_version)
|
23
|
+
end
|
24
|
+
|
25
|
+
def two_segments
|
26
|
+
segments.first(2).join('.')
|
27
|
+
end
|
28
|
+
|
29
|
+
def three_segments
|
30
|
+
segments.first(3).join('.')
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def segments_uncached
|
36
|
+
version.release.to_s.split('.').map(&:to_i)
|
37
|
+
end
|
38
|
+
|
39
|
+
def default_version
|
40
|
+
::Gem.loaded_specs[gem_name].version
|
41
|
+
end
|
42
|
+
|
43
|
+
def options_version
|
44
|
+
options["#{gem_name}_version".dasherize.to_sym].if_present do |v|
|
45
|
+
::Gem::Version.new(v)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -12,32 +12,15 @@ module Avm
|
|
12
12
|
IDENT = ' '
|
13
13
|
JOBS = %w[root_directory gemspec root_lib version_lib static gemfile_lock].freeze
|
14
14
|
TEMPLATE_VARIABLES = %w[lib_path name root_module].freeze
|
15
|
-
OPTIONS = {
|
16
|
-
'eac-ruby-utils-version'.to_sym => 'Version for "eac_ruby_utils" gem.',
|
17
|
-
'eac-ruby-gem-support-version'.to_sym => 'Version for "eac_ruby_gem_support" gem.'
|
18
|
-
}.freeze
|
19
15
|
|
20
16
|
enable_speaker
|
21
17
|
enable_simple_cache
|
22
|
-
|
23
|
-
class << self
|
24
|
-
def option_list
|
25
|
-
OPTIONS.inject(super) { |a, e| a.option(*e) }
|
26
|
-
end
|
27
|
-
end
|
18
|
+
require_sub __FILE__, include_modules: true
|
28
19
|
|
29
20
|
def root_directory
|
30
21
|
target_path
|
31
22
|
end
|
32
23
|
|
33
|
-
def eac_ruby_gem_support_version
|
34
|
-
dependency_version('eac_ruby_gem_support')
|
35
|
-
end
|
36
|
-
|
37
|
-
def eac_ruby_utils_version
|
38
|
-
dependency_version('eac_ruby_utils')
|
39
|
-
end
|
40
|
-
|
41
24
|
def name
|
42
25
|
root_directory.basename.to_s
|
43
26
|
end
|
@@ -93,18 +76,10 @@ module Avm
|
|
93
76
|
end
|
94
77
|
end
|
95
78
|
|
96
|
-
def dependency_version(gem_name)
|
97
|
-
VersionBuilder.new(gem_name, options).to_s
|
98
|
-
end
|
99
|
-
|
100
79
|
def generate_gemspec
|
101
80
|
template_apply('gemspec', "#{name}.gemspec")
|
102
81
|
end
|
103
82
|
|
104
|
-
def generate_gemfile_lock
|
105
|
-
self_gem.bundle('install').chdir_root.execute!
|
106
|
-
end
|
107
|
-
|
108
83
|
def generate_root_directory
|
109
84
|
root_directory.mkpath
|
110
85
|
end
|
@@ -130,46 +105,6 @@ module Avm
|
|
130
105
|
target.dirname.mkpath
|
131
106
|
template.child("#{from}.template").apply_to_file(self, target.to_path)
|
132
107
|
end
|
133
|
-
|
134
|
-
class VersionBuilder
|
135
|
-
enable_simple_cache
|
136
|
-
common_constructor :gem_name, :options
|
137
|
-
|
138
|
-
def to_s
|
139
|
-
r = "'~> #{two_segments}'"
|
140
|
-
r += ", '>= #{three_segments}'" if segments.count >= 3 && segments[2].positive?
|
141
|
-
r
|
142
|
-
end
|
143
|
-
|
144
|
-
# @return [Gem::Version]
|
145
|
-
def version
|
146
|
-
(options_version || default_version)
|
147
|
-
end
|
148
|
-
|
149
|
-
def two_segments
|
150
|
-
segments.first(2).join('.')
|
151
|
-
end
|
152
|
-
|
153
|
-
def three_segments
|
154
|
-
segments.first(3).join('.')
|
155
|
-
end
|
156
|
-
|
157
|
-
private
|
158
|
-
|
159
|
-
def segments_uncached
|
160
|
-
version.release.to_s.split('.').map(&:to_i)
|
161
|
-
end
|
162
|
-
|
163
|
-
def default_version
|
164
|
-
::Gem.loaded_specs[gem_name].version
|
165
|
-
end
|
166
|
-
|
167
|
-
def options_version
|
168
|
-
options["#{gem_name}_version".dasherize.to_sym].if_present do |v|
|
169
|
-
::Gem::Version.new(v)
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
108
|
end
|
174
109
|
end
|
175
110
|
end
|
@@ -7,7 +7,8 @@ RSpec.describe ::Avm::EacRubyBase1::SourceGenerators::Base do
|
|
7
7
|
include_examples 'avm_source_generated', __FILE__, 'EacRubyBase1',
|
8
8
|
{
|
9
9
|
'eac-ruby-utils-version' => '0.35.0',
|
10
|
-
'eac-ruby-gem-support-version' => '0.2.0'
|
10
|
+
'eac-ruby-gem-support-version' => '0.2.0',
|
11
|
+
'gemfile-lock' => true
|
11
12
|
}
|
12
13
|
|
13
14
|
alias_method :fs_comparator_super, :fs_comparator
|
data/sub/eac_cli/eac_cli.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.files = Dir['{lib}/**/*', 'Gemfile']
|
14
14
|
|
15
15
|
s.add_dependency 'colorize', '~> 0.8', '>= 0.8.1'
|
16
|
-
s.add_dependency 'eac_config', '~> 0.
|
17
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
16
|
+
s.add_dependency 'eac_config', '~> 0.12'
|
17
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.107'
|
18
18
|
|
19
19
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
20
20
|
end
|
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'addressable', '~> 2.8'
|
16
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
15
|
+
s.add_dependency 'addressable', '~> 2.8', '>= 2.8.1'
|
16
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.107'
|
17
17
|
|
18
18
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
19
19
|
end
|
@@ -5,6 +5,7 @@ require 'eac_ruby_utils/core_ext'
|
|
5
5
|
|
6
6
|
module EacConfig
|
7
7
|
class Entry
|
8
|
+
require_sub __FILE__
|
8
9
|
enable_simple_cache
|
9
10
|
common_constructor :root_node, :path do
|
10
11
|
self.path = ::EacConfig::EntryPath.assert(path)
|
@@ -30,6 +31,12 @@ module EacConfig
|
|
30
31
|
node_entry.if_present(&:value)
|
31
32
|
end
|
32
33
|
|
34
|
+
def value!
|
35
|
+
return value if found?
|
36
|
+
|
37
|
+
raise ::EacConfig::Entry::NotFoundError, self
|
38
|
+
end
|
39
|
+
|
33
40
|
def value=(a_value)
|
34
41
|
write_node.self_entry(path).value = a_value
|
35
42
|
end
|