duct_tape 0.0.4 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -1,10 +1,21 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  group :development do
4
- gem "rake"
5
4
  gem "yard"
6
5
  gem "jeweler"
7
6
  gem "rspec"
7
+ gem "rake"
8
+
9
+ gem (RUBY_VERSION >= "1.9" ? "simplecov" : "rcov")
10
+ end
11
+
12
+ group :mkrf do
13
+ # JRuby can have issues compiling algorithms' extensions
14
+ # Maglev, IronRuby, and MacRuby are untested
15
+ RUBY_ENGINE = "ruby" unless defined? RUBY_ENGINE
16
+ gem 'algorithms' unless RUBY_ENGINE =~ /jruby|maglev|ir|macruby/i
8
17
  end
9
18
 
10
- gem "facets"
19
+ gem "facets", ">=2.9.3"
20
+ gem "backports"
21
+ gem "bundler"
data/Gemfile.lock CHANGED
@@ -1,35 +1,85 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- diff-lcs (1.1.3)
4
+ addressable (2.3.6)
5
+ algorithms (0.6.1)
6
+ backports (3.6.0)
7
+ builder (3.2.2)
8
+ descendants_tracker (0.0.4)
9
+ thread_safe (~> 0.3, >= 0.3.1)
10
+ diff-lcs (1.2.5)
11
+ docile (1.1.5)
5
12
  facets (2.9.3)
6
- git (1.2.5)
7
- jeweler (1.8.4)
8
- bundler (~> 1.0)
13
+ faraday (0.9.0)
14
+ multipart-post (>= 1.2, < 3)
15
+ git (1.2.7)
16
+ github_api (0.11.3)
17
+ addressable (~> 2.3)
18
+ descendants_tracker (~> 0.0.1)
19
+ faraday (~> 0.8, < 0.10)
20
+ hashie (>= 1.2)
21
+ multi_json (>= 1.7.5, < 2.0)
22
+ nokogiri (~> 1.6.0)
23
+ oauth2
24
+ hashie (3.0.0)
25
+ highline (1.6.21)
26
+ jeweler (2.0.1)
27
+ builder
28
+ bundler (>= 1.0)
9
29
  git (>= 1.2.5)
30
+ github_api
31
+ highline (>= 1.6.15)
32
+ nokogiri (>= 1.5.10)
10
33
  rake
11
34
  rdoc
12
- json (1.7.3)
13
- rake (0.9.2.2)
14
- rdoc (3.12)
35
+ json (1.8.1)
36
+ jwt (1.0.0)
37
+ mini_portile (0.6.0)
38
+ multi_json (1.10.1)
39
+ multi_xml (0.5.5)
40
+ multipart-post (2.0.0)
41
+ nokogiri (1.6.2.1)
42
+ mini_portile (= 0.6.0)
43
+ oauth2 (0.9.4)
44
+ faraday (>= 0.8, < 0.10)
45
+ jwt (~> 1.0)
46
+ multi_json (~> 1.3)
47
+ multi_xml (~> 0.5)
48
+ rack (~> 1.2)
49
+ rack (1.5.2)
50
+ rake (10.3.2)
51
+ rdoc (4.1.1)
15
52
  json (~> 1.4)
16
- rspec (2.11.0)
17
- rspec-core (~> 2.11.0)
18
- rspec-expectations (~> 2.11.0)
19
- rspec-mocks (~> 2.11.0)
20
- rspec-core (2.11.0)
21
- rspec-expectations (2.11.1)
22
- diff-lcs (~> 1.1.3)
23
- rspec-mocks (2.11.1)
24
- yard (0.8.2.1)
53
+ rspec (3.0.0)
54
+ rspec-core (~> 3.0.0)
55
+ rspec-expectations (~> 3.0.0)
56
+ rspec-mocks (~> 3.0.0)
57
+ rspec-core (3.0.1)
58
+ rspec-support (~> 3.0.0)
59
+ rspec-expectations (3.0.1)
60
+ diff-lcs (>= 1.2.0, < 2.0)
61
+ rspec-support (~> 3.0.0)
62
+ rspec-mocks (3.0.1)
63
+ rspec-support (~> 3.0.0)
64
+ rspec-support (3.0.0)
65
+ simplecov (0.8.2)
66
+ docile (~> 1.1.0)
67
+ multi_json
68
+ simplecov-html (~> 0.8.0)
69
+ simplecov-html (0.8.0)
70
+ thread_safe (0.3.4)
71
+ yard (0.8.7.4)
25
72
 
