sunzi 1.4.0 → 1.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e3cdb0743553811ee1eabba13a157b8e083bb0c
4
- data.tar.gz: 1a84c8f3f1de7377d64eb0b81ec1c0b5bb53f3c9
3
+ metadata.gz: 6e5b380c5a3cdd19ac21df1ca08104ba10478ae6
4
+ data.tar.gz: 43ae6fdbb4e5589934a87dfb5b8f42cb91628dac
5
5
  SHA512:
6
- metadata.gz: 9d02df7f0f7be31227a1a31221afec080d4e642e314426d9b9053e8c874f70aa1d7f4913cb017e3e33194bbff979af2ac5236064611354c85525aa590a6198eb
7
- data.tar.gz: 68ed831c1d46e064dfd442ac43a4bf57a8c755965e513bbb9bf2beafb1cda0c372280ed77d5ea416b673ce3febb247c728cd31ef228e21fa2f2937173c9efb4c
6
+ metadata.gz: b784234df5371ad733430573ed1ab10ca767082080ec654dcb470b141da3e422f0550bb4900ad22f4c13239d829a681408b9a072d15994de6062c1c397f9590e
7
+ data.tar.gz: fe414bb9c7aad43e1cc583ac18d98b7bf632d30817832d6467f4d3d647ddef35ed82d599bc5e97d7594714d482539b18cefc2f43dd7229378e58f18f7ee4aa03
@@ -1,3 +1,6 @@
1
+ ## 1.5, release 2013-09-27
2
+ * `sunzi deploy [linode|digital_ocean] [name]` will deploy to the instance with additional attributes.
3
+
1
4
  ## 1.4, release 2013-09-27
2
5
  * `sunzi teardown` no longer requires instance names as an argument, it lets you choose from a list instead.
3
6
 
@@ -11,10 +11,10 @@ module Sunzi
11
11
  do_create(project)
12
12
  end
13
13
 
14
- desc 'deploy [user@host:port] [role] [--sudo]', 'Deploy sunzi project'
14
+ desc 'deploy [user@host:port] [role] [--sudo] or deploy [linode|digital_ocean] [name] [role] [--sudo]', 'Deploy sunzi project'
15
15
  method_options :sudo => false
16
- def deploy(target, role = nil)
17
- do_deploy(target, role, options.sudo?)
16
+ def deploy(first, *args)
17
+ do_deploy(first, *args)
18
18
  end
19
19
 
20
20
  desc 'compile', 'Compile sunzi project'
@@ -54,8 +54,17 @@ module Sunzi
54
54
  copy_file 'templates/create/files/.gitkeep', "#{project}/files/.gitkeep"
55
55
  end
56
56
 
57
- def do_deploy(target, role, force_sudo)
58
- sudo = 'sudo ' if force_sudo
57
+ def do_deploy(first, *args)
58
+ if ['linode', 'digital_ocean'].include?(first)
59
+ @instance_attributes = YAML.load(File.read("#{first}/instances/#{args[0]}.yml"))
60
+ target = @instance_attributes[:fqdn]
61
+ role = args[1]
62
+ else
63
+ target = first
64
+ role = args[0]
65
+ end
66
+
67
+ sudo = 'sudo ' if options.sudo?
59
68
  user, host, port = parse_target(target)
60
69
  endpoint = "#{user}@#{host}"
61
70
 
@@ -104,6 +113,10 @@ module Sunzi
104
113
  # Load sunzi.yml
105
114
  @config = YAML.load(File.read('sunzi.yml'))
106
115
 
116
+ # Merge instance attributes
117
+ @config['attributes'] ||= {}
118
+ @config['attributes'].update(Hash[@instance_attributes.map{|k,v| [k.to_s, v] }]) if @instance_attributes
119
+
107
120
  # Break down attributes into individual files
108
121
  (@config['attributes'] || {}).each {|key, value| create_file "compiled/attributes/#{key}", value }
109
122
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'sunzi'
5
- spec.version = '1.4.0' # retrieve this value by: Gem.loaded_specs['sunzi'].version.to_s
5
+ spec.version = '1.5.0' # retrieve this value by: Gem.loaded_specs['sunzi'].version.to_s
6
6
  spec.authors = ['Kenn Ejima']
7
7
  spec.email = ['kenn.ejima@gmail.com']
8
8
  spec.homepage = 'http://github.com/kenn/sunzi'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunzi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenn Ejima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-27 00:00:00.000000000 Z
11
+ date: 2013-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor