Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 80eb21b

Browse files
committedJul 1, 2015
Make rake-compiler-dock compatible to ruby-1.8.
Not too much changes, so it might be better than checking the ruby version.
1 parent 57a6087 commit 80eb21b

File tree

6 files changed

+16
-28
lines changed

6 files changed

+16
-28
lines changed
 

‎bin/rake-compiler-dock

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ args = ARGV.empty? ? ['bash'] : ARGV.dup
66

77
if $stdin.tty?
88
# An interactive session should not leave the container on Ctrl-C
9-
args << {sigfw: false}
9+
args << {:sigfw => false}
1010
end
1111

1212
begin

‎lib/rake_compiler_dock.rb

-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
2-
# We do ruby version check at runtime, so this file should be kept ruby-1.8 compatible.
3-
if (m=RUBY_VERSION.match(/^(\d+)\.(\d+)\.(\d+)/)) &&
4-
m.captures.map(&:to_i).pack("N*") < [1,9,2].pack("N*")
5-
raise "rake-compiler-dock requires at least RUBY_VERSION >= 1.9.2"
6-
end
7-
81
require "rake_compiler_dock/colors"
92
require "rake_compiler_dock/docker_check"
103
require "rake_compiler_dock/starter"

‎lib/rake_compiler_dock/colors.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ module Colors
77
NND = "#{ESC}0m"
88

99
ColorMap = {
10-
black: 0,
11-
red: 1,
12-
green: 2,
13-
yellow: 3,
14-
blue: 4,
15-
magenta: 5,
16-
cyan: 6,
17-
white: 7,
10+
:black => 0,
11+
:red => 1,
12+
:green => 2,
13+
:yellow => 3,
14+
:blue => 4,
15+
:magenta => 5,
16+
:cyan => 6,
17+
:white => 7,
1818
}
1919

2020
ColorMap.each do |color, code|

‎lib/rake_compiler_dock/docker_check.rb

+4-5
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,19 @@ def b2d_start
7070
@b2d_start_envset = false
7171

7272
if @b2d_start_status == 0
73-
@b2d_start_text.scan(/(unset |Remove-Item Env:\\)(?<key>.+?)$/) do |r, |
74-
io.puts " #{$&}"
73+
io.puts @b2d_start_text
74+
@b2d_start_text.scan(/(unset |Remove-Item Env:\\)(.+?)$/) do |_, key|
7575
ENV.delete(key)
7676
@b2d_start_envset = true
7777
end
78-
@b2d_start_text.scan(/(export |\$Env:)(?<key>.+?)(=| = ")(?<val>.*?)(|\")$/) do |key, val|
79-
io.puts " #{$&}"
78+
@b2d_start_text.scan(/(export |\$Env:)(.+?)(=| = ")(.*?)(|\")$/) do |_, key, _, val, _|
8079
ENV[key] = val
8180
@b2d_start_envset = true
8281
end
8382
end
8483

8584
if @b2d_start_envset
86-
io.puts yellow("Using environment variables for further commands.")
85+
io.puts yellow("Using above environment variables for starting rake-compiler-dock.")
8786
end
8887
end
8988

‎lib/rake_compiler_dock/starter.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ def exec(*args)
5252
user = make_valid_name(`id -nu`.chomp)
5353
group = make_valid_name(`id -ng`.chomp)
5454

55+
drun_args = docker_opts + [image_name] + runargs
56+
5557
cmd = ["docker", "run",
5658
"-v", "#{pwd}:#{make_valid_path(pwd)}",
5759
"-e", "UID=#{uid}",
@@ -62,9 +64,7 @@ def exec(*args)
6264
"-e", "http_proxy=#{ENV['http_proxy']}",
6365
"-e", "https_proxy=#{ENV['https_proxy']}",
6466
"-w", make_valid_path(pwd),
65-
*docker_opts,
66-
image_name,
67-
*runargs]
67+
*drun_args]
6868

6969
cmdline = Shellwords.join(cmd)
7070
if verbose_flag(options) == true
@@ -107,7 +107,6 @@ def check_docker
107107
check = DockerCheck.new($stderr)
108108
unless check.ok?
109109
at_exit do
110-
$stderr.puts
111110
check.print_help_text
112111
end
113112
raise DockerIsNotAvailable, "Docker is not available"

‎rake-compiler-dock.gemspec

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ Gem::Specification.new do |spec|
1313
Use rake-compiler-dock to enter an interactive shell session or add a task to your Rakefile to automate your cross build.}
1414
spec.homepage = "https://github.com/larskanis/rake-compiler-dock"
1515
spec.license = "MIT"
16-
# We do not set a ruby version in the gemspec, to allow addition to the Gemfile of gems that still support ruby-1.8.
17-
# However we do the version check at runtime.
18-
# spec.required_ruby_version = '>= 1.9.2'
1916

2017
spec.files = `git ls-files -z`.split("\x0")
2118
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }

0 commit comments

Comments
 (0)