26
73
  PLATFORMS
27
74
  ruby
28
- x86-mingw32
29
75
 
30
76
  DEPENDENCIES
31
- facets
77
+ algorithms
78
+ backports
79
+ bundler
80
+ facets (>= 2.9.3)
32
81
  jeweler
33
82
  rake
34
83
  rspec
84
+ simplecov
35
85
  yard
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  # 2-Clause BSD License
2
2
  #
3
- # Copyright (c) 2011-2012, Tim Rodriguez [twrodriguez](https://github.com/twrodriguez)
3
+ # Copyright (c) 2011-2013, Tim Rodriguez [twrodriguez](https://github.com/twrodriguez)
4
4
  # All rights reserved.
5
5
  #
6
6
  # Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -152,6 +152,23 @@ Platform Detection
152
152
  # :ram=>2147483648,
153
153
  # :ruby_version=>"1.8.7"}
154
154
 
155
+ # Kernel (on Mac OSX)
156
+ detect_platform #=> {:arch=>"i386",
157
+ # :hostname=>"MacBook.local",
158
+ # :install_cmd=>"brew install",
159
+ # :install_method=>"install",
160
+ # :interpreter=>"mri",
161
+ # :interpreter_language=>"c",
162
+ # :ipv4=>"192.168.1.18",
163
+ # :mac_addr=>"00:23:12:05:36:b9",
164
+ # :n_cpus=>2,
165
+ # :os_distro=>"Mac OSX",
166
+ # :os_nickname=>"Lion",
167
+ # :os_version=>"10.7.5",
168
+ # :platform=>"darwin",
169
+ # :ram=>2147483648,
170
+ # :ruby_version=>"1.9.3"}
171
+
155
172
 
156
173
  AutoassociativeArray
157
174
  --------------------
data/REQUIRED_FILES ADDED
@@ -0,0 +1,6 @@
1
+ Gemfile
2
+ README.md
3
+ VERSION
4
+ .gitignore
5
+ Rakefile
6
+ LICENSE
data/Rakefile CHANGED
@@ -2,7 +2,8 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'jeweler'
4
4
 
5
- version = File.read(File.expand_path("../VERSION",__FILE__)).strip
5
+ VERSION_FILE = File.expand_path("../VERSION", __FILE__)
6
+ VERSION_STRING = File.read(VERSION_FILE).strip
6
7
  Jeweler::Tasks.new do |gem|
7
8
  gem.name = "duct_tape"
8
9
  gem.summary = "A bunch of useful patches for core Ruby classes"
@@ -13,7 +14,7 @@ Jeweler::Tasks.new do |gem|
13
14
  gem.extensions = 'ext/mkrf_conf.rb'
14
15
  gem.required_ruby_version = '>= 1.8.7'
15
16
  gem.license = 'Simplified BSD'
16
- gem.version = version
17
+ gem.version = VERSION_STRING
17
18
  # dependencies defined in Gemfile
18
19
  end
19
20
  Jeweler::RubygemsDotOrgTasks.new
@@ -29,10 +30,116 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
29
30
  spec.rcov = true
30
31
  end
31
32
 
32
- task :default => :spec
33
-
34
33
  begin
35
34
  require 'yard'
36
35
  YARD::Rake::YardocTask.new
37
36
  rescue LoadError
38
37
  end
38
+
39
+ desc "Check syntax for all project files"
40
+ task :syntax do
41
+ types = {
42
+ "yaml" => [{
43
+ :cmd => %q{ruby -ryaml -e "begin; YAML::load(IO.read('%s')); rescue Exception => e; raise if e.is_a?(SyntaxError); end"}
44
+ }],
45
+ "json" => [{
46
+ :check => %q{gem list | grep "json"},
47
+ :cmd => %q{ruby -rrubygems -rjson -e "JSON.parse(IO.read('%s'))"}
48
+ }],
49
+ "css" => [{
50
+ :cmd => %q{lessc "%s"},
51
+ }],
52
+ #"less" => [{:cmd => %q{lessc "%s"}}],
53
+ "js" => [{
54
+ :cmd => %q{js -C "%s"},
55
+ }, {
56
+ :cmd => %q{uglifyjs "%s"},
57
+ }],
58
+ "py" => [{
59
+ :cmd => %q{python -m py_comile "%s"},
60
+ }, {
61
+ :cmd => %q{pypy -m py_comile "%s"},
62
+ }],
63
+ "rb" => [{
64
+ :cmd => %q{ruby -c "%s"}
65
+ }],
66
+ "rake" => [{
67
+ :cmd => %q{ruby -c "%s"}
68
+ }],
69
+ "sh" => [{
70
+ :cmd => %q{bash -n "%s"}
71
+ }],
72
+ }
73
+
74
+ types.each do |type,method_array|
75
+ types[type].each_with_index do |method_hsh,idx|
76
+ types[type][idx][:check] ||= "which #{types[type][idx][:cmd]}"
77
+ end
78
+ end
79
+
80
+ err = test("e", File.join("", "dev", "null")) ? File.join("", "dev", "null") : "nul"
81
+ syntax_error_found = false
82
+
83
+ Dir[File.join("**", "*")].each do |filename|
84
+ extname = File.extname(filename).gsub(".", "")
85
+
86
+ if types.has_key?(extname)
87
+ if method_hsh = types[extname].detect { |hsh| !(`#{hsh[:check]} 2> #{err}`.strip.empty?) }
88
+ `#{method_hsh[:cmd] % filename} 1> #{err}`
89
+ if $?.to_i != 0
90
+ syntax_error_found = true
91
+ warn "Syntax Error found for '#{filename}'!"
92
+ end
93
+ end
94
+ end
95
+ end
96
+
97
+ if syntax_error_found
98
+ fail "Syntax Errors found!"
99
+ else
100
+ puts "Everything seems alright. Try running tests!"
101
+ end
102
+ end
103
+
104
+ desc "Increment patch version"
105
+ task :bump_patch_version do
106
+ puts "Old Version: #{VERSION_STRING}"
107
+ File.open(VERSION_FILE, "w") do |f|
108
+ f.write(VERSION_STRING.sub!(/^(\d+)\.(\d+)\.(\d+)$/) { |s| "#{$1}.#{$2}.#{$3.to_i + 1}" })
109
+ end
110
+ commit_msg = "New Version: #{VERSION_STRING}"
111
+ sh "git commit -m #{commit_msg.inspect} #{(VERSION_FILE).to_s.inspect}"
112
+ sh "git checkout -- #{(VERSION_FILE).to_s.inspect}"
113
+ end
114
+
115
+ desc "Increment minor version"
116
+ task :bump_minor_version do
117
+ puts "Old Version: #{VERSION_STRING}"
118
+ File.open(VERSION_FILE, "w") do |f|
119
+ f.write(VERSION_STRING.sub!(/^(\d+)\.(\d+)\.(\d+)$/) { |s| "#{$1}.#{$2.to_i + 1}.0" })
120
+ end
121
+ commit_msg = "New Version: #{VERSION_STRING}"
122
+ sh "git commit -m #{commit_msg.inspect} #{(VERSION_FILE).to_s.inspect}"
123
+ sh "git checkout -- #{(VERSION_FILE).to_s.inspect}"
124
+ end
125
+
126
+ desc "Increment major version"
127
+ task :bump_major_version do
128
+ puts "Old Version: #{VERSION_STRING}"
129
+ File.open(VERSION_FILE, "w") do |f|
130
+ f.write(VERSION_STRING.sub!(/^(\d+)\.(\d+)\.(\d+)$/) { |s| "#{$1.to_i + 1}.0.0" })
131
+ end
132
+ commit_msg = "New Version: #{VERSION_STRING}"
133
+ sh "git commit -m #{commit_msg.inspect} #{(VERSION_FILE).to_s.inspect}"
134
+ sh "git checkout -- #{(VERSION_FILE).to_s.inspect}"
135
+ end
136
+
137
+ desc "Finalize release (tag & increment version)"
138
+ task :release do
139
+ puts "Tagging release version: #{VERSION_STRING}"
140
+ sh "git tag v#{VERSION_STRING}"
141
+ sh "git push --tags"
142
+ Rake::Task[:bump_patch_version].invoke
143
+ end
144
+
145
+ task :default => :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.1.2
data/duct_tape.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "duct_tape"
8
- s.version = "0.0.4"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tim Rodriguez"]
12
- s.date = "2012-11-02"
12
+ s.date = "2014-06-13"
13
13
  s.description = "A general-purpose utility library for Ruby"
14
14
  s.email = ["tw.rodriguez@gmail.com"]
15
15
  s.extensions = ["ext/mkrf_conf.rb"]
@@ -26,11 +26,6 @@ Gem::Specification.new do |s|
26
26
  "VERSION",
27
27
  "duct_tape.gemspec",
28
28
  "ext/mkrf_conf.rb",
29
- "git_hooks/env_vars.sh",
30
- "git_hooks/post-commit",
31
- "git_hooks/post-merge",
32
- "git_hooks/pre-commit",
33
- "install_git_hooks",
34
29
  "lib/algorithms/containers.rb",
35
30
  "lib/algorithms/containers/heap.rb",
36
31
  "lib/algorithms/containers/priority_queue.rb",
@@ -77,30 +72,40 @@ Gem::Specification.new do |s|
77
72
  s.licenses = ["Simplified BSD"]
78
73
  s.require_paths = ["lib"]
79
74
  s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
80
- s.rubygems_version = "1.8.24"
75
+ s.rubygems_version = "1.8.23.2"
81
76
  s.summary = "A bunch of useful patches for core Ruby classes"
82
77
 
83
78
  if s.respond_to? :specification_version then
84
79
  s.specification_version = 3
85
80
 
86
81
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
87
- s.add_runtime_dependency(%q<facets>, [">= 0"])
88
- s.add_development_dependency(%q<rake>, [">= 0"])
82
+ s.add_runtime_dependency(%q<facets>, [">= 2.9.3"])
83
+ s.add_runtime_dependency(%q<backports>, [">= 0"])
84
+ s.add_runtime_dependency(%q<bundler>, [">= 0"])
89
85
  s.add_development_dependency(%q<yard>, [">= 0"])
90
86
  s.add_development_dependency(%q<jeweler>, [">= 0"])
91
87
  s.add_development_dependency(%q<rspec>, [">= 0"])
88
+ s.add_development_dependency(%q<rake>, [">= 0"])
89
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
92
90
  else
93
- s.add_dependency(%q<facets>, [">= 0"])
94
- s.add_dependency(%q<rake>, [">= 0"])
91
+ s.add_dependency(%q<facets>, [">= 2.9.3"])
92
+ s.add_dependency(%q<backports>, [">= 0"])
93
+ s.add_dependency(%q<bundler>, [">= 0"])
95
94
  s.add_dependency(%q<yard>, [">= 0"])
96
95
  s.add_dependency(%q<jeweler>, [">= 0"])
97
96
  s.add_dependency(%q<rspec>, [">= 0"])
97
+ s.add_dependency(%q<rake>, [">= 0"])
98
+ s.add_dependency(%q<simplecov>, [">= 0"])
98
99
  end
99
100
  else
100
- s.add_dependency(%q<facets>, [">= 0"])
101
- s.add_dependency(%q<rake>, [">= 0"])
101
+ s.add_dependency(%q<facets>, [">= 2.9.3"])
102
+ s.add_dependency(%q<backports>, [">= 0"])
103
+ s.add_dependency(%q<bundler>, [">= 0"])
102
104
  s.add_dependency(%q<yard>, [">= 0"])
103
105
  s.add_dependency(%q<jeweler>, [">= 0"])
104
106
  s.add_dependency(%q<rspec>, [">= 0"])
107
+ s.add_dependency(%q<rake>, [">= 0"])
108
+ s.add_dependency(%q<simplecov>, [">= 0"])
105
109
  end
106
110
  end
111
+
data/ext/mkrf_conf.rb CHANGED
@@ -1,7 +1,12 @@
1
+ require 'rbconfig'
2
+ require 'bundler'
3
+
4
+ system("bundle install --system --without development")
5
+
6
+ =begin
1
7
  require 'rubygems'
2
8
  require 'rubygems/command.rb'
3
9
  require 'rubygems/dependency_installer.rb'
4
- require 'rbconfig'
5
10
 
6
11
  begin
7
12
  Gem::Command.build_args = ARGV
@@ -24,13 +29,22 @@ if engine !~ /jruby|maglev|ir|macruby/i
24
29
  end
25
30
  end
26
31
 
32
+ begin
33
+ require 'facets'
34
+ rescue LoadError
35
+ inst.install "facets"
36
+ end
37
+
38
+ if Facets::VERSION <= "2.9.3"
39
+ end
40
+ #gem "facets", "> 2.9.3", :git => 'git://github.com/twrodriguez/facets.git', :branch => 'extend_patch_2_9_3'
41
+
27
42
  if RUBY_VERSION >= "1.9"
28
43
  #inst.install "simplecov"
29
44
  else
30
45
  #inst.install "rcov"
31
46
  end
47
+ =end
32
48
 
33
49
  # create dummy rakefile to indicate success
34
- f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
35
- f.write("task :default\n")
36
- f.close
50
+ File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w") { |f| f.write("task :default\n") }
data/lib/duct_tape.rb CHANGED
@@ -1,5 +1,88 @@
1
1
  require 'rubygems'
2
- require 'facets'
2
+ require 'backports'
3
+ require 'facets/kernel'
4
+ require 'facets/enumerable'
5
+ require 'facets/array'
6
+ require 'facets/dir'
7
+ require 'facets/file'
8
+ require 'facets/hash'
9
+ require 'facets/numeric'
10
+ require 'facets/range'
11
+ require 'facets/regexp'
12
+ #########################################
13
+ #require 'facets/string'
14
+ #########################################
15
+ # Can't require facets/string directly because there are no guards
16
+ # against re-defining certain functions
17
+ require 'facets/kernel/require_relative'
18
+
19
+ require 'facets/string/acronym.rb'
20
+ require 'facets/string/align.rb'
21
+ require 'facets/string/bytes.rb'
22
+ require 'facets/string/camelcase.rb'
23
+ require 'facets/string/capitalized.rb'
24
+ require 'facets/string/characters.rb'
25
+ require 'facets/string/cleanlines.rb'
26
+ require 'facets/string/cleave.rb'
27
+ require 'facets/string/cmp.rb'
28
+ require 'facets/string/compress_lines.rb'
29
+ require 'facets/string/divide.rb'
30
+ require 'facets/string/each_char.rb'
31
+ require 'facets/string/each_word.rb'
32
+ require 'facets/string/edit_distance.rb'
33
+ require 'facets/string/exclude.rb'
34
+ require 'facets/string/expand_tab.rb'
35
+ require 'facets/string/file.rb'
36
+ require 'facets/string/fold.rb'
37
+ require 'facets/string/indent.rb'
38
+ require 'facets/string/index_all.rb'
39
+ require 'facets/string/interpolate.rb'
40
+ require 'facets/string/lchomp.rb'
41
+ require 'facets/string/lines.rb'
42
+ require 'facets/string/line_wrap.rb'
43
+ require 'facets/string/lowercase.rb'
44
+ require 'facets/string/margin.rb'
45
+ require 'facets/string/methodize.rb'
46
+ require 'facets/string/modulize.rb'
47
+ require 'facets/string/mscan.rb'
48
+ require 'facets/string/natcmp.rb'
49
+ require 'facets/string/nchar.rb'
50
+ require 'facets/string/newlines.rb'
51
+ require 'facets/string/op_div.rb'
52
+ require 'facets/string/op_sub.rb'
53
+ require 'facets/string/outdent.rb'
54
+ require 'facets/string/pathize.rb'
55
+ require 'facets/string/quote.rb'
56
+ require 'facets/string/random_binary.rb'
57
+ require 'facets/string/range.rb'
58
+ require 'facets/string/range_all.rb'
59
+ require 'facets/string/range_of_line.rb'
60
+ require 'facets/string/rewrite.rb'
61
+ require 'facets/string/shatter.rb'
62
+ require 'facets/string/similarity.rb'
63
+ require 'facets/string/snakecase.rb'
64
+ require 'facets/string/splice.rb'
65
+ require 'facets/string/squish.rb'
66
+ require 'facets/string/store.rb'
67
+ require 'facets/string/subtract.rb'
68
+ require 'facets/string/tab.rb'
69
+ require 'facets/string/tabto.rb'
70
+ require 'facets/string/titlecase.rb'
71
+ require 'facets/string/to_re.rb'
72
+ require 'facets/string/underscore.rb'
73
+ require 'facets/string/unfold.rb'
74
+ require 'facets/string/unindent.rb'
75
+ require 'facets/string/unquote.rb'
76
+ require 'facets/string/uppercase.rb'
77
+ require 'facets/string/variablize.rb'
78
+ require 'facets/string/words.rb'
79
+ require 'facets/string/word_wrap.rb'
80
+ require 'facets/string/xor.rb'
81
+ #########################################
82
+ require 'facets/symbol'
83
+ require 'facets/time'
84
+ require 'facets/uri'
85
+
3
86
  Dir[__DIR__("ext", "*.rb")].each { |f| require f }
4
87
 
5
88
  if gem_installed?('algorithms')
data/lib/ext/kernel.rb CHANGED
@@ -4,29 +4,51 @@ require 'stringio'
4
4
  module Kernel
5
5
  private
6
6
 
7
- def this_method
8
- (caller[0..-1].detect { |c| c =~ /`([^']*)'/ } && $1).to_sym
9
- rescue NoMethodError
10
- nil
11
- end
7
+ if defined?(caller_locations)
8
+ def this_method
9
+ caller_locations(1, 1)[0].label.to_sym
10
+ rescue NoMethodError
11
+ nil
12
+ end
12
13
 
13
- def calling_method
14
- (caller[1..-1].detect { |c| c =~ /`([^']*)'/ } && $1).to_sym
15
- rescue NoMethodError
16
- nil
17
- end
14
+ def calling_method
15
+ caller_locations(2, 1)[0].label.to_sym
16
+ rescue NoMethodError
17
+ nil
18
+ end
18
19
 
19
- def calling_method_file(idx=1)
20
- c = caller[idx]
21
- return nil unless c.rindex(/:\d+(:in `.*')?$/)
22
- file = $`
23
- return nil if /\A\((.*)\)/ =~ file
24
- file
25
- end
20
+ def calling_method_file(idx=1)
21
+ caller_locations(idx+1, 1)[0].path
22
+ end
23
+
24
+ def calling_method_dirname(idx=1)
25
+ File.dirname(caller_locations(idx+1, 1)[0].path)
26
+ end
27
+ else
28
+ def this_method
29
+ (caller[0..-1].detect { |c| c =~ /`([^']*)'/ } && $1).to_sym
30
+ rescue NoMethodError
31
+ nil
32
+ end
33
+
34
+ def calling_method
35
+ (caller[1..-1].detect { |c| c =~ /`([^']*)'/ } && $1).to_sym
36
+ rescue NoMethodError
37
+ nil
38
+ end
39
+
40
+ def calling_method_file(idx=1)
41
+ c = caller[idx]
42
+ return nil unless c.rindex(/:\d+(:in `.*')?$/)
43
+ file = $`
44
+ return nil if /\A\((.*)\)/ =~ file
45
+ file
46
+ end
26
47
 
27
- def calling_method_dirname(idx=1)
28
- found = calling_method_file(idx+1)
29
- found.nil? ? found : File.dirname(found)
48
+ def calling_method_dirname(idx=1)
49
+ found = calling_method_file(idx+1)
50
+ found.nil? ? found : File.dirname(found)
51
+ end
30
52
  end
31
53
 
32
54
  def tty?
@@ -137,15 +159,16 @@ module Kernel
137
159
  :os_distro => "Mac OSX",
138
160
  :os_version => version,
139
161
  :os_nickname => case version
140
- when /^10.0/; "Cheetah"
141
- when /^10.1/; "Puma"
142
- when /^10.2/; "Jaguar"
143
- when /^10.3/; "Panther"
144
- when /^10.4/; "Tiger"
145
- when /^10.5/; "Leopard"
146
- when /^10.6/; "Snow Leopard"
147
- when /^10.7/; "Lion"
148
- when /^10.8/; "Mountain Lion"
162
+ when /^10\.0\./; "Cheetah"
163
+ when /^10\.1\./; "Puma"
164
+ when /^10\.2\./; "Jaguar"
165
+ when /^10\.3\./; "Panther"
166
+ when /^10\.4\./; "Tiger"
167
+ when /^10\.5\./; "Leopard"
168
+ when /^10\.6\./; "Snow Leopard"
169
+ when /^10\.7\./; "Lion"
170
+ when /^10\.8\./; "Mountain Lion"
171
+ when /^10\.9\./; "Mavericks"
149
172
  else; "Unknown Version of OSX"
150
173
  end,
151
174
  :install_method => "install",
@@ -322,15 +345,23 @@ module Kernel
322
345
  unless try_boot_ini.empty?
323
346
  nickname = try_boot_ini.match(/WINDOWS="([^"]+)"/i)[1].strip
324
347
  end
325
- @@os_features.merge!({
348
+
349
+ install_method, install_cmd = case ::RbConfig::CONFIG['host_os'].downcase
350
+ when /mingw/; ["build", nil]
351
+ when /mswin/; ["install", "install"]
352
+ when /cygwin/; ["install", "setup.exe -q -D -P"] # TODO - Does this detect cygwin properly?
353
+ end
354
+ ret = {
326
355
  :os_distro => nickname.split(/\s+/).reject { |s| s =~ /microsoft|windows/i }.join(" "),
327
356
  :hostname => hostname,
328
357
  :os_nickname => nickname,
329
358
  :os_version => version,
330
- :platform => "windows",
331
- :install_method => "install",
332
- :install_cmd => "install",
333
- })
359
+ :platform => "windows", # TODO - Cygwin / MinGW
360
+ :install_method => install_method,
361
+ :install_cmd => install_cmd,
362
+ }
363
+ ret.reject! { |k,v| v.nil? }
364
+ @@os_features.merge!(ret)
334
365
  end
335
366
 
336
367
  case ::RbConfig::CONFIG['host_os'].downcase