rundock 1.1.0 → 1.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbd82387cd2af5b8416ca898c1195d206c2d1125
4
- data.tar.gz: 3142354f64b527b7ab56d3f0ef4b8e523bbff554
3
+ metadata.gz: e9d5fbdbec3793e39aa69bf57a931215bedf4c98
4
+ data.tar.gz: 1301a6b4db8220b709225b34d4851a73e97033aa
5
5
  SHA512:
6
- metadata.gz: bf24ed1fa1eb8fe67c635c87e19c59cfe3e0420f776c3ea8b6cbcb4496ab217f7a6a60d074402fb810fb28b08cb84bb7bc2dd8b53f50c1f71bb9a8f7e85b3bed
7
- data.tar.gz: d4d6e4a40db0e57811cdc12de94c05bc0c3d50575f962aa68b1b50e4d9240c03d2a21279cd742b6406c565ed4e5bdb1c6e9ef62df79fb27025247778f072209f
6
+ metadata.gz: 78e493176f50ebb48ae7817f6180de0624743bc0f714f8acaaebed3b04b7a100ca40b72396355baea1a0e4791606258f2a527b17b53a28271eb23c4bfc620837
7
+ data.tar.gz: a9b0c2565b7444383545cecc1ade484a447cb0869fe51be6e2c95ee21255cddeddcd9ca6264a004f80dc5d62f27ca32ef65f179fed922f356131df3ce3d061b5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v1.1.1
2
+
3
+ Update
4
+
5
+ - Support task arguments to deploy operation
6
+
1
7
  ## v1.1.0
2
8
 
3
9
  Update
@@ -21,6 +21,14 @@ module Rundock
21
21
  h_ope = "start #{self.class.to_s.split('::').last.downcase}:"
22
22
  Logger.send(severity.to_sym, "#{h_host} #{h_ope} #{message}")
23
23
  end
24
+
25
+ def assign_args(cmd, args)
26
+ return cmd unless args
27
+ cmd.gsub(/\$#/, args.length.to_s)
28
+ .gsub(/\$@/, args.join(' '))
29
+ .gsub(/\$[1-9]/) { |arg_n| args[arg_n.chars[1..-1].join.to_i - 1] }
30
+ .gsub(/(\$\{)(\w+)(\})/) { ENV[Regexp.last_match(2)] }
31
+ end
24
32
  end
25
33
  end
26
34
  end
@@ -15,16 +15,6 @@ module Rundock
15
15
  )
16
16
  end
17
17
  end
