eac_tools 0.61.0 → 0.62.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +30 -25
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +2 -2
  5. data/sub/avm/lib/avm/version.rb +1 -1
  6. data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +3 -3
  7. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base.rb +1 -1
  8. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/entity_base.rb +35 -0
  9. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/project.rb +26 -0
  10. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/root.rb +21 -0
  11. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/wiki_page.rb +54 -0
  12. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api.rb +1 -0
  13. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page/read.rb +27 -0
  14. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page/write.rb +70 -0
  15. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page.rb +30 -0
  16. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project.rb +26 -0
  17. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  18. data/sub/avm-files/avm-files.gemspec +1 -1
  19. data/sub/avm-files/lib/avm/files/version.rb +1 -1
  20. data/sub/avm-git/avm-git.gemspec +2 -2
  21. data/sub/avm-git/lib/avm/git/version.rb +1 -1
  22. data/sub/{eac_ruby_base0/lib/eac_ruby_base0 → eac_cli/lib/eac_cli}/runner_with/confirmation.rb +3 -1
  23. data/sub/{eac_ruby_base0/lib/eac_ruby_base0 → eac_cli/lib/eac_cli}/runner_with/input.rb +1 -1
  24. data/sub/{eac_ruby_base0/lib/eac_ruby_base0 → eac_cli/lib/eac_cli}/runner_with/output.rb +1 -1
  25. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  26. data/sub/{eac_ruby_base0/spec/lib/eac_ruby_base0 → eac_cli/spec/lib/eac_cli}/runner_with/confirmation_spec.rb +2 -2
  27. data/sub/{eac_ruby_base0/spec/lib/eac_ruby_base0 → eac_cli/spec/lib/eac_cli}/runner_with/output_spec.rb +4 -4
  28. data/sub/eac_rest/Gemfile +8 -0
  29. data/sub/eac_rest/eac_rest.gemspec +21 -0
  30. data/sub/eac_rest/lib/eac_rest/api.rb +69 -0
  31. data/sub/eac_rest/lib/eac_rest/entity.rb +66 -0
  32. data/sub/eac_rest/lib/eac_rest/error.rb +6 -0
  33. data/sub/eac_rest/lib/eac_rest/request.rb +48 -0
  34. data/sub/eac_rest/lib/eac_rest/response.rb +25 -0
  35. data/sub/eac_rest/lib/eac_rest/version.rb +5 -0
  36. data/sub/eac_rest/lib/eac_rest.rb +7 -0
  37. data/sub/eac_rest/spec/lib/eac_rest/api_spec.rb +71 -0
  38. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get.source.yaml +5 -0
  39. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get.target.yaml +9 -0
  40. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get_with_auth.source.yaml +8 -0
  41. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get_with_auth.target.yaml +10 -0
  42. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_array_body.source.yaml +10 -0
  43. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_array_body.target.yaml +11 -0
  44. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_string_body.source.yaml +4 -0
  45. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_string_body.target.yaml +11 -0
  46. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_hash_body.source.yaml +6 -0
  47. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_hash_body.target.yaml +11 -0
  48. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_with_file.source.yaml +5 -0
  49. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_with_file.target.yaml +13 -0
  50. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/root.source.yaml +2 -0
  51. data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/root.target.yaml +9 -0
  52. data/sub/eac_rest/spec/rubocop_spec.rb +3 -0
  53. data/sub/eac_rest/spec/spec_helper/request_builder.rb +50 -0
  54. data/sub/eac_rest/spec/spec_helper.rb +7 -0
  55. data/sub/eac_ruby_base0/eac_ruby_base0.gemspec +2 -2
  56. data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  57. data/sub/eac_templates/lib/eac_templates/abstract/directory.rb +42 -0
  58. data/sub/eac_templates/lib/eac_templates/abstract/file.rb +25 -0
  59. data/sub/eac_templates/lib/eac_templates/abstract/fs_object.rb +94 -0
  60. data/sub/eac_templates/lib/eac_templates/abstract/fs_object_by_pathname.rb +13 -0
  61. data/sub/eac_templates/lib/eac_templates/abstract/not_found_error.rb +8 -0
  62. data/sub/eac_templates/lib/eac_templates/interface_methods.rb +3 -3
  63. data/sub/eac_templates/lib/eac_templates/modules/ancestor/directory.rb +4 -2
  64. data/sub/eac_templates/lib/eac_templates/modules/ancestor/file.rb +3 -2
  65. data/sub/eac_templates/lib/eac_templates/modules/ancestor/fs_object.rb +6 -13
  66. data/sub/eac_templates/lib/eac_templates/modules/ancestor.rb +6 -3
  67. data/sub/eac_templates/lib/eac_templates/sources/directory.rb +23 -10
  68. data/sub/eac_templates/lib/eac_templates/sources/file.rb +3 -14
  69. data/sub/eac_templates/lib/eac_templates/sources/fs_object.rb +17 -17
  70. data/sub/eac_templates/lib/eac_templates/sources/set.rb +5 -4
  71. data/sub/eac_templates/lib/eac_templates/variables/content.rb +52 -0
  72. data/sub/eac_templates/lib/eac_templates/variables/directory.rb +7 -5
  73. data/sub/eac_templates/lib/eac_templates/variables/file.rb +9 -33
  74. data/sub/eac_templates/lib/eac_templates/version.rb +1 -1
  75. data/sub/eac_templates/spec/lib/eac_templates/{patches/module/template_spec.rb → modules/base_spec.rb} +41 -20
  76. data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path2/a_module/a/a_b +1 -0
  77. data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path2/a_module/c +1 -0
  78. data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path2/prepended_module/c +1 -0
  79. data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path2/super_class/a/a_b +1 -0
  80. data/sub/eac_templates/spec/lib/eac_templates/variables/{file_spec.rb → content_spec.rb} +4 -4
  81. metadata +69 -39
  82. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path2/a_module/a/a_b +0 -1
  83. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path2/a_module/c +0 -1
  84. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path2/super_class/a/a_b +0 -1
  85. /data/sub/eac_templates/spec/lib/eac_templates/{patches/module/template_spec_files → modules/base_spec_files}/path1/a_module/a/a_a +0 -0
  86. /data/sub/eac_templates/spec/lib/eac_templates/{patches/module/template_spec_files → modules/base_spec_files}/path1/a_module/b +0 -0
  87. /data/sub/eac_templates/spec/lib/eac_templates/{patches/module/template_spec_files → modules/base_spec_files}/path1/super_class/a/a_b +0 -0
  88. /data/sub/eac_templates/spec/lib/eac_templates/{patches/module/template_spec_files → modules/base_spec_files}/path1/super_class/b +0 -0
  89. /data/sub/eac_templates/spec/lib/eac_templates/{patches/module/template_spec_files → modules/base_spec_files}/path2/a_module/b +0 -0
  90. /data/sub/eac_templates/spec/lib/eac_templates/{patches/module/template_spec_files → modules/base_spec_files}/path2/sub_class/b +0 -0
  91. /data/sub/eac_templates/spec/lib/eac_templates/{patches/module/template_spec_files → modules/base_spec_files}/path2/super_class/b +0 -0
  92. /data/sub/eac_templates/spec/lib/eac_templates/variables/{file_spec_files → content_spec_files}/expected_content +0 -0
  93. /data/sub/eac_templates/spec/lib/eac_templates/variables/{file_spec_files → content_spec_files}/source.template +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88b13d61ea11ac15cc3677a1cf5ec17f1381f8f87ab25074f8cf7be2804e0679
