avm-tools 0.56.0 → 0.57.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +64 -0
- data/lib/avm/tools/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs_cache.rb +1 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable.rb +15 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/array_accessor.rb +28 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/base_accessor.rb +23 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/boolean_accessor.rb +16 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/class_methods.rb +20 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/common_accessor.rb +30 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/hash_accessor.rb +42 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/instance_methods.rb +21 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/immutable.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0b0b4e4d80b6961f0eac94d2698535f0fbf5f4cd09fd15bb2ed5db238cb472b
|
4
|
+
data.tar.gz: a359c6044ceefd1c61296bf3a3c6ea32eeeee3c5a79c5a120d4b07306185e1aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd03f841630fa15e5b8b996db616944fc170c32aedcc2a8146e23edc9b709617149bce6c1b795d5253057bc7a029bdc977ce491bfd06d3a9aef1022bdd1a70f5
|
7
|
+
data.tar.gz: a2787bc3227940b3c1649883e12ddec48ac76add691f86f33a574168eb5c3b13389941b965e1d02f2984a8965e0df697792b2aa3629668ba5076d68a92c5bd5f
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/default_runner'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Tools
|
7
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
8
|
+
class EacRedmineBase0 < ::EacRubyUtils::Console::DocoptRunner
|
9
|
+
class ProjectRename < ::Avm::Rails::Runners::Runner
|
10
|
+
include ::EacCli::DefaultRunner
|
11
|
+
|
12
|
+
runner_definition do
|
13
|
+
pos_arg :from
|
14
|
+
pos_arg :to
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
start_banner
|
19
|
+
command.system!
|
20
|
+
end
|
21
|
+
|
22
|
+
def start_banner
|
23
|
+
infov 'From', from
|
24
|
+
infov 'To', to
|
25
|
+
end
|
26
|
+
|
27
|
+
def from
|
28
|
+
options.fetch('<from>')
|
29
|
+
end
|
30
|
+
|
31
|
+
def to
|
32
|
+
options.fetch('<to>')
|
33
|
+
end
|
34
|
+
|
35
|
+
def command
|
36
|
+
context(:instance).bundle('exec', 'rails', 'runner', code)
|
37
|
+
end
|
38
|
+
|
39
|
+
def code
|
40
|
+
<<~CODE
|
41
|
+
from_arg = '#{from}'
|
42
|
+
to_arg = '#{to}'
|
43
|
+
project = ::Project.where(identifier: from_arg).first
|
44
|
+
if project.present?
|
45
|
+
puts "Project found: \#{project}"
|
46
|
+
puts "Renaming..."
|
47
|
+
project.update_column(:identifier, to_arg)
|
48
|
+
puts "Renamed. Testing..."
|
49
|
+
project = ::Project.where(identifier: to_arg).first
|
50
|
+
if project
|
51
|
+
puts "Project found: \#{project}"
|
52
|
+
else
|
53
|
+
fail "After rename: project not found with identifier \\"\#{to_arg}\\""
|
54
|
+
end
|
55
|
+
else
|
56
|
+
fail "Before rename: project not found with identifier \\"\#{from_arg}\\""
|
57
|
+
end
|
58
|
+
CODE
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/patches/module/common_concern'
|
4
|
+
require 'eac_ruby_utils/require_sub'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Immutable
|
8
|
+
::EacRubyUtils.require_sub __FILE__
|
9
|
+
|
10
|
+
common_concern do
|
11
|
+
include ::EacRubyUtils::Listable
|
12
|
+
lists.add_symbol :type, :array, :boolean, :common, :hash
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/inflector'
|
4
|
+
require 'eac_ruby_utils/immutable/base_accessor'
|
5
|
+
require 'eac_ruby_utils/patches/class/common_constructor'
|
6
|
+
|
7
|
+
module EacRubyUtils
|
8
|
+
module Immutable
|
9
|
+
class ArrayAccessor < ::EacRubyUtils::Immutable::BaseAccessor
|
10
|
+
def apply(klass)
|
11
|
+
accessor = self
|
12
|
+
klass.send(:define_method, name) do |value|
|
13
|
+
accessor.immutable_value_set(self, value)
|
14
|
+
end
|
15
|
+
|
16
|
+
klass.send(:define_method, ::ActiveSupport::Inflector.pluralize(name)) do
|
17
|
+
accessor.immutable_value_get(self)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def immutable_value_set(object, value)
|
22
|
+
duplicate_object(object) do |old_value|
|
23
|
+
(old_value || []) + [value]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRubyUtils
|
4
|
+
module Immutable
|
5
|
+
class BaseAccessor
|
6
|
+
common_constructor :name do
|
7
|
+
self.name = name.to_sym
|
8
|
+
end
|
9
|
+
|
10
|
+
def duplicate_object(object)
|
11
|
+
accessor_new_value = yield(immutable_value_get(object))
|
12
|
+
new_values = object.send(:immutable_values_get).merge(name => accessor_new_value)
|
13
|
+
r = object.class.new(*object.immutable_constructor_args)
|
14
|
+
r.send(:immutable_values_set, new_values)
|
15
|
+
r
|
16
|
+
end
|
17
|
+
|
18
|
+
def immutable_value_get(object)
|
19
|
+
object.send(:immutable_values_get)[name]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/immutable/common_accessor'
|
4
|
+
require 'eac_ruby_utils/patches/class/common_constructor'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Immutable
|
8
|
+
class BooleanAccessor < ::EacRubyUtils::Immutable::CommonAccessor
|
9
|
+
def apply(klass)
|
10
|
+
super
|
11
|
+
accessor = self
|
12
|
+
klass.send(:define_method, "#{name}?") { send(accessor.name) }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRubyUtils
|
4
|
+
module Immutable
|
5
|
+
module ClassMethods
|
6
|
+
def immutable_accessor(*accessors)
|
7
|
+
options = accessors.extract_options!
|
8
|
+
options[:type] ||= const_get('TYPE_COMMON')
|
9
|
+
accessors.each do |name|
|
10
|
+
class_name = options.fetch(:type).to_s.camelize + 'Accessor'
|
11
|
+
::EacRubyUtils::Immutable.const_get(class_name).new(name).apply(self)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def imutable_single_accessor(name, options); end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/immutable/base_accessor'
|
4
|
+
require 'eac_ruby_utils/patches/class/common_constructor'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Immutable
|
8
|
+
class CommonAccessor < ::EacRubyUtils::Immutable::BaseAccessor
|
9
|
+
def apply(klass)
|
10
|
+
accessor = self
|
11
|
+
klass.send(:define_method, name) do |*args|
|
12
|
+
case args.count
|
13
|
+
when 0 then next accessor.immutable_value_get(self)
|
14
|
+
when 1 then next accessor.immutable_value_set(self, args.first)
|
15
|
+
else
|
16
|
+
raise ::ArgumentError, "wrong number of arguments (given #{args.count}, expected 0..1)"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def immutable_value_get(object)
|
22
|
+
object.send(:immutable_values_get)[name]
|
23
|
+
end
|
24
|
+
|
25
|
+
def immutable_value_set(object, value)
|
26
|
+
duplicate_object(object) { |_old_value| value }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/immutable/base_accessor'
|
4
|
+
require 'eac_ruby_utils/patches/class/common_constructor'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Immutable
|
8
|
+
class HashAccessor < ::EacRubyUtils::Immutable::BaseAccessor
|
9
|
+
def apply(klass)
|
10
|
+
apply_get(klass)
|
11
|
+
apply_set(klass)
|
12
|
+
end
|
13
|
+
|
14
|
+
def immutable_value_set(object, key, value)
|
15
|
+
duplicate_object(object) do |old_value|
|
16
|
+
(old_value || {}).merge(key => value)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def apply_get(klass)
|
23
|
+
accessor = self
|
24
|
+
klass.send(:define_method, ::ActiveSupport::Inflector.pluralize(name)) do
|
25
|
+
accessor.immutable_value_get(self)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def apply_set(klass)
|
30
|
+
accessor = self
|
31
|
+
klass.send(:define_method, name) do |*args|
|
32
|
+
case args.count
|
33
|
+
when 1 then next accessor.immutable_value_get(self, args[0])
|
34
|
+
when 2 then next accessor.immutable_value_set(self, *args[0..1])
|
35
|
+
else
|
36
|
+
raise ::ArgumentError, "wrong number of arguments (given #{args.count}, expected 1..2)"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRubyUtils
|
4
|
+
module Immutable
|
5
|
+
module InstanceMethods
|
6
|
+
def immutable_constructor_args
|
7
|
+
[]
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def immutable_values_get
|
13
|
+
@immutable_values || {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def immutable_values_set(new_values)
|
17
|
+
@immutable_values = new_values
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.57.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -405,6 +405,7 @@ files:
|
|
405
405
|
- lib/avm/tools/runner/eac_redmine_base0/data/dump.rb
|
406
406
|
- lib/avm/tools/runner/eac_redmine_base0/deploy.rb
|
407
407
|
- lib/avm/tools/runner/eac_redmine_base0/docker.rb
|
408
|
+
- lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
|
408
409
|
- lib/avm/tools/runner/eac_redmine_base0/runner.rb
|
409
410
|
- lib/avm/tools/runner/eac_wordpress_base0.rb
|
410
411
|
- lib/avm/tools/runner/eac_wordpress_base0/apache_host.rb
|
@@ -778,6 +779,14 @@ files:
|
|
778
779
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/traversable.rb
|
779
780
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/traverser.rb
|
780
781
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/fs_cache.rb
|
782
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable.rb
|
783
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/array_accessor.rb
|
784
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/base_accessor.rb
|
785
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/boolean_accessor.rb
|
786
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/class_methods.rb
|
787
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/common_accessor.rb
|
788
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/hash_accessor.rb
|
789
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/instance_methods.rb
|
781
790
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/listable.rb
|
782
791
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/class_methods.rb
|
783
792
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/instance_methods.rb
|
@@ -801,6 +810,7 @@ files:
|
|
801
810
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module.rb
|
802
811
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/common_concern.rb
|
803
812
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/console_speaker.rb
|
813
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/immutable.rb
|
804
814
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/listable.rb
|
805
815
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/patch.rb
|
806
816
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/require_sub.rb
|