mixlib-install 0.8.0.alpha.6 → 0.8.0.alpha.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/Gemfile +1 -1
  4. data/PRODUCT_MATRIX.md +1 -0
  5. data/Rakefile +19 -7
  6. data/acceptance/.gitignore +2 -0
  7. data/acceptance/current/.acceptance/acceptance-cookbook/recipes/destroy.rb +1 -1
  8. data/acceptance/current/.acceptance/acceptance-cookbook/recipes/provision.rb +1 -1
  9. data/acceptance/current/.acceptance/acceptance-cookbook/recipes/verify.rb +1 -1
  10. data/acceptance/current/.kitchen.yml +3 -2
  11. data/acceptance/unstable/.acceptance/acceptance-cookbook/recipes/destroy.rb +1 -1
  12. data/acceptance/unstable/.acceptance/acceptance-cookbook/recipes/provision.rb +1 -1
  13. data/acceptance/unstable/.acceptance/acceptance-cookbook/recipes/verify.rb +1 -1
  14. data/acceptance/unstable/.kitchen.yml +3 -2
  15. data/lib/mixlib/install.rb +43 -4
  16. data/lib/mixlib/install/artifact_info.rb +1 -1
  17. data/lib/mixlib/install/backend.rb +4 -4
  18. data/lib/mixlib/install/backend/artifactory.rb +5 -5
  19. data/lib/mixlib/install/generator/bourne.rb +4 -0
  20. data/lib/mixlib/install/generator/bourne/scripts/fetch_metadata.sh.erb +1 -0
  21. data/lib/mixlib/install/generator/bourne/scripts/platform_detection.sh +2 -0
  22. data/lib/mixlib/install/generator/powershell.rb +7 -0
  23. data/lib/mixlib/install/generator/powershell/scripts/get_project_metadata.ps1.erb +16 -13
  24. data/lib/mixlib/install/generator/powershell/scripts/get_project_metadata_for_artifactory.ps1.erb +11 -13
  25. data/lib/mixlib/install/generator/powershell/scripts/helpers.ps1 +20 -0
  26. data/lib/mixlib/install/generator/powershell/scripts/install_project.ps1 +5 -2
  27. data/lib/mixlib/install/generator/powershell/scripts/platform_detection.ps1 +4 -0
  28. data/lib/mixlib/install/options.rb +18 -4
  29. data/lib/mixlib/install/product.rb +6 -1
  30. data/lib/mixlib/install/script_generator.rb +17 -17
  31. data/lib/mixlib/install/version.rb +1 -1
  32. metadata +6 -4
  33. data/acceptance/Gemfile.lock +0 -91
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f22a8e79813d704d0b3421bd3057cc3b0110445e
4
- data.tar.gz: 6195a3c3439c78bda91e893ce1a88450fb4871c8
3
+ metadata.gz: 09578e7ebe6313ee2b4319317af109fed364e46e
4
+ data.tar.gz: 0a3a8c4bf55672a723c1576a5ebadbc883cde6de
5
5
  SHA512:
6
- metadata.gz: e32d45a986ad03ca28ba567a53617f4bf4f5cdfa18341248280f3389d03345d1f26281aa69ff0a7d1a96fb1670a18708a6cd1188653d96c75b33d7b8164824a0
7
- data.tar.gz: 7fbf709b33d82dad251178f0be3698a65c47737ced36c2c2b1be1833bdffee06bdcea6ff74ecf940dea2fb552a9e9b2bb71a8e7c360bbd3e50206de430ce5c5c
6
+ metadata.gz: 5e87fb189a92b2dbd3d03ee680cadf47385c2ded328242e524fb620ac6e3c62cf17741a62f4b6ff3c3794ad89e5768e081318057421d6ad7bcab794a0c0996a4
7
+ data.tar.gz: 8342b80c4decd0db0640e4899e41d22ecb5fbe39aa4e90bd0caa58a366100c5386feabf4d3a628645b4a7945324e100a5a68b49d2bcc706cd3c3bbc1e98e92d8
@@ -4,4 +4,5 @@ rvm:
4
4
  - 2.2
5
5
  - 2.1
6
6
  - 1.9.3
7
- - ruby-head
7
+
8
+ script: bundle exec rake ci
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "finstyle"
3
+ gem "chefstyle", github: "chef/chefstyle"
4
4
 
5
5
  gemspec
@@ -8,6 +8,7 @@
8
8
  | Chef Server High Availability addon | chef-ha |
9
9
  | Chef Cloud Marketplace addon | chef-marketplace |
10
10
  | Chef Server | chef-server |
11
+ | Chef Server HA Provisioning for AWS | chef-server-ha-provisioning |
11
12
  | Chef Server Replication addon | chef-sync |
12
13
  | Chef Development Kit | chefdk |
13
14
  | Chef Compliance | compliance |
data/Rakefile CHANGED
@@ -1,6 +1,4 @@
1
1
  require "bundler/gem_tasks"
2
- require "finstyle"
3
- require "rubocop/rake_task"
4
2
  require "rspec/core/rake_task"
5
3
 
6
4
  task default: :test
@@ -10,20 +8,34 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
10
8
  spec.pattern = "spec/**/*_spec.rb"
11
9
  end
12
10
 
13
- desc "Run rubocop"
14
- RuboCop::RakeTask.new do |task|
15
- task.options << "--display-cop-names"
11
+ begin
12
+ require "chefstyle"
13
+ require "rubocop/rake_task"
14
+ RuboCop::RakeTask.new(:style) do |task|
15
+ task.options += ["--display-cop-names", "--no-color"]
16
+ end
17
+ rescue LoadError
18
+ puts "chefstyle/rubocop is not available. gem install chefstyle to do style checking."
16
19
  end
17
20
 
18
21
  desc "Run all tests"
19
- task test: [:rubocop, :spec]
22
+ task test: [:style, :spec, :unstable]
20
23
 
21
24
  desc "Run unstable channel tests"
22
25
  task "unstable" do
23
- Rake::Task["rubocop"].invoke
26
+ if ENV["ARTIFACTORY_USERNAME"].nil? || ENV["ARTIFACTORY_PASSWORD"].nil?
27
+ abort <<-EOS.gsub(/^\s+/, "")
28
+ Must set ARTIFACTORY_USERNAME and ARTIFACTORY_PASSWORD environment
29
+ variables to run unstable tests
30
+ EOS
31
+ end
32
+ Rake::Task["style"].invoke
24
33
  system("bundle exec rspec -t unstable")
25
34
  end
26
35
 
36
+ desc "Run tests for Travis CI"
37
+ task ci: [:style, :spec]
38
+
27
39
  desc "Render product matrix documentation"
28
40
  task "matrix" do
29
41
  require "mixlib/install/product"
@@ -0,0 +1,2 @@
1
+ /Gemfile.lock
2
+ /.acceptance_logs/
@@ -1,3 +1,3 @@
1
- execute 'kitchen destroy' do
1
+ execute "bundle exec kitchen destroy #{ENV["KITCHEN_INSTANCES"]}" do
2
2
  cwd node['chef-acceptance']['suite-dir']
3
3
  end
@@ -1,3 +1,3 @@
1
- execute 'kitchen converge' do
1
+ execute "bundle exec kitchen converge #{ENV["KITCHEN_INSTANCES"]}" do
2
2
  cwd node['chef-acceptance']['suite-dir']
3
3
  end
@@ -1,3 +1,3 @@
1
- execute 'kitchen verify' do
1
+ execute "bundle exec kitchen verify #{ENV["KITCHEN_INSTANCES"]}" do
2
2
  cwd node['chef-acceptance']['suite-dir']
3
3
  end
@@ -1,9 +1,10 @@
1
1
  driver:
2
2
  name: vagrant
3
+ provider: vmware_fusion
3
4
  forward_agent: yes
4
5
  customize:
5
- cpus: 2
6
- memory: 1024
6
+ numvcpus: 2
7
+ memsize: 1048
7
8
 
8
9
  provisioner:
9
10
  name: chef_zero
@@ -1,3 +1,3 @@
1
- execute 'kitchen destroy' do
1
+ execute "bundle exec kitchen destroy #{ENV["KITCHEN_INSTANCES"]}" do
2
2
  cwd node['chef-acceptance']['suite-dir']
3
3
  end
@@ -1,3 +1,3 @@
1
- execute 'kitchen converge' do
1
+ execute "bundle exec kitchen converge #{ENV["KITCHEN_INSTANCES"]}" do
2
2
  cwd node['chef-acceptance']['suite-dir']
3
3
  end
@@ -1,3 +1,3 @@
1
- execute 'kitchen verify' do
1
+ execute "bundle exec kitchen verify #{ENV["KITCHEN_INSTANCES"]}" do
2
2
  cwd node['chef-acceptance']['suite-dir']
3
3
  end
@@ -1,9 +1,10 @@
1
1
  driver:
2
2
  name: vagrant
3
+ provider: vmware_fusion
3
4
  forward_agent: yes
4
5
  customize:
5
- cpus: 2
6
- memory: 1024
6
+ numvcpus: 2
7
+ memsize: 1048
7
8
 
8
9
  provisioner:
9
10
  name: chef_zero
@@ -78,10 +78,10 @@ module Mixlib
78
78
  # chef-server -> /opt/opscode). But this is OK for now since
79
79
  # chef & chefdk are the only supported products.
80
80
  version_manifest_file = if options.for_ps1?
81
- "$env:systemdrive\\opscode\\#{options.product_name}\\version-manifest.json"
82
- else
83
- "/opt/#{options.product_name}/version-manifest.json"
84
- end
81
+ "$env:systemdrive\\opscode\\#{options.product_name}\\version-manifest.json"
82
+ else
83
+ "/opt/#{options.product_name}/version-manifest.json"
84
+ end
85
85
 
86
86
  if File.exist? version_manifest_file
87
87
  JSON.parse(File.read(version_manifest_file))["build_version"]
@@ -99,6 +99,45 @@ module Mixlib
99
99
  (available_ver > current_ver)
100
100
  end
101
101
 
102
+ #
103
+ # Automatically set the platform options
104
+ #
105
+ def detect_platform
106
+ options.set_platform_info(self.class.detect_platform)
107
+ self
108
+ end
109
+
110
+ #
111
+ # Returns a Hash containing the platform info options
112
+ #
113
+ def self.detect_platform
114
+ platform_info = if RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
115
+ `#{self.detect_platform_ps1}`.split
116
+ else
117
+ `#{self.detect_platform_sh}`.split
118
+ end
119
+
120
+ {
121
+ platform: platform_info[0],
122
+ platform_version: platform_info[1],
123
+ architecture: platform_info[2],
124
+ }
125
+ end
126
+
127
+ #
128
+ # Returns the platform_detection.sh script
129
+ #
130
+ def self.detect_platform_sh
131
+ Mixlib::Install::Generator::Bourne.detect_platform_sh
132
+ end
133
+
134
+ #
135
+ # Returns the platform_detection.ps1 script
136
+ #
137
+ def self.detect_platform_ps1
138
+ Mixlib::Install::Generator::PowerShell.detect_platform_ps1
139
+ end
140
+
102
141
  #
103
142
  # Returns the install.sh script
104
143
  # Supported context parameters:
@@ -68,7 +68,7 @@ module Mixlib
68
68
  version: version,
69
69
  platform: platform,
70
70
  platform_version: platform_version,
71
- architecture: architecture
71
+ architecture: architecture,
72
72
  }
73
73
  end
74
74
  end
@@ -24,10 +24,10 @@ module Mixlib
24
24
  class Backend
25
25
  def self.info(options)
26
26
  backend = if options.for_omnitruck?
27
- Backend::Omnitruck.new(options)
28
- elsif options.for_artifactory?
29
- Backend::Artifactory.new(options)
30
- end
27
+ Backend::Omnitruck.new(options)
28
+ elsif options.for_artifactory?
29
+ Backend::Artifactory.new(options)
30
+ end
31
31
 
32
32
  backend.info
33
33
  end
@@ -46,10 +46,10 @@ module Mixlib
46
46
  #
47
47
  def info
48
48
  artifacts = if options.latest_version?
49
- artifactory_latest
50
- else
51
- artifactory_artifacts(options.product_version)
52
- end
49
+ artifactory_latest
50
+ else
51
+ artifactory_artifacts(options.product_version)
52
+ end
53
53
 
54
54
  if options.platform
55
55
  artifacts.select! do |a|
@@ -94,7 +94,7 @@ Can not find any builds for #{options.product_name} in #{::Artifactory.endpoint}
94
94
  # it will run a high number of queries but it is fine because we
95
95
  # are using artifactory only for :unstable channel
96
96
  builds["buildsNumbers"].each do |build|
97
- version = build["uri"].gsub("/", "")
97
+ version = build["uri"].delete("/")
98
98
  artifacts = artifactory_artifacts(version)
99
99
 
100
100
  return artifacts unless artifacts.empty?
@@ -33,6 +33,10 @@ module Mixlib
33
33
  install_command.join("\n\n")
34
34
  end
35
35
 
36
+ def self.detect_platform_sh
37
+ get_script("platform_detection.sh")
38
+ end
39
+
36
40
  def self.script_base_path
37
41
  File.join(File.dirname(__FILE__), "bourne/scripts")
38
42
  end
@@ -27,6 +27,7 @@ do_download "$metadata_url" "$metadata_filename"
27
27
 
28
28
  cat "$metadata_filename"
29
29
 
30
+ echo ""
30
31
  # check that all the mandatory fields in the downloaded metadata are there
31
32
  if grep '^url' $metadata_filename > /dev/null && grep '^sha256' $metadata_filename > /dev/null && grep '^md5' $metadata_filename > /dev/null; then
32
33
  echo "downloaded metadata file looks valid..."
@@ -160,6 +160,8 @@ if test "x$platform" = "xsolaris2"; then
160
160
  export PATH
161
161
  fi
162
162
 
163
+ echo "$platform $platform_version $machine"
164
+
163
165
  ############
164
166
  # end of platform_detection.sh
165
167
  ############
@@ -32,6 +32,13 @@ module Mixlib
32
32
  install_command.join("\n\n")
33
33
  end
34
34
 
35
+ def self.detect_platform_ps1
36
+ detect_platform_command = []
37
+ detect_platform_command << get_script("helpers.ps1")
38
+ detect_platform_command << get_script("platform_detection.ps1")
39
+ detect_platform_command.join("\n\n")
40
+ end
41
+
35
42
  def self.script_base_path
36
43
  File.join(File.dirname(__FILE__), "powershell/scripts")
37
44
  end
@@ -41,7 +41,10 @@ function Get-ProjectMetadata {
41
41
  [switch]
42
42
  $prerelease,
43
43
  [switch]
44
- $nightlies
44
+ $nightlies,
45
+ [validateset('auto', 'i386', 'x86_64')]
46
+ [string]
47
+ $architecture = 'auto'
45
48
  )
46
49
 
47
50
  # The following legacy switches are just aliases for the current channel
@@ -52,26 +55,26 @@ function Get-ProjectMetadata {
52
55
  $platform = 'windows'
53
56
  Write-Verbose "Platform: $platform"
54
57
 
55
- # TODO: No Win10 build endpoint yet
56
- switch -regex ((get-wmiobject win32_operatingsystem).version) {
57
- '10\.0\.\d+' {$platform_version = '2012r2'}
58
- '6\.3\.\d+' {$platform_version = '2012r2'}
59
- '6\.2\.\d+' {$platform_version = '2012'}
60
- '6\.1\.\d+' {$platform_version = '2008r2'}
61
- '6\.0\.\d+' {$platform_version = '2008'}
62
- }
58
+ $platform_version = Get-PlatformVersion
63
59
  Write-Verbose "Platform Version: $platform_version"
64
60
 
65
- # TODO: When we ship a 64 bit ruby for Windows.
66
- $machine = 'x86_64'
67
- Write-Verbose "Machine: $machine"
61
+ # Custom architecture detection based on channel
62
+ if ($architecture -eq 'auto') {
63
+ if (((get-wmiobject win32_operatingsystem).osarchitecture -like '64-bit') -and ($channel -like 'current')) {
64
+ $architecture = 'x86_64'
65
+ } else {
66
+ $architecture = 'i386'
67
+ }
68
+ }
69
+
70
+ Write-Verbose "Architecture: $architecture"
68
71
  Write-Verbose "Project: $project"
69
72
 
70
73
  $metadata_base_url = "$($channel)/$($project)/metadata"
71
74
  $metadata_array = ("?v=$($version)",
72
75
  "p=$platform",
73
76
  "pv=$platform_version",
74
- "m=$machine")
77
+ "m=$architecture")
75
78
  $metadata_base_url += [string]::join('&', $metadata_array)
76
79
  $metadata_url = new-uri $base_server_uri $metadata_base_url
77
80
 
@@ -39,26 +39,24 @@ function Get-ProjectMetadata {
39
39
  [switch]
40
40
  $prerelease,
41
41
  [switch]
42
- $nightlies
42
+ $nightlies,
43
+ [validateset('auto', 'i386', 'x86_64')]
44
+ [string]
45
+ $architecture = 'auto'
43
46
  )
44
47
 
45
48
  # PowerShell is only on Windows ATM
46
49
  $platform = 'windows'
47
50
  Write-Verbose "Platform: $platform"
48
51
 
49
- # TODO: No Win10 build endpoint yet
50
- switch -regex ((get-wmiobject win32_operatingsystem).version) {
51
- '10\.0\.\d+' {$platform_version = '2012r2'}
52
- '6\.3\.\d+' {$platform_version = '2012r2'}
53
- '6\.2\.\d+' {$platform_version = '2012'}
54
- '6\.1\.\d+' {$platform_version = '2008r2'}
55
- '6\.0\.\d+' {$platform_version = '2008'}
56
- }
52
+ $platform_version = Get-PlatformVersion
57
53
  Write-Verbose "Platform Version: $platform_version"
58
54
 
59
- # TODO: When we ship a 64 bit ruby for Windows.
60
- $machine = 'i386'
61
- Write-Verbose "Machine: $machine"
55
+ if ($architecture -eq 'auto') {
56
+ $architecture = Get-PlatformArchitecture
57
+ }
58
+
59
+ Write-Verbose "Architecture: $architecture"
62
60
  Write-Verbose "Project: $project"
63
61
 
64
62
  <% artifacts.each do |artifact| %>