4
- data.tar.gz: 4432b02f679cabc7aa8ac455599e2bdfa653a02c973a05f02315a7992b50665e
3
+ metadata.gz: c6015e5a017d606e064cf4b1672653826b286f9677550ef552af41178d4815ea
4
+ data.tar.gz: 210b3d6290d05b251ba3ab7706475f488f1509142007ebd5f4928af0d22fa4ff
5
5
  SHA512:
6
- metadata.gz: 0e4a6b279e9e1ee080a4fdf0f390187330bf84b36b022816cb807fa2274bf338c7c894587bd2938f9d71b72b45da42d2df6de2609ef9c783a42a4d063642685a
7
- data.tar.gz: 2731fdeb08a1110cabba28cab3ccc98a60d8530e5d8a16c08a91459524952c98cccf7550cbcb6f21ccfcbdff8917c083d4911418ad91d6dc843e6e9f02fff58f
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.61.0)
5
- avm (~> 0.67, >= 0.67.1)
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,12 +11,12 @@ 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.19, >= 0.19.2)
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)
18
18
  avm-eac_wordpress_base0 (~> 0.3, >= 0.3.1)
19
- avm-git (~> 0.13, >= 0.13.1)
19
+ avm-git (~> 0.13, >= 0.13.2)
20
20
  avm-tools (~> 0.145, >= 0.145.1)
21
21
  eac_ruby_utils (~> 0.112)
22
22
 
@@ -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.19.2)
101
- avm (~> 0.67)
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.1)
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.7, >= 0.7.3)
107
+ eac_rest (~> 0.9)
108
108
  eac_ruby_utils (~> 0.112)
109
109
 
110
110
  PATH
@@ -153,19 +153,19 @@ PATH
153
153
  PATH
154
154
  remote: sub/avm-files
155
155
  specs:
156
- avm-files (0.6.1)
156
+ avm-files (0.6.2)
157
157
  avm (~> 0.67, >= 0.67.1)
158
158
  eac_cli (~> 0.30, >= 0.30.1)
159
159
  eac_fs (~> 0.16)
160
160
  eac_ruby_utils (~> 0.112)
161
- eac_templates (~> 0.4)
161
+ eac_templates (~> 0.5)
162
162
 
163
163
  PATH
164
164
  remote: sub/avm-git
165
165
  specs:
166
- avm-git (0.13.1)
167
- avm (~> 0.64, >= 0.64.2)
168
- avm-files (~> 0.6)
166
+ avm-git (0.13.2)
167
+ avm (~> 0.67, >= 0.67.1)
168
+ avm-files (~> 0.6, >= 0.6.2)
169
169
  eac_git (~> 0.14, >= 0.14.1)
170
170
  eac_ruby_utils (~> 0.112)
171
171
  git (~> 1.18)
@@ -191,15 +191,15 @@ PATH
191
191
  PATH
192
192
  remote: sub/avm
193
193
  specs:
194
- avm (0.67.1)
194
+ avm (0.68.0)
195
195
  aranha-parsers (~> 0.17, >= 0.17.1)
196
- eac_cli (~> 0.30, >= 0.30.1)
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.4)
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.30.1)
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.17.3)
248
- avm-eac_ruby_base1 (~> 0.29)
249
- eac_cli (~> 0.30, >= 0.30.1)
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
 
@@ -263,7 +271,7 @@ PATH
263
271
  PATH
264
272
  remote: sub/eac_templates
265
273
  specs:
266
- eac_templates (0.4.0)
274
+ eac_templates (0.5.0)
267
275
  eac_config (~> 0.12)
268
276
  eac_ruby_utils (~> 0.112)
269
277
 
@@ -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!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.61.0'
4
+ VERSION = '0.62.0'
5
5
  end
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.30', '>= 0.30.1'
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.4'
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'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.67.1'
4
+ VERSION = '0.68.0'
5
5
  end
@@ -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.67'
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.1'
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.7', '>= 0.7.3'
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: read_entry('api.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
@@ -7,6 +7,7 @@ module Avm
7
7
  module EacRedmineBase0
8
8
  module Instances
9
9
  class RestApi < ::EacRest::Api
10
+ require_sub __FILE__
10
11
  end
11
12
  end
12
13
  end
@@ -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
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRedmineBase0
5
- VERSION = '0.19.2'
5
+ VERSION = '0.20.0'
6
6
  end
7
7
  end
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.add_dependency 'eac_cli', '~> 0.30', '>= 0.30.1'
17
17
  s.add_dependency 'eac_fs', '~> 0.16'
18
18
  s.add_dependency 'eac_ruby_utils', '~> 0.112'
19
- s.add_dependency 'eac_templates', '~> 0.4'
19
+ s.add_dependency 'eac_templates', '~> 0.5'
20
20
 
21
21
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
22
22
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Files
5
- VERSION = '0.6.1'
5
+ VERSION = '0.6.2'
6
6
  end
7
7
  end
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,locale}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.64', '>= 0.64.2'
16
- s.add_dependency 'avm-files', '~> 0.6'
15
+ s.add_dependency 'avm', '~> 0.67', '>= 0.67.1'
16
+ s.add_dependency 'avm-files', '~> 0.6', '>= 0.6.2'
17
17
  s.add_dependency 'eac_git', '~> 0.14', '>= 0.14.1'
18
18
  s.add_dependency 'eac_ruby_utils', '~> 0.112'
19
19
  s.add_dependency 'git', '~> 1.18'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Git
5
- VERSION = '0.13.1'
5
+ VERSION = '0.13.2'
6
6
  end
7
7
  end
@@ -3,7 +3,7 @@
3
3
  require 'eac_cli/runner'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
- module EacRubyBase0
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)
@@ -4,7 +4,7 @@ require 'eac_cli/runner'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
  require 'eac_ruby_utils/abstract_methods'
6
6
 
7
- module EacRubyBase0
7
+ module EacCli
8
8
  module RunnerWith
9
9
  module Input
10
10
  STDIN_OPTION = '-'
@@ -4,7 +4,7 @@ require 'eac_cli/runner'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
  require 'eac_ruby_utils/abstract_methods'
6
6
 
7
- module EacRubyBase0
7
+ module EacCli
8
8
  module RunnerWith
9
9
  module Output
10
10
  STDOUT_OPTION = '-'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.30.1'
4
+ VERSION = '0.31.0'
5
5
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_base0/runner_with/confirmation'
3
+ require 'eac_cli/runner_with/confirmation'
4
4
 
5
- ::RSpec.describe ::EacRubyBase0::RunnerWith::Confirmation do
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 'eac_ruby_base0/runner_with/output'
3
+ require 'eac_cli/runner_with/output'
4
4
  require 'eac_ruby_utils/fs/temp'
5
5
 
6
- RSpec.describe ::EacRubyBase0::RunnerWith::Output do
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', ::EacRubyBase0::RunnerWith::Output::STDOUT_OPTION, stub_text] }
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', ::EacRubyBase0::RunnerWith::Output::DEFAULT_FILE_OPTION,
62
+ ['--output', ::EacCli::RunnerWith::Output::DEFAULT_FILE_OPTION,
63
63
  stub_text]
64
64
  end
65
65