18
-
19
- private
20
-
21
- def assign_args(cmd, args)
22
- return cmd unless args
23
- cmd.gsub(/\$#/, args.length.to_s)
24
- .gsub(/\$@/, args.join(' '))
25
- .gsub(/\$[1-9]/) { |arg_n| args[arg_n.chars[1..-1].join.to_i - 1] }
26
- .gsub(/(\$\{)(\w+)(\})/) { ENV[Regexp.last_match(2)] }
27
- end
28
18
  end
29
19
  end
30
20
  end
@@ -70,18 +70,22 @@ module Rundock
70
70
  end
71
71
 
72
72
  if is_erb
73
- erb_content = conv_erb(opt[:src], trim_mode, val_binding)
73
+ erb_content = conv_erb(assign_args(opt[:src], attributes[:task_args]),
74
+ trim_mode,
75
+ val_binding)
74
76
 
75
77
  tempfile = Tempfile.new('', Dir.tmpdir)
76
78
  begin
77
79
  tempfile.write(erb_content)
78
80
  tempfile.rewind
79
- backend.send_file(tempfile.path, opt[:dst])
81
+ backend.send_file(tempfile.path,
82
+ assign_args(opt[:dst], attributes[:task_args]))
80
83
  ensure
81
84
  tempfile.close
82
85
  end
83
86
  else
84
- backend.send_file(opt[:src], opt[:dst])
87
+ backend.send_file(assign_args(opt[:src], attributes[:task_args]),
88
+ assign_args(opt[:dst], attributes[:task_args]))
85
89
  end
86
90
  end
87
91
  end
@@ -104,6 +108,8 @@ module Rundock
104
108
  map = {}
105
109
  binding.each do |k, v|
106
110
  map[k] = backend.specinfra_run_command(v[:value]).stdout.strip if v.key?(:value)
111
+
112
+ # write types other than the command here
107
113
  end
108
114
 
109
115
  map
@@ -1,3 +1,3 @@
1
1
  module Rundock
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -0,0 +1,13 @@
1
+ - target: localhost
2
+ command:
3
+ - "rm -f /var/tmp/hello_rundock_from_deploy_src_file_arg_1_scenario"
4
+ - "rm -f /var/tmp/hello_rundock_from_deploy_dst_file_arg_2_scenario"
5
+ - "echo 'Hello Rundock from deploy args Scenario.' > /var/tmp/hello_rundock_from_deploy_src_file_arg_1_scenario"
6
+ task:
7
+ - deploy_file arg_1 arg_2
8
+ ---
9
+ ---
10
+ deploy_file:
11
+ deploy:
12
+ - src: /var/tmp/hello_rundock_from_deploy_src_file_$1_scenario
13
+ dst: /var/tmp/hello_rundock_from_deploy_dst_file_$2_scenario
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe file('/var/tmp/hello_rundock_from_deploy_dst_file_arg_2_scenario') do
4
+ it { should be_file }
5
+ its(:content) { should match(/Hello Rundock from deploy args Scenario./) }
6
+ end
@@ -0,0 +1,21 @@
1
+ - target: localhost
2
+ command:
3
+ - "rm -f /var/tmp/hello_rundock_from_deploy_src_file_arg_1_scenario"
4
+ - "echo 'Hello Rundock from deploy args Scenario.' > /var/tmp/hello_rundock_from_deploy_src_file_arg_1_scenario"
5
+ - target: anyhost-01
6
+ command:
7
+ - "rm -f /var/tmp/hello_rundock_from_deploy_dst_file_arg_2_scenario"
8
+ task:
9
+ - deploy_task arg_1 arg_2
10
+ ---
11
+ anyhost-01:
12
+ host: <replaced_by_platforms_host>
13
+ ssh_opts:
14
+ port: <replaced_by_platforms_port>
15
+ user: tester
16
+ key: "<replaced_by_platforms_key>"
17
+ ---
18
+ deploy_task:
19
+ deploy:
20
+ - src: /var/tmp/hello_rundock_from_deploy_src_file_$1_scenario
21
+ dst: /var/tmp/hello_rundock_from_deploy_dst_file_$2_scenario
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rundock
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - hiracy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-20 00:00:00.000000000 Z
11
+ date: 2018-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -209,6 +209,7 @@ files:
209
209
  - spec/integration/platforms/centos6/setup.sh
210
210
  - spec/integration/platforms/localhost/scenarios/all_file_hooks_by_option_scenario.yml
211
211
  - spec/integration/platforms/localhost/scenarios/cwd_scenario.yml
212
+ - spec/integration/platforms/localhost/scenarios/deploy_args_scenario.yml
212
213
  - spec/integration/platforms/localhost/scenarios/deploy_erb_scenario.yml
213
214
  - spec/integration/platforms/localhost/scenarios/deploy_scenario.yml
214
215
  - spec/integration/platforms/localhost/scenarios/file_hooks_by_option_scenario.yml
@@ -224,6 +225,7 @@ files:
224
225
  - spec/integration/platforms/localhost/scenarios/use_default_ssh_scenario.yml
225
226
  - spec/integration/platforms/localhost/targets/target_by_option.yml
226
227
  - spec/integration/recipes/cwd_spec.rb
228
+ - spec/integration/recipes/deploy_args_spec.rb
227
229
  - spec/integration/recipes/deploy_erb_spec.rb
228
230
  - spec/integration/recipes/deploy_spec.rb
229
231
  - spec/integration/recipes/file_hook_by_option_spec.rb
@@ -238,6 +240,7 @@ files:
238
240
  - spec/integration/recipes/task_with_args_spec.rb
239
241
  - spec/integration/scenarios/all_file_hooks_by_option_scenario.yml
240
242
  - spec/integration/scenarios/cwd_scenario.yml
243
+ - spec/integration/scenarios/deploy_args_scenario.yml
241
244
  - spec/integration/scenarios/deploy_erb_scenario.yml
242
245
  - spec/integration/scenarios/deploy_scenario.yml
243
246
  - spec/integration/scenarios/file_hooks_by_option_scenario.yml