flight-router 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 399b54c8a12e99a763a8c48858535c80189369bd
4
- data.tar.gz: b669e27ac40e1e587ec55c14688705f33c487fb2
3
+ metadata.gz: d9cf91ae07af699660ecb7ce20b12617b5eeb607
4
+ data.tar.gz: dce7b4e633f2f2c48f560aa9f6ff129a1272c259
5
5
  SHA512:
6
- metadata.gz: 59cfbdbf9b0a02b3e12576bb450f49eba90b51ac0519611430ab6ceb889fb96aef079e9ff635c6cdffd7307f682f008d56fa30787880510b396ff3470aa3f37b
7
- data.tar.gz: 187b023e5ec77a356a69def1649d6030de81e34b4bd9fe3f527675c9559a1151c69afc0584925088bfb0ca0cec8dc68e6ef742d137bac93b01c01917a64a343a
6
+ metadata.gz: 4f39f597c69900258589d88439c01e302f1d7b4dc8adc5ceebbeaf31907ecc71074f3ea454a84896f3d7e9b7a1de53d6e689b577ee2eef4b829715bf5191b9c2
7
+ data.tar.gz: 6be43f864da7534e73251cb9349571eec286f9d74564bd04e6bda0e88206b5e300e26e7c5f31bac5cc8cc732146475f5f26d7cb455b5a567438452034f32803c
@@ -0,0 +1,5 @@
1
+ # Changelog : 0.1.16
2
+
3
+ ## commits
4
+
5
+ * feature cmd
@@ -49,6 +49,13 @@ module Flight::Router
49
49
  def app
50
50
  @app
51
51
  end
52
+ def cmd(image,command,**opts)
53
+ @cmd.push(
54
+ image: image,
55
+ command: command,
56
+ opts: opts,
57
+ )
58
+ end
52
59
 
53
60
  def config
54
61
  @config ||= {}
@@ -78,9 +85,10 @@ module Flight::Router
78
85
 
79
86
  _app = @app
80
87
  @app = @app.deep_merge(config).deep_merge(opts)
81
- commands = parse_command(path, instance_exec(&block))
88
+ @cmd = []
89
+ instance_exec(&block)
82
90
 
83
- @config[path.join("/")] = @app.deep_merge(commands: commands)
91
+ @config[path.join("/")] = @app.deep_merge(commands: parse_command(path, @cmd))
84
92
 
85
93
  @app = _app
86
94
  end
@@ -94,7 +102,11 @@ module Flight::Router
94
102
  end
95
103
 
96
104
  def parse_command(path,commands)
97
- commands.each.with_index(1).map{|(image,key,opts),i|
105
+ commands.each.with_index(1).map{|cmd,i|
106
+ image = cmd[:image]
107
+ command = cmd[:command]
108
+ opts = cmd[:opts]
109
+
98
110
  unless info = map[:image][image]
99
111
  raise "image not defined: [#{image}]"
100
112
  end
@@ -102,12 +114,13 @@ module Flight::Router
102
114
  if env || info[:env]
103
115
  puts_env(path, "#{i}.env", (info[:env] || {}).merge(env || {}))
104
116
  end
105
- if block = @builder[image] && @builder[image][key]
117
+ if block = @builder[image] && @builder[image][command]
106
118
  command_args = instance_exec(**opts,&block)
107
119
  else
108
120
  command_args = opts
109
121
  end
110
- {image: info[:name], command: ["flight_#{image}",key,JSON.generate(command_args)]}
122
+
123
+ {image: info[:name], command: ["flight_#{image}",command,JSON.generate(command_args)]}
111
124
  }
112
125
  end
113
126
 
@@ -1,5 +1,5 @@
1
1
  module Flight
2
2
  module Router
3
- VERSION = "0.1.15"
3
+ VERSION = "0.1.16"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flight-router
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - shun@getto.systems
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-19 00:00:00.000000000 Z
11
+ date: 2017-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,6 +83,7 @@ files:
83
83
  - CHANGELOG/0.1.13.md
84
84
  - CHANGELOG/0.1.14.md
85
85
  - CHANGELOG/0.1.15.md
86
+ - CHANGELOG/0.1.16.md
86
87
  - CHANGELOG/0.1.2.md
87
88
  - CHANGELOG/0.1.3.md
88
89
  - CHANGELOG/0.1.4.md