kondate 0.1.4 → 0.1.5

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: f9cce6830f15dbb3ee4856a3d0c789b23ad2a615
4
- data.tar.gz: b891c2c1d573bd93672453ad93b1a94a01770370
3
+ metadata.gz: 872d487f03a83e112bc7025bd7cf90a4d4f5f457
4
+ data.tar.gz: 35fc66dbe8261daf3cca13463dcb5594e4ea8711
5
5
  SHA512:
6
- metadata.gz: c342ae98969f5f2ae78579d9bc52b1b8d89ed79d68f8ebbdb2f98b9ae61c4cd2bfb37fc13bcaa64f8f4c6ddf560eef88ba921b0c170205224f757eac5dc3dd08
7
- data.tar.gz: 6b1e8f7b907218e6c9aaded19ba8dbc66040c857b0aea9eae3b3844475d256df3fb96f49f335c56bda63aa554af5491093df5f7fc811ececbf5d1bf723fe3149
6
+ metadata.gz: 17f4e2f7ec928b35574819abf608cacb6627aa0db7aada34db129889e7c9e86c17c82cf955fffa52319fb6d8fe3177d078414ddf1b0703cecba3330f32be6695
7
+ data.tar.gz: 4af4298871810ab4c02f5ac423c1b097fd4f5e53bf6b5ec096af07c4af536a1e036470aaa5b1bc303146bf8a29ea189eb5e062bbb41ceaf7131984e555702e5a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.1.5 (2015-11-30)
2
+
3
+ Changes:
4
+
5
+ * Add --vagrant option, and stop judging vagrant or not via host name
6
+
1
7
  # 0.1.4 (2015-11-29)
2
8
 
3
9
  Changes:
data/README.md CHANGED
@@ -236,7 +236,23 @@ set :host, ENV['TARGET_HOST']
236
236
  set :set_property, YAML.load_file(ENV['TARGET_NODE_FILE'])
237
237
  ```
238
238
 
239
- because these ENVs are passed by `kondate serverspec`.
239
+ because these ENVs are passed by `kondate serverspec`.
240
+
241
+ Configuring following lines for vagrant is also recommended:
242
+
243
+ ```
244
+ if ENV['TARGET_VAGRANT']
245
+ `vagrant up #{host}`
246
+
247
+ config = Tempfile.new('', Dir.tmpdir)
248
+ config.write(`vagrant ssh-config #{host}`)
249
+ config.close
250
+
251
+ Net::SSH::Config.for(host, [config.path])
252
+ else
253
+ ```
254
+
255
+ `ENV['TARGET_VAGRANT']` is turned on if `kondate serverspec` is executed with `--vagrant` option.
240
256
 
241
257
  See [templates/spec/spec_helper.rb](./lib/kondate/templates/spec/spec_helper.rb) for an example.
242
258
 
@@ -246,16 +262,22 @@ The default reads `hosts.yml` to resolve roles of a host, but
246
262
  you may want to resolve roles from AWS EC2 `roles` tag, or
247
263
  you may want to resolve roles from your own host resolver API application.
248
264
 
249
- Thus, `kondate` provides a plugin system to reolve hosts' roles.
265
+ Thus, `kondate` provides a plugin system to resolve hosts' roles.
250
266
 
251
267
  ### Naming Convention
252
268
 
253
269
  You must follow the below naming conventions:
254
270
 
255
- * gem name: kondate-host_plugin-xxx (xxx_yyy)
271
+ * gem name: kondate-host_plugin-xxx (xxx_yyy) (if you want to make a gem)
256
272
  * file name: lib/kondate/host_plugin/xxx.rb (xxx_yyy.rb)
257
273
  * class name: Kondate::HostPlugin::Xxx (XxxYyy)
258
274
 
275
+ If you want to put your own host plugin locally without publishing a gem, you can configure the location with .kondate.conf as:
276
+
277
+ ```
278
+ plugin_dir: lib
279
+ ```
280
+
259
281
  ### Interface
260
282
 
261
283
  What you have to implement are `#initialize`, `#get_environment`, and `#get_roles` methods. Here is an example of file plugin:
@@ -313,8 +335,8 @@ vagrant up
313
335
  ```
314
336
 
315
337
  ```
316
- bundle exec exe/kondate itamae vagrant-centos --role sample
317
- bundle exec exe/kondate serverspec vagrant-centos --role sample
338
+ bundle exec exe/kondate itamae vagrant-centos --vagrant --role sample
339
+ bundle exec exe/kondate serverspec vagrant-centos --vagrant --role sample
318
340
  ```
319
341
 
320
342
  ## ToDo
data/lib/kondate/cli.rb CHANGED
@@ -51,6 +51,7 @@ module Kondate
51
51
  option :recipe, :type => :array, :default => []
52
52
  option :debug, :aliases => ["-d"], :type => :boolean, :default => false
53
53
  option :confirm, :type => :boolean, :default => true
54
+ option :vagrant, :type => :boolean, :default => false
54
55
  def itamae(host)
55
56
  builder, property_files = build_property_files(host)
56
57
 
@@ -62,7 +63,7 @@ module Kondate
62
63
 
63
64
  properties = YAML.load_file(property_file)
64
65
 
65
- if builder.vagrant?
66
+ if @options[:vagrant]
66
67
  command << " --vagrant"
67
68
  else
68
69
  config = Net::SSH::Config.for(host)
@@ -85,10 +86,12 @@ module Kondate
85
86
  option :recipe, :type => :array, :default => []
86
87
  option :debug, :aliases => ["-d"], :type => :boolean, :default => false
87
88
  option :confirm, :type => :boolean, :default => true
89
+ option :vagrant, :type => :boolean, :default => false
88
90
  def serverspec(host)
89
91
  builder, property_files = build_property_files(host)
90
92
 
91
93
  ENV['RUBYOPT'] = "-I #{Config.plugin_dir} -r bundler/setup -r ext/serverspec/kondate"
94
+ ENV['TARGET_VAGRANT'] = '1' if @options[:vagrant]
92
95
  property_files.each do |role, property_file|
93
96
  RSpec::Core::RakeTask.new([host, role].join(':'), :recipe) do |t, args|
94
97
  ENV['TARGET_HOST'] = host
@@ -122,9 +122,5 @@ module Kondate
122
122
  end.path
123
123
  end
124
124
  end
125
-
126
- def vagrant?
127
- %r{\Avagrant} === @host
128
- end
129
125
  end
130
126
  end
@@ -1,2 +1 @@
1
1
  localhost: [sample]
2
- vagrant-centos: [sample]
@@ -22,7 +22,7 @@ else
22
22
  end
23
23
 
24
24
  options =
25
- if %r{\Avagrant} === host
25
+ if ENV['TARGET_VAGRANT']
26
26
  `vagrant up #{host}`
27
27
 
28
28
  config = Tempfile.new('', Dir.tmpdir)
@@ -1,3 +1,3 @@
1
1
  module Kondate
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kondate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - sonots
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-28 00:00:00.000000000 Z
11
+ date: 2015-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: itamae