Skip to content

Commit

Permalink
Nearly there for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmorley committed Oct 18, 2016
1 parent ea5ee04 commit d8c1f60
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/workup/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
#

module Workup
VERSION = '0.1.0'
VERSION = '0.1.1'
end
4 changes: 3 additions & 1 deletion omnibus/config/projects/workup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
# and /opt/workup on all other platforms
install_dir "#{default_root}/#{name}"

build_version Omnibus::BuildVersion.semver
build_version '0.1.1'

build_iteration 1

# Creates required build directories
Expand All @@ -30,5 +31,6 @@
exclude '**/bundler/git'

package :msi do
fast_msi
upgrade_code '769d8737-c798-49d1-bab0-0a31da3ee7df'.capitalize
end
11 changes: 10 additions & 1 deletion omnibus/config/software/workup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,14 @@

env = with_standard_compiler_flags(with_embedded_path)

gem 'install pkg/workup-0.1.0.gem', env: env
gem 'install pkg/workup-0.1.1.gem', env: env

block do
open("#{install_dir}/bin/workup.bat", "w") do |file|
file.print <<-EOH
@ECHO OFF
"%~dp0\\..\\embedded\\bin\\workup.bat" %*
EOH
end
end if windows?
end
9 changes: 9 additions & 0 deletions omnibus/workup_build/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,13 @@
command 'installer -pkg $(ls /vagrant/code/workup/omnibus/pkg/*.pkg | tail -n1) -target /'
end
when 'windows'
execute 'copy pkg back' do
command 'robocopy /vagrant/code/workup/omnibus/pkg /Users/vagrant/workup/omnibus/pkg'
returns [0, 1, 2, 3]
end

powershell_script 'install workup' do
action :run
code "cmd /c start '' /wait msiexec /i (ls /vagrant/code/workup/omnibus/pkg/*.msi | select -last 1).FullName /qn"
end
end
21 changes: 16 additions & 5 deletions omnibus/workup_build/test/integration/default/workup_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
# frozen_string_literal: true
describe file('/usr/local/bin/workup') do
it { should exist }

def env(cmd, **options)
(options.map do |k, v|
os.family == 'windows' ? "$env:#{k} = '#{v}';" : "#{k}='#{v}'"
end + [*cmd]).join(' ')
end

# Waiting on login shell support
describe command('workup') do
workup_bins = os.family == 'windows' ? 'C:/workup/bin' : '/usr/local/bin'
workup_bin = File.join(workup_bins, 'workup')

describe file(workup_bin) do
it { should exist }
end

describe command('PASSWORD=vagrant /usr/local/bin/workup') do
# Waiting on login shell support
# describe command('workup') do
# it { should exist }
# end

describe command(env(workup_bin, PASSWORD: 'vagrant')) do
its('exit_status') { should eq 0 }
its('stdout') { should match 'Chef Client finished, 0/0 resources updated' }
its('stderr') { should be_empty }
end
3 changes: 1 addition & 2 deletions workup.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ Gem::Specification.new do |spec|
and minimal assumptions about the initial state of the machine.'
spec.homepage = 'https://github.com/cvent/workup'

spec.files = Dir.glob('{lib,files,exe}/**', File::FNM_DOTMATCH)
.reject { |f| File.directory?(f) }
spec.files = Dir.glob('{lib,files,exe}/**/*', File::FNM_DOTMATCH)
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
Expand Down

0 comments on commit d8c1f60

Please sign in to comment.