sambot 0.1.84 → 0.1.85

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: c7da244758a4f2d52430e18ab602ff415878b18d
4
- data.tar.gz: b5649e953f81f54be1181e05d5a6d25ead71dc8c
3
+ metadata.gz: c7f2cc063288405718638b01fd6af260ddc7482c
4
+ data.tar.gz: 8f7245de7de0c008004cb5eb0250011db6b4d8cf
5
5
  SHA512:
6
- metadata.gz: 10769ad022decc7e4c0b42a0a72187861f20c800880c92331333b68f83af063f2da51d8102661c635e16111a5ad0a41a75849fac30ee0a336bc44a49326a9e38
7
- data.tar.gz: 47a1a389865604e6adba8d20af01f3bc3380584d3de75a5ba370fcf6c9650f402a1476e4731802e03b88f271e8b4e48af66e11fdabe562d3097b78a2dc8258be
6
+ metadata.gz: 2f72cdbbaf0f342afa8104e91925118b881bf03271d974e1d78867010f979c720d0102981269b2fc0576fb986fb2dc99f247abd180b34c3ff16a012a1f09e49b
7
+ data.tar.gz: 6a7d3476f7ee54bf0de6787a77c854d4f6b5c3971545830e3cc85e6ab26bce07b9b3595b58d6962d9139ee80daa2d1a18804a65c1c532e49d9be56593f682d91
data/lib/sambot/cli.rb CHANGED
@@ -15,9 +15,11 @@ require_relative 'domain/session'
15
15
  require_relative 'domain/vault'
16
16
  require_relative 'domain/ui'
17
17
  require_relative 'domain/cookbook'
18
+ require_relative 'domain/packer'
18
19
  require_relative 'domain/workstation'
19
20
  require_relative 'commands/cookbook'
20
21
  require_relative 'commands/session'
22
+ require_relative 'commands/packer'
21
23
  require_relative 'commands/workstation'
22
24
 
23
25
  module Sambot
@@ -5,13 +5,15 @@ module Sambot
5
5
 
6
6
  ApplicationError = Sambot::Domain::Common::ApplicationError
7
7
  Runtime = Sambot::Domain::Common::Runtime
8
+ Config = Sambot::Domain::Common::Config
8
9
 
9
10
  namespace 'packer'
10
11
 
11
12
  desc "prepare", "Sets up a Packer configuration"
12
13
  def prepare
13
14
  Runtime.ensure_latest
14
- Domain::Packer.prepare
15
+ config = Config.new.read
16
+ Domain::Packer.prepare(config)
15
17
  rescue ApplicationError => e
16
18
  error(e.message)
17
19
  end
@@ -4,19 +4,21 @@ module Sambot
4
4
  module Domain
5
5
  class Packer
6
6
 
7
- def self.prepare(config_file = nil)
8
- config = Common::Config.new.read(config_file)
7
+ ApplicationError = Common::ApplicationError
8
+ TemplateProvider = Common::TemplateProvider
9
+
10
+ def self.prepare(config)
9
11
  cookbook_name = config['name']
10
12
  target_platform = ENV['TARGET_IMAGE_PLATFORM']
11
- unless target_platform == 'windows' || target_platform == 'linux'
12
- raise ApplicationError.new("The target image platform must be either 'windows' or 'linux'.")
13
- end
13
+ raise ApplicationError.new("No target image platform provided i.e. TARGET_IMAGE_PLATFORM environment variable.") unless target_platform
14
+ is_valid_platform = target_platform == 'windows' || target_platform == 'linux'
15
+ raise ApplicationError.new("The target image platform must be either 'windows' or 'linux'.") unless is_valid_platform
14
16
  generate_config(cookbook_name, target_platform)
15
17
  end
16
18
 
17
19
  def self.generate_config(cookbook_name, target_platform)
18
20
  filename = TemplateProvider.get_path("packer.#{target_platform}.json")
19
- File.read(filename).gsub(/@@cookbook_name@@/, cookbook_name)
21
+ contents = File.read(filename).gsub(/@@cookbook_name@@/, cookbook_name)
20
22
  File.write("packer.json", contents)
21
23
  UI.debug("The configuration file for Packer has been added.")
22
24
  end
@@ -1,3 +1,3 @@
1
1
  module Sambot
2
- VERSION = '0.1.84'.freeze
2
+ VERSION = '0.1.85'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sambot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.84
4
+ version: 0.1.85
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Kouame
@@ -313,16 +313,12 @@ files:
313
313
  - lib/sambot/templates/.kitchen.gcp.yml.erb
314
314
  - lib/sambot/templates/.kitchen.rackspace.yml.erb
315
315
  - lib/sambot/templates/.kitchen.yml.erb
316
- - lib/sambot/templates/.rubocop.yml
317
- - lib/sambot/templates/Berksfile
318
- - lib/sambot/templates/chefignore
319
316
  - lib/sambot/templates/metadata.rb.erb
320
317
  - lib/sambot/templates/packer.linux.json
321
- - lib/sambot/templates/packer.windows.json.erb
318
+ - lib/sambot/templates/packer.windows.json
322
319
  - lib/sambot/templates/pre-push
323
320
  - lib/sambot/templates/startup-script.ps1
324
321
  - lib/sambot/templates/teamcity.sh.erb
325
- - lib/sambot/templates/winrm_config
326
322
  - lib/sambot/version.rb
327
323
  - sambot.gemspec
328
324
  homepage: http://github.com/okouam/sambot