eac_tools 0.61.1 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -18
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +2 -2
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +3 -3
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base.rb +1 -1
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/entity_base.rb +35 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/project.rb +26 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/root.rb +21 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/wiki_page.rb +54 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api.rb +1 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page/read.rb +27 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page/write.rb +70 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page.rb +30 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project.rb +26 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
- data/sub/{eac_ruby_base0/lib/eac_ruby_base0 → eac_cli/lib/eac_cli}/runner_with/confirmation.rb +3 -1
- data/sub/{eac_ruby_base0/lib/eac_ruby_base0 → eac_cli/lib/eac_cli}/runner_with/input.rb +1 -1
- data/sub/{eac_ruby_base0/lib/eac_ruby_base0 → eac_cli/lib/eac_cli}/runner_with/output.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
- data/sub/{eac_ruby_base0/spec/lib/eac_ruby_base0 → eac_cli/spec/lib/eac_cli}/runner_with/confirmation_spec.rb +2 -2
- data/sub/{eac_ruby_base0/spec/lib/eac_ruby_base0 → eac_cli/spec/lib/eac_cli}/runner_with/output_spec.rb +4 -4
- data/sub/eac_rest/Gemfile +8 -0
- data/sub/eac_rest/eac_rest.gemspec +21 -0
- data/sub/eac_rest/lib/eac_rest/api.rb +69 -0
- data/sub/eac_rest/lib/eac_rest/entity.rb +66 -0
- data/sub/eac_rest/lib/eac_rest/error.rb +6 -0
- data/sub/eac_rest/lib/eac_rest/request.rb +48 -0
- data/sub/eac_rest/lib/eac_rest/response.rb +25 -0
- data/sub/eac_rest/lib/eac_rest/version.rb +5 -0
- data/sub/eac_rest/lib/eac_rest.rb +7 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec.rb +71 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get.source.yaml +5 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get.target.yaml +9 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get_with_auth.source.yaml +8 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get_with_auth.target.yaml +10 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_array_body.source.yaml +10 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_array_body.target.yaml +11 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_string_body.source.yaml +4 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_string_body.target.yaml +11 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_hash_body.source.yaml +6 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_hash_body.target.yaml +11 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_with_file.source.yaml +5 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_with_file.target.yaml +13 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/root.source.yaml +2 -0
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/root.target.yaml +9 -0
- data/sub/eac_rest/spec/rubocop_spec.rb +3 -0
- data/sub/eac_rest/spec/spec_helper/request_builder.rb +50 -0
- data/sub/eac_rest/spec/spec_helper.rb +7 -0
- data/sub/eac_ruby_base0/eac_ruby_base0.gemspec +2 -2
- data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- metadata +46 -23
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6015e5a017d606e064cf4b1672653826b286f9677550ef552af41178d4815ea
|
|
4
|
+
data.tar.gz: 210b3d6290d05b251ba3ab7706475f488f1509142007ebd5f4928af0d22fa4ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6f47cb1544b15c17c3bcf6b4f989886616bf84b9df34b47b6efbbb2ab954bc33c2db5cc2a8ecf58398370f775453212325de74cfd127d7ee417499cc8594788
|
|
7
|
+
data.tar.gz: 6cd049e9d7d17c35b136f25c70ce638e7a5e4375230c948b39afc1ca3238751337320b3abead82684b327e561a787ef9e3054784d4056842c5387c4ffc16d97e
|
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
eac_tools (0.
|
|
5
|
-
avm (~> 0.
|
|
4
|
+
eac_tools (0.62.0)
|
|
5
|
+
avm (~> 0.68)
|
|
6
6
|
avm-eac_asciidoctor_base0 (~> 0.19)
|
|
7
7
|
avm-eac_generic_base0 (~> 0.12)
|
|
8
8
|
avm-eac_latex_base0 (~> 0.3, >= 0.3.1)
|
|
@@ -11,7 +11,7 @@ PATH
|
|
|
11
11
|
avm-eac_python_base0 (~> 0.2, >= 0.2.1)
|
|
12
12
|
avm-eac_rails_base0 (~> 0.10, >= 0.10.1)
|
|
13
13
|
avm-eac_rails_base1 (~> 0.8, >= 0.8.3)
|
|
14
|
-
avm-eac_redmine_base0 (~> 0.
|
|
14
|
+
avm-eac_redmine_base0 (~> 0.20)
|
|
15
15
|
avm-eac_redmine_plugin_base0 (~> 0.4)
|
|
16
16
|
avm-eac_ruby_base1 (~> 0.30, >= 0.30.2)
|
|
17
17
|
avm-eac_webapp_base0 (~> 0.15)
|
|
@@ -97,14 +97,14 @@ PATH
|
|
|
97
97
|
PATH
|
|
98
98
|
remote: sub/avm-eac_redmine_base0
|
|
99
99
|
specs:
|
|
100
|
-
avm-eac_redmine_base0 (0.
|
|
101
|
-
avm (~> 0.
|
|
100
|
+
avm-eac_redmine_base0 (0.20.0)
|
|
101
|
+
avm (~> 0.68)
|
|
102
102
|
avm-eac_generic_base0 (~> 0.12)
|
|
103
103
|
avm-eac_rails_base1 (~> 0.8, >= 0.8.3)
|
|
104
|
-
avm-eac_ubuntu_base0 (~> 0.4, >= 0.4.
|
|
104
|
+
avm-eac_ubuntu_base0 (~> 0.4, >= 0.4.2)
|
|
105
105
|
curb (~> 0.9, >= 0.9.11)
|
|
106
106
|
eac_fs (~> 0.16)
|
|
107
|
-
eac_rest (~> 0.
|
|
107
|
+
eac_rest (~> 0.9)
|
|
108
108
|
eac_ruby_utils (~> 0.112)
|
|
109
109
|
|
|
110
110
|
PATH
|
|
@@ -191,15 +191,15 @@ PATH
|
|
|
191
191
|
PATH
|
|
192
192
|
remote: sub/avm
|
|
193
193
|
specs:
|
|
194
|
-
avm (0.
|
|
194
|
+
avm (0.68.0)
|
|
195
195
|
aranha-parsers (~> 0.17, >= 0.17.1)
|
|
196
|
-
eac_cli (~> 0.
|
|
196
|
+
eac_cli (~> 0.31)
|
|
197
197
|
eac_config (~> 0.12)
|
|
198
198
|
eac_docker (~> 0.7)
|
|
199
199
|
eac_fs (~> 0.16)
|
|
200
200
|
eac_git (~> 0.14, >= 0.14.1)
|
|
201
201
|
eac_ruby_utils (~> 0.112)
|
|
202
|
-
eac_templates (~> 0.
|
|
202
|
+
eac_templates (~> 0.5)
|
|
203
203
|
filesize (~> 0.2)
|
|
204
204
|
htmlbeautifier (~> 1.4, >= 1.4.2)
|
|
205
205
|
minitar (~> 0.9)
|
|
@@ -207,7 +207,7 @@ PATH
|
|
|
207
207
|
PATH
|
|
208
208
|
remote: sub/eac_cli
|
|
209
209
|
specs:
|
|
210
|
-
eac_cli (0.
|
|
210
|
+
eac_cli (0.31.0)
|
|
211
211
|
colorize (~> 0.8, >= 0.8.1)
|
|
212
212
|
eac_config (~> 0.12)
|
|
213
213
|
eac_ruby_utils (~> 0.112)
|
|
@@ -241,12 +241,20 @@ PATH
|
|
|
241
241
|
eac_ruby_utils (~> 0.112)
|
|
242
242
|
parseconfig (~> 1.1, >= 1.1.2)
|
|
243
243
|
|
|
244
|
+
PATH
|
|
245
|
+
remote: sub/eac_rest
|
|
246
|
+
specs:
|
|
247
|
+
eac_rest (0.9.0)
|
|
248
|
+
eac_envs-http (~> 0.3, >= 0.3.1)
|
|
249
|
+
eac_fs (~> 0.16)
|
|
250
|
+
eac_ruby_utils (~> 0.112)
|
|
251
|
+
|
|
244
252
|
PATH
|
|
245
253
|
remote: sub/eac_ruby_base0
|
|
246
254
|
specs:
|
|
247
|
-
eac_ruby_base0 (0.
|
|
248
|
-
avm-eac_ruby_base1 (~> 0.
|
|
249
|
-
eac_cli (~> 0.
|
|
255
|
+
eac_ruby_base0 (0.18.0)
|
|
256
|
+
avm-eac_ruby_base1 (~> 0.30, >= 0.30.2)
|
|
257
|
+
eac_cli (~> 0.31)
|
|
250
258
|
eac_fs (~> 0.16)
|
|
251
259
|
eac_ruby_utils (~> 0.112)
|
|
252
260
|
|
|
@@ -295,10 +303,6 @@ GEM
|
|
|
295
303
|
faraday-gzip (~> 0.1)
|
|
296
304
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
|
297
305
|
faraday-retry (~> 2.1)
|
|
298
|
-
eac_rest (0.8.0)
|
|
299
|
-
eac_envs-http (~> 0.3, >= 0.3.1)
|
|
300
|
-
eac_fs (~> 0.16)
|
|
301
|
-
eac_ruby_utils (~> 0.112)
|
|
302
306
|
eac_ruby_gem_support (0.5.1)
|
|
303
307
|
eac_ruby_utils (~> 0.74)
|
|
304
308
|
rspec (~> 3.9)
|
|
@@ -411,6 +415,7 @@ DEPENDENCIES
|
|
|
411
415
|
eac_docker!
|
|
412
416
|
eac_fs!
|
|
413
417
|
eac_git!
|
|
418
|
+
eac_rest!
|
|
414
419
|
eac_ruby_base0!
|
|
415
420
|
eac_ruby_gem_support (~> 0.5.1)
|
|
416
421
|
eac_ruby_utils!
|
data/lib/eac_tools/version.rb
CHANGED
data/sub/avm/avm.gemspec
CHANGED
|
@@ -13,13 +13,13 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
|
14
14
|
|
|
15
15
|
s.add_dependency 'aranha-parsers', '~> 0.17', '>= 0.17.1'
|
|
16
|
-
s.add_dependency 'eac_cli', '~> 0.
|
|
16
|
+
s.add_dependency 'eac_cli', '~> 0.31'
|
|
17
17
|
s.add_dependency 'eac_config', '~> 0.12'
|
|
18
18
|
s.add_dependency 'eac_docker', '~> 0.7'
|
|
19
19
|
s.add_dependency 'eac_fs', '~> 0.16'
|
|
20
20
|
s.add_dependency 'eac_git', '~> 0.14', '>= 0.14.1'
|
|
21
21
|
s.add_dependency 'eac_ruby_utils', '~> 0.112'
|
|
22
|
-
s.add_dependency 'eac_templates', '~> 0.
|
|
22
|
+
s.add_dependency 'eac_templates', '~> 0.5'
|
|
23
23
|
s.add_dependency 'filesize', '~> 0.2'
|
|
24
24
|
s.add_dependency 'htmlbeautifier', '~> 1.4', '>= 1.4.2'
|
|
25
25
|
s.add_dependency 'minitar', '~> 0.9'
|
data/sub/avm/lib/avm/version.rb
CHANGED
|
@@ -12,13 +12,13 @@ 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.68'
|
|
16
16
|
s.add_dependency 'avm-eac_generic_base0', '~> 0.12'
|
|
17
17
|
s.add_dependency 'avm-eac_rails_base1', '~> 0.8', '>= 0.8.3'
|
|
18
|
-
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4', '>= 0.4.
|
|
18
|
+
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4', '>= 0.4.2'
|
|
19
19
|
s.add_dependency 'curb', '~> 0.9', '>= 0.9.11'
|
|
20
20
|
s.add_dependency 'eac_fs', '~> 0.16'
|
|
21
|
-
s.add_dependency 'eac_rest', '~> 0.
|
|
21
|
+
s.add_dependency 'eac_rest', '~> 0.9'
|
|
22
22
|
s.add_dependency 'eac_ruby_utils', '~> 0.112'
|
|
23
23
|
|
|
24
24
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
|
@@ -49,7 +49,7 @@ module Avm
|
|
|
49
49
|
# @return [Avm::EacRedmineBase0::Instances::RestApi]
|
|
50
50
|
def rest_api_uncached
|
|
51
51
|
url = root_url
|
|
52
|
-
url.query_values = { key:
|
|
52
|
+
url.query_values = { key: admin_api_key }
|
|
53
53
|
::Avm::EacRedmineBase0::Instances::RestApi.new(url)
|
|
54
54
|
end
|
|
55
55
|
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_rest/api'
|
|
4
|
+
require 'eac_rest/entity'
|
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
|
6
|
+
|
|
7
|
+
module Avm
|
|
8
|
+
module EacRedmineBase0
|
|
9
|
+
module Instances
|
|
10
|
+
class RestApi < ::EacRest::Api
|
|
11
|
+
class EntityBase < ::EacRest::Entity
|
|
12
|
+
def build_request(url_suffix)
|
|
13
|
+
api.request_json("#{url_suffix}.json")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def data_from_response(response)
|
|
17
|
+
raise "\"#{response.url}\" returned non-ok status: #{response.status}" unless
|
|
18
|
+
response.status.to_s.start_with?('2')
|
|
19
|
+
|
|
20
|
+
return {} if response.body_str.blank?
|
|
21
|
+
|
|
22
|
+
response.body_data
|
|
23
|
+
rescue ::JSON::ParserError
|
|
24
|
+
raise "\"#{response.url}\" returned invalid JSON: \"#{response.body_str}\"" \
|
|
25
|
+
" (Status: #{response.status})"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def fetch_data(url_suffix)
|
|
29
|
+
data_from_response(build_request(url_suffix).response)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'avm/eac_redmine_base0/instances/rest_api/entity_base'
|
|
4
|
+
require 'avm/eac_redmine_base0/instances/rest_api/wiki_page'
|
|
5
|
+
require 'eac_rest/api'
|
|
6
|
+
require 'eac_ruby_utils/core_ext'
|
|
7
|
+
|
|
8
|
+
module Avm
|
|
9
|
+
module EacRedmineBase0
|
|
10
|
+
module Instances
|
|
11
|
+
class RestApi < ::EacRest::Api
|
|
12
|
+
class Project < ::Avm::EacRedmineBase0::Instances::RestApi::EntityBase
|
|
13
|
+
# @return [String]
|
|
14
|
+
def prefix
|
|
15
|
+
"/projects/#{id}"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# @return [Avm::EacRedmineBase0::Instances::RestApi::WikiPage]
|
|
19
|
+
def wiki_page(name)
|
|
20
|
+
child_entity(::Avm::EacRedmineBase0::Instances::RestApi::WikiPage, name)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'avm/eac_redmine_base0/instances/rest_api/entity_base'
|
|
4
|
+
require 'eac_rest/api'
|
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
|
6
|
+
|
|
7
|
+
module Avm
|
|
8
|
+
module EacRedmineBase0
|
|
9
|
+
module Instances
|
|
10
|
+
class RestApi < ::EacRest::Api
|
|
11
|
+
class Root < ::Avm::EacRedmineBase0::Instances::RestApi::EntityBase
|
|
12
|
+
# @param id_or_identifier [String]
|
|
13
|
+
# @return [Avm::EacRedmineBase0::Instances::RestApi::Project]
|
|
14
|
+
def project(id_or_identifier)
|
|
15
|
+
api.entity(::Avm::EacRedmineBase0::Instances::RestApi::Project, id_or_identifier)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'avm/eac_redmine_base0/instances/rest_api/entity_base'
|
|
4
|
+
require 'eac_rest/api'
|
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
|
6
|
+
|
|
7
|
+
module Avm
|
|
8
|
+
module EacRedmineBase0
|
|
9
|
+
module Instances
|
|
10
|
+
class RestApi < ::EacRest::Api
|
|
11
|
+
class WikiPage < ::Avm::EacRedmineBase0::Instances::RestApi::EntityBase
|
|
12
|
+
enable_simple_cache
|
|
13
|
+
|
|
14
|
+
# @return [Hash]
|
|
15
|
+
def data_from_id
|
|
16
|
+
fetch_data(prefix)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# @return [String]
|
|
20
|
+
def data_root
|
|
21
|
+
'wiki_page'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# @return [String]
|
|
25
|
+
def prefix
|
|
26
|
+
"#{parent_entity.prefix}/wiki/#{id}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# @return [String]
|
|
30
|
+
def read
|
|
31
|
+
data.fetch(data_root).fetch('text')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# @param content [String]
|
|
35
|
+
# @return [+self+]
|
|
36
|
+
def write(text)
|
|
37
|
+
data_from_response(
|
|
38
|
+
build_request(prefix).verb(:put).header('Content-type', 'application/json')
|
|
39
|
+
.body_data(write_data(text).to_json).response
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# @param text [String]
|
|
44
|
+
# @return [Hash]
|
|
45
|
+
def write_data(text)
|
|
46
|
+
{
|
|
47
|
+
data_root => { 'text' => text }
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page/read.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/core_ext'
|
|
4
|
+
|
|
5
|
+
module Avm
|
|
6
|
+
module EacRedmineBase0
|
|
7
|
+
module Instances
|
|
8
|
+
module Runners
|
|
9
|
+
class Project
|
|
10
|
+
class WikiPage
|
|
11
|
+
class Read
|
|
12
|
+
runner_with :help, :output
|
|
13
|
+
|
|
14
|
+
def run
|
|
15
|
+
run_output
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def output_content
|
|
19
|
+
runner_context.call(:wiki_page_content)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/core_ext'
|
|
4
|
+
|
|
5
|
+
module Avm
|
|
6
|
+
module EacRedmineBase0
|
|
7
|
+
module Instances
|
|
8
|
+
module Runners
|
|
9
|
+
class Project
|
|
10
|
+
class WikiPage
|
|
11
|
+
class Write
|
|
12
|
+
runner_with :help, :confirmation, :input do
|
|
13
|
+
bool_opt '-f', '--force'
|
|
14
|
+
end
|
|
15
|
+
delegate :force?, to: :parsed
|
|
16
|
+
|
|
17
|
+
def run
|
|
18
|
+
start_banner
|
|
19
|
+
if write?
|
|
20
|
+
run_write
|
|
21
|
+
else
|
|
22
|
+
success 'Content unchanged, no further action will be taken'
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def start_banner
|
|
27
|
+
infov 'Content'
|
|
28
|
+
infov ' * Current', current_content
|
|
29
|
+
infov ' * New', new_content
|
|
30
|
+
infov ' * Changed?', content_changed?
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# @return [Boolean]
|
|
34
|
+
def content_changed?
|
|
35
|
+
new_content != current_content
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def run_write
|
|
39
|
+
if confirm?('Write?')
|
|
40
|
+
infom 'Writing...'
|
|
41
|
+
runner_context.call(:wiki_page).write(new_content)
|
|
42
|
+
success('Writed!')
|
|
43
|
+
else
|
|
44
|
+
success('Unconfirmed, no further action will be taken')
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# @return [Boolean]
|
|
49
|
+
def write?
|
|
50
|
+
parsed.force? || content_changed?
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
# @return [String]
|
|
56
|
+
def current_content_uncached
|
|
57
|
+
runner_context.call(:wiki_page_content)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# @return [String]
|
|
61
|
+
def new_content_uncached
|
|
62
|
+
input_content
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page.rb
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/core_ext'
|
|
4
|
+
|
|
5
|
+
module Avm
|
|
6
|
+
module EacRedmineBase0
|
|
7
|
+
module Instances
|
|
8
|
+
module Runners
|
|
9
|
+
class Project
|
|
10
|
+
class WikiPage
|
|
11
|
+
runner_with :help, :subcommands do
|
|
12
|
+
pos_arg :name
|
|
13
|
+
subcommands
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def wiki_page
|
|
17
|
+
runner_context.call(:project).wiki_page(parsed.name)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def wiki_page_content
|
|
21
|
+
wiki_page.read
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require_sub __FILE__
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/core_ext'
|
|
4
|
+
|
|
5
|
+
module Avm
|
|
6
|
+
module EacRedmineBase0
|
|
7
|
+
module Instances
|
|
8
|
+
module Runners
|
|
9
|
+
class Project
|
|
10
|
+
runner_with :help, :subcommands do
|
|
11
|
+
pos_arg :id_or_identifier
|
|
12
|
+
subcommands
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def project_uncached
|
|
18
|
+
runner_context.call(:instance).rest_api.root_entity.project(parsed.id_or_identifier)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
require_sub __FILE__
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/sub/{eac_ruby_base0/lib/eac_ruby_base0 → eac_cli/lib/eac_cli}/runner_with/confirmation.rb
RENAMED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require 'eac_cli/runner'
|
|
4
4
|
require 'eac_ruby_utils/core_ext'
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module EacCli
|
|
7
7
|
module RunnerWith
|
|
8
8
|
module Confirmation
|
|
9
9
|
DEFAULT_CONFIRM_QUESTION_TEXT = 'Confirm?'
|
|
@@ -26,6 +26,8 @@ module EacRubyBase0
|
|
|
26
26
|
message || setting_value(:confirm_question_text, default: DEFAULT_CONFIRM_QUESTION_TEXT),
|
|
27
27
|
bool: true
|
|
28
28
|
)
|
|
29
|
+
rescue ::EacCli::Speaker::InputRequested => e
|
|
30
|
+
fatal_error e.message
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
def run_confirm(message = nil)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require '
|
|
3
|
+
require 'eac_cli/runner_with/confirmation'
|
|
4
4
|
|
|
5
|
-
::RSpec.describe ::
|
|
5
|
+
::RSpec.describe ::EacCli::RunnerWith::Confirmation do
|
|
6
6
|
let(:runner) do
|
|
7
7
|
the_module = described_class
|
|
8
8
|
Class.new do
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require '
|
|
3
|
+
require 'eac_cli/runner_with/output'
|
|
4
4
|
require 'eac_ruby_utils/fs/temp'
|
|
5
5
|
|
|
6
|
-
RSpec.describe ::
|
|
6
|
+
RSpec.describe ::EacCli::RunnerWith::Output do
|
|
7
7
|
let(:runner) do
|
|
8
8
|
the_module = described_class
|
|
9
9
|
Class.new do
|
|
@@ -49,7 +49,7 @@ RSpec.describe ::EacRubyBase0::RunnerWith::Output do
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
context 'without --output option as to stdout' do
|
|
52
|
-
let(:runner_argv) { ['--output', ::
|
|
52
|
+
let(:runner_argv) { ['--output', ::EacCli::RunnerWith::Output::STDOUT_OPTION, stub_text] }
|
|
53
53
|
|
|
54
54
|
it do
|
|
55
55
|
expect { instance.run }.to output(stub_text).to_stdout_from_any_process
|
|
@@ -59,7 +59,7 @@ RSpec.describe ::EacRubyBase0::RunnerWith::Output do
|
|
|
59
59
|
context 'without --output option as to default file' do
|
|
60
60
|
let(:output_file) { temp_dir.join('default_file') }
|
|
61
61
|
let(:runner_argv) do
|
|
62
|
-
['--output', ::
|
|
62
|
+
['--output', ::EacCli::RunnerWith::Output::DEFAULT_FILE_OPTION,
|
|
63
63
|
stub_text]
|
|
64
64
|
end
|
|
65
65
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
|
4
|
+
|
|
5
|
+
require 'eac_rest/version'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |s|
|
|
8
|
+
s.name = 'eac_rest'
|
|
9
|
+
s.version = EacRest::VERSION
|
|
10
|
+
s.authors = ['Eduardo H. Bogoni']
|
|
11
|
+
s.summary = 'A REST helper for Ruby.'
|
|
12
|
+
|
|
13
|
+
s.files = Dir['{lib}/**/*']
|
|
14
|
+
|
|
15
|
+
s.add_dependency 'eac_envs-http', '~> 0.3', '>= 0.3.1'
|
|
16
|
+
s.add_dependency 'eac_fs', '~> 0.16'
|
|
17
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.112'
|
|
18
|
+
|
|
19
|
+
s.add_development_dependency 'aranha-parsers', '~> 0.15'
|
|
20
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
|
21
|
+
end
|