Skip to content

Commit

Permalink
Merge pull request #31 from chef/sp/fix-windows
Browse files Browse the repository at this point in the history
Fix mixlib-archive on Windows, add Appveyor
  • Loading branch information
tas50 committed Aug 28, 2018
2 parents 6d60cdf + 3eb1599 commit 3c59f22
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 7 deletions.
15 changes: 15 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,18 @@ instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
# If you want to load debugging tools into the bundle exec sandbox,
# add these additional dependencies into Gemfile.local
eval_gemfile(__FILE__ + ".local") if File.exist?(__FILE__ + ".local")

# These lines added for Windows (x64) development only.
# For ffi-libarchive to function during development on Windows we need the
# binaries in the RbConfig::CONFIG["bindir"]
#
# We copy (and overwrite) these files every time "bundle <exec|install>" is
# executed, just in case they have changed.
if RUBY_PLATFORM =~ /mswin|mingw|windows/
instance_eval do
ruby_exe_dir = RbConfig::CONFIG["bindir"]
assemblies = Dir.glob(File.expand_path("distro/ruby_bin_folder", Dir.pwd) + "/*.dll")
FileUtils.cp_r assemblies, ruby_exe_dir, verbose: false unless ENV["_BUNDLER_LIBARCHIVE_DLLS_COPIED"]
ENV["_BUNDLER_LIBARCHIVE_DLLS_COPIED"] = "1"
end
end
31 changes: 31 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: "master-{build}"

os: Visual Studio 2017
platform:
- x64

environment:
matrix:
- ruby_version: "25-x64"

clone_folder: c:\projects\mixlib-archive
clone_depth: 1
skip_tags: true
branches:
only:
- master

install:
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
- echo %PATH%
- ruby --version
- gem --version
- gem update --system
- gem install bundler --quiet --no-ri --no-rdoc
- bundler --version

build_script:
- bundle install

test_script:
- bundle exec rake
Binary file added distro/ruby_bin_folder/libarchive.dll
Binary file not shown.
Binary file added distro/ruby_bin_folder/liblzma-5.dll
Binary file not shown.
Binary file added distro/ruby_bin_folder/libxml2-2.dll
Binary file not shown.
8 changes: 1 addition & 7 deletions lib/mixlib/archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,8 @@ def extract(destination, perms: true, ignore: [])

private

BACKSLASH = '\\'.freeze

def path_separator
if Gem.win_platform?
File::ALT_SEPARATOR || BACKSLASH
else
File::SEPARATOR
end
File::SEPARATOR
end

def create_and_empty(destination)
Expand Down

0 comments on commit 3c59f22

Please sign in to comment.