@@ -70,7 +68,7 @@ function Get-ProjectMetadata {
70
68
  "sha256 <%= artifact.sha256%>" | out-file "$artifact_info_dir/artifact_info" -Append
71
69
  <% end %>
72
70
 
73
- $artifact_info_for_platform = Get-Content "$($env:temp)/artifact_info/$($platform)/$($platform_version)/$($machine)/artifact_info"
71
+ $artifact_info_for_platform = Get-Content "$($env:temp)/artifact_info/$($platform)/$($platform_version)/$($architecture)/artifact_info"
74
72
 
75
73
  $package_metadata = ($artifact_info_for_platform).trim() -split '\n' |
76
74
  foreach { $hash = @{} } {$key, $value = $_ -split '\s+'; $hash.Add($key, $value)} {$hash}
@@ -1,3 +1,23 @@
1
+ function Get-PlatformVersion {
2
+ switch -regex ((get-wmiobject win32_operatingsystem).version) {
3
+ '10\.0\.\d+' {$platform_version = '2012r2'}
4
+ '6\.3\.\d+' {$platform_version = '2012r2'}
5
+ '6\.2\.\d+' {$platform_version = '2012'}
6
+ '6\.1\.\d+' {$platform_version = '2008r2'}
7
+ '6\.0\.\d+' {$platform_version = '2008'}
8
+ }
9
+ return $platform_version
10
+ }
11
+
12
+ function Get-PlatformArchitecture {
13
+ if ((get-wmiobject win32_operatingsystem).osarchitecture -like '64-bit') {
14
+ $architecture = 'x86_64'
15
+ } else {
16
+ $architecture = 'i386'
17
+ }
18
+ return $architecture
19
+ }
20
+
1
21
  function New-Uri {
2
22
  param ($baseuri, $newuri)
3
23
 
@@ -44,10 +44,13 @@ function Install-Project {
44
44
  [switch]
45
45
  $prerelease,
46
46
  [switch]
47
- $nightlies
47
+ $nightlies,
48
+ [validateset('auto', 'i386', 'x86_64')]
49
+ [string]
50
+ $architecture = 'auto'
48
51
  )
49
52
 
50
- $package_metadata = Get-ProjectMetadata -project $project -channel $channel -version $version -prerelease:$prerelease -nightlies:$nightlies
53
+ $package_metadata = Get-ProjectMetadata -project $project -channel $channel -version $version -prerelease:$prerelease -nightlies:$nightlies -architecture $architecture
51
54
 
52
55
  if (-not [string]::IsNullOrEmpty($filename)) {
53
56
  $download_directory = split-path $filename
@@ -0,0 +1,4 @@
1
+ $platform_version = Get-PlatformVersion
2
+ $architecture = Get-PlatformArchitecture
3
+
4
+ Write-Host "windows $platform_version $architecture"
@@ -30,15 +30,16 @@ module Mixlib
30
30
  OMNITRUCK_CHANNELS = [:stable, :current]
31
31
  ARTIFACTORY_CHANNELS = [:unstable]
32
32
  ALL_SUPPORTED_CHANNELS = OMNITRUCK_CHANNELS + ARTIFACTORY_CHANNELS
33
- SUPPORTED_PRODUCT_NAMES = %w[
33
+ SUPPORTED_PRODUCT_NAMES = %w{
34
34
  angry-omnibus-toolchain
35
35
  angrychef
36
36
  chef
37
37
  chefdk
38
+ chef-server
38
39
  delivery-cli
39
40
  omnibus-toolchain
40
41
  push-jobs-client
41
- ]
42
+ }
42
43
  SUPPORTED_SHELL_TYPES = [:ps1, :sh]
43
44
  SUPPORTED_OPTIONS = [
44
45
  :architecture,
@@ -47,13 +48,13 @@ module Mixlib
47
48
  :platform_version,
48
49
  :product_name,
49
50
  :product_version,
50
- :shell_type
51
+ :shell_type,
51
52
  ]
52
53
 
53
54
  def initialize(options)
54
55
  @options = options
55
56
  @defaults = {
56
- shell_type: :sh
57
+ shell_type: :sh,
57
58
  }
58
59
 
59
60
  validate!
@@ -99,6 +100,19 @@ module Mixlib
99
100
  product_version.to_sym == :latest
100
101
  end
101
102
 
103
+ #
104
+ # Set the platform info on the instance
105
+ # info [Hash]
106
+ # Hash with keys :platform, :platform_version and :architecture
107
+ #
108
+ def set_platform_info(info)
109
+ options[:platform] = info[:platform]
110
+ options[:platform_version] = info[:platform_version]
111
+ options[:architecture] = info[:architecture]
112
+
113
+ validate_options!
114
+ end
115
+
102
116
  private
103
117
 
104
118
  def validate_product_names
@@ -28,7 +28,7 @@ module Mixlib
28
28
  :config_file,
29
29
  :ctl_command,
30
30
  :package_name,
31
- :product_name
31
+ :product_name,
32
32
  ]
33
33
 
34
34
  #
@@ -198,6 +198,11 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do
198
198
  config_file "/etc/opscode/chef-server.rb"
199
199
  end
200
200
 
201
+ product "chef-server-ha-provisioning" do
202
+ product_name "Chef Server HA Provisioning for AWS"
203
+ package_name "chef-server-ha-provisioning"
204
+ end
205
+
201
206
  product "chef-sync" do
202
207
  product_name "Chef Server Replication addon"
203
208
  package_name "chef-sync"
@@ -55,7 +55,7 @@ module Mixlib
55
55
  attr_accessor :omnibus_url
56
56
  attr_accessor :install_msi_url
57
57
 
58
- VALID_INSTALL_OPTS = %w[omnibus_url
58
+ VALID_INSTALL_OPTS = %w{omnibus_url
59
59
  endpoint
60
60
  http_proxy
61
61
  https_proxy
@@ -66,7 +66,7 @@ module Mixlib
66
66
  project
67
67
  root
68
68
  use_sudo
69
- sudo_command]
69
+ sudo_command}
70
70
 
71
71
  def initialize(version, powershell = false, opts = {})
72
72
  @version = version || "latest"
@@ -82,20 +82,20 @@ module Mixlib
82
82
  @sudo_command = "sudo -E"
83
83
 
84
84
  @root = if powershell
85
- "$env:systemdrive\\opscode\\chef"
86
- else
87
- "/opt/chef"
88
- end
85
+ "$env:systemdrive\\opscode\\chef"
86
+ else
87
+ "/opt/chef"
88
+ end
89
89
 
90
90
  parse_opts(opts)
91
91
  end
92
92
 
93
93
  def install_command
94
94
  vars = if powershell
95
- install_command_vars_for_powershell
96
- else
97
- install_command_vars_for_bourne
98
- end
95
+ install_command_vars_for_powershell
96
+ else
97
+ install_command_vars_for_bourne
98
+ end
99
99
  shell_code_from_file(vars)
100
100
  end
101
101
 
@@ -107,7 +107,7 @@ module Mixlib
107
107
  # @return [String] shell variable lines
108
108
  # @api private
109
109
  def install_command_vars_for_bourne
110
- flags = %w[latest true nightlies].include?(version) ? "" : "-v #{CGI.escape(version)}"
110
+ flags = %w{latest true nightlies}.include?(version) ? "" : "-v #{CGI.escape(version)}"
111
111
  flags << " " << "-n" if nightlies
112
112
  flags << " " << "-p" if prerelease
113
113
  flags << " " << install_flags if install_flags
@@ -118,7 +118,7 @@ module Mixlib
118
118
  shell_var("install_flags", flags.strip),
119
119
  shell_var("pretty_version", Util.pretty_version(version)),
120
120
  shell_var("sudo_sh", sudo("sh")),
121
- shell_var("version", version)
121
+ shell_var("version", version),
122
122
  ].join("\n")
123
123
  end
124
124
 
@@ -132,7 +132,7 @@ module Mixlib
132
132
  def install_command_vars_for_powershell
133
133
  [
134
134
  shell_var("chef_omnibus_root", root),
135
- shell_var("msi", "$env:TEMP\\chef-#{version}.msi")
135
+ shell_var("msi", "$env:TEMP\\chef-#{version}.msi"),
136
136
  ].tap { |vars|
137
137
  if install_msi_url
138
138
  vars << shell_var("chef_msi_url", install_msi_url)
@@ -147,7 +147,7 @@ module Mixlib
147
147
  def validate_opts!(opt)
148
148
  err_msg = ["#{opt} is not a valid option",
149
149
  "valid options are #{VALID_INSTALL_OPTS.join(" ")}"].join(",")
150
- fail ArgumentError, err_msg unless VALID_INSTALL_OPTS.include?(opt.to_s)
150
+ raise ArgumentError, err_msg unless VALID_INSTALL_OPTS.include?(opt.to_s)
151
151
  end
152
152
 
153
153
  def parse_opts(opts)
@@ -165,7 +165,7 @@ module Mixlib
165
165
  def shell_code_from_file(vars)
166
166
  fn = File.join(
167
167
  File.dirname(__FILE__),
168
- %w[.. .. .. support],
168
+ %w{.. .. .. support},
169
169
  "install_command"
170
170
  )
171
171
  Util.shell_code_from_file(vars, fn, powershell,
@@ -193,8 +193,8 @@ module Mixlib
193
193
 
194
194
  def windows_metadata_url
195
195
  base = if omnibus_url =~ %r{/install.sh$}
196
- "#{File.dirname(omnibus_url)}/"
197
- end
196
+ "#{File.dirname(omnibus_url)}/"
197
+ end
198
198
 
199
199
  url = "#{base}#{endpoint}"
200
200
  url << "?p=windows&m=x86_64&pv=2008r2" # same package for all versions
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class Install
3
- VERSION = "0.8.0.alpha.6"
3
+ VERSION = "0.8.0.alpha.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixlib-install
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.alpha.6
4
+ version: 0.8.0.alpha.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thom May
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-03 00:00:00.000000000 Z
12
+ date: 2016-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: artifactory
@@ -113,8 +113,8 @@ files:
113
113
  - PRODUCT_MATRIX.md
114
114
  - README.md
115
115
  - Rakefile
116
+ - acceptance/.gitignore
116
117
  - acceptance/Gemfile
117
- - acceptance/Gemfile.lock
118
118
  - acceptance/current/.acceptance/acceptance-cookbook/.gitignore
119
119
  - acceptance/current/.acceptance/acceptance-cookbook/metadata.rb
120
120
  - acceptance/current/.acceptance/acceptance-cookbook/recipes/destroy.rb
@@ -147,6 +147,7 @@ files:
147
147
  - lib/mixlib/install/generator/powershell/scripts/get_project_metadata_for_artifactory.ps1.erb
148
148
  - lib/mixlib/install/generator/powershell/scripts/helpers.ps1
149
149
  - lib/mixlib/install/generator/powershell/scripts/install_project.ps1
150
+ - lib/mixlib/install/generator/powershell/scripts/platform_detection.ps1
150
151
  - lib/mixlib/install/options.rb
151
152
  - lib/mixlib/install/product.rb
152
153
  - lib/mixlib/install/script_generator.rb
@@ -175,8 +176,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
176
  version: 1.3.1
176
177
  requirements: []
177
178
  rubyforge_project:
178
- rubygems_version: 2.4.8
179
+ rubygems_version: 2.5.2
179
180
  signing_key:
180
181
  specification_version: 4
181
182
  summary: A mixin to help with omnitruck installs
182
183
  test_files: []
184
+ has_rdoc:
@@ -1,91 +0,0 @@
1
- GIT
2
- remote: git://github.com/chef/chef-acceptance.git
3
- revision: 47f5f54e561981802122168ca01ae03907965312
4
- specs:
5
- chef-acceptance (0.2.0)
6
- thor (~> 0.19)
7
-
8
- GIT
9
- remote: git://github.com/sersut/test-kitchen.git
10
- revision: fd05389ec556fdcac96b92b1aea2a9ed48802e75
11
- branch: sersut/mixlib-install-update
12
- specs:
13
- test-kitchen (1.4.3.dev.0)
14
- mixlib-shellout (>= 1.2, < 3.0)
15
- net-scp (~> 1.1)
16
- net-ssh (~> 2.7, < 2.10)
17
- safe_yaml (~> 1.0)
18
- thor (~> 0.18)
19
-
20
- PATH
21
- remote: ../
22
- specs:
23
- mixlib-install (0.8.0.alpha.2)
24
- artifactory (~> 2.3.0)
25
- mixlib-versioning (~> 1.1.0)
26
-
27
- GEM
28
- remote: https://rubygems.org/
29
- specs:
30
- artifactory (2.3.2)
31
- builder (3.2.2)
32
- coderay (1.1.0)
33
- ffi (1.9.10)
34
- gssapi (1.2.0)
35
- ffi (>= 1.0.1)
36
- gyoku (1.3.1)
37
- builder (>= 2.1.2)
38
- httpclient (2.7.0.1)
39
- kitchen-vagrant (0.19.0)
40
- test-kitchen (~> 1.4)
41
- little-plugger (1.1.4)
42
- logging (2.0.0)
43
- little-plugger (~> 1.1)
44
- multi_json (~> 1.10)
45
- method_source (0.8.2)
46
- mixlib-shellout (2.2.5)
47
- mixlib-versioning (1.1.0)
48
- multi_json (1.11.2)
49
- net-scp (1.2.1)
50
- net-ssh (>= 2.6.5)
51
- net-ssh (2.9.2)
52
- nori (2.6.0)
53
- pry (0.10.3)
54
- coderay (~> 1.1.0)
55
- method_source (~> 0.8.1)
56
- slop (~> 3.4)
57
- rubyntlm (0.4.0)
58
- rubyzip (1.1.7)
59
- safe_yaml (1.0.4)
60
- slop (3.6.0)
61
- thor (0.19.1)
62
- uuidtools (2.1.5)
63
- windows_chef_zero (2.0.0)
64
- test-kitchen (>= 1.2.1)
65
- winrm (1.3.6)
66
- builder (>= 2.1.2)
67
- gssapi (~> 1.2)
68
- gyoku (~> 1.0)
69
- httpclient (~> 2.2, >= 2.2.0.2)
70
- logging (>= 1.6.1, < 3.0)
71
- nori (~> 2.0)
72
- rubyntlm (~> 0.4.0)
73
- uuidtools (~> 2.1.2)
74
- winrm-transport (1.0.3)
75
- rubyzip (~> 1.1, >= 1.1.7)
76
- winrm (~> 1.3)
77
-
78
- PLATFORMS
79
- ruby
80
-
81
- DEPENDENCIES
82
- chef-acceptance!
83
- kitchen-vagrant
84
- mixlib-install!
85
- pry
86
- test-kitchen!
87
- windows_chef_zero
88
- winrm-transport
89
-
90
- BUNDLED WITH
91
- 1.10.6