pik 0.2.2 → 0.2.3
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/History.txt +14 -1
- data/Manifest.txt +9 -4
- data/README.rdoc +15 -13
- data/Rakefile +77 -13
- data/bin/pik_install +9 -5
- data/features/add_command.feature +3 -3
- data/features/env.rb +5 -5
- data/features/install_command.feature +17 -0
- data/features/list_command.feature +10 -1
- data/features/switch_command.feature +2 -2
- data/features/tag_command.feature +5 -0
- data/lib/pik.rb +5 -2
- data/lib/pik/commands/command.rb +1 -1
- data/lib/pik/commands/config_command.rb +3 -0
- data/lib/pik/commands/help_command.rb +1 -1
- data/lib/pik/commands/install_command.rb +15 -50
- data/lib/pik/commands/list_command.rb +18 -1
- data/lib/pik/commands/run_command.rb +41 -8
- data/lib/pik/commands/tag_command.rb +19 -0
- data/lib/pik/config_file.rb +2 -1
- data/lib/pik/core_ext/pathname.rb +2 -2
- data/lib/pik/implementations.rb +104 -0
- data/lib/pik/pik.rb +10 -0
- data/lib/pik/search_path.rb +5 -1
- data/spec/help_command_spec.rb +1 -22
- data/spec/html/ironruby.htm +378 -0
- data/spec/html/jruby.htm +186 -0
- data/spec/html/ruby.htm +358 -0
- data/spec/implementations_spec.rb +157 -0
- data/spec/list_command_spec.rb +0 -10
- data/spec/search_path_spec.rb +10 -8
- data/tools/pik.bat +1 -1
- data/tools/pik/{pik → pik_runner} +1 -3
- data/tools/pik/{pik.exe → pik_runner.exe} +0 -0
- data/tools/pik/{pik.exy → pik_runner.exy} +15 -5
- metadata +32 -16
- data/lib/pik/runner.rb +0 -16
data/History.txt
CHANGED
@@ -1,7 +1,20 @@
|
|
1
|
+
=== 0.2.3 / 2009-10-25
|
2
|
+
|
3
|
+
* install command improvements - better error message on unrecognized implementation, better version picking, better directory naming, renamed some variables to be more concise (not everything is a version - implementations have versions, and versions have packages)
|
4
|
+
* added remote option to list command
|
5
|
+
* better error message when a version was deleted, but not removed from the config. Thanks Roger Pack
|
6
|
+
* bugfix: run/gem/ruby command hangs when waiting for input. Thanks Roger Pack
|
7
|
+
* renamed tools/pik.exe to pik_runner.exe to minimize confusion/conflicts. Thanks Luis Lavena
|
8
|
+
* Upgraded to exerb 0.4.4. Thanks Alexey Borzenkov
|
9
|
+
* Added documentation for tags commands. Thanks Luis Lavena
|
10
|
+
* 'pik tags' with no options will display the help docs, instead of throwing a cryptic error.
|
11
|
+
* Added docs for ruby and gem command. Improved docs for run command
|
12
|
+
|
1
13
|
=== 0.2.2 / 2009-10-20
|
2
14
|
|
3
15
|
* Pik::Command#get_version now handles paths with spaces. Thanks to Dominic Sisneros and Vassilis Rizopoulos
|
4
16
|
* All Cucumber scenarios are run against 'C:\temp\path with spaces' instead of 'C:\temp'
|
17
|
+
* Added :rebuild task as a dependency to :package task, so that the executable gets rebuilt on packaging. Thanks, skim.
|
5
18
|
|
6
19
|
=== 0.2.1 / 2009-10-19
|
7
20
|
|
@@ -10,7 +23,7 @@
|
|
10
23
|
|
11
24
|
=== 0.2.0 / 2009-10-18
|
12
25
|
|
13
|
-
* pik is now an exerb
|
26
|
+
* pik is now an exerb compiled executable, and must be installed to a location that is in the system path, but is
|
14
27
|
seperate from ruby
|
15
28
|
* added pik_install command
|
16
29
|
* added support for IronRuby and Jruby
|
data/Manifest.txt
CHANGED
@@ -50,8 +50,9 @@ lib/pik/contrib/zip/zip.rb
|
|
50
50
|
lib/pik/contrib/zip/zipfilesystem.rb
|
51
51
|
lib/pik/contrib/zip/ziprequire.rb
|
52
52
|
lib/pik/core_ext/pathname.rb
|
53
|
+
lib/pik/implementations.rb
|
53
54
|
lib/pik/options.rb
|
54
|
-
lib/pik/
|
55
|
+
lib/pik/pik.rb
|
55
56
|
lib/pik/search_path.rb
|
56
57
|
lib/pik/which.rb
|
57
58
|
lib/pik/windows_env.rb
|
@@ -62,6 +63,10 @@ spec/commands_spec.rb
|
|
62
63
|
spec/default_command_spec.rb
|
63
64
|
spec/gemsync_command_spec.rb
|
64
65
|
spec/help_command_spec.rb
|
66
|
+
spec/html/ironruby.htm
|
67
|
+
spec/html/jruby.htm
|
68
|
+
spec/html/ruby.htm
|
69
|
+
spec/implementations_spec.rb
|
65
70
|
spec/list_command_spec.rb
|
66
71
|
spec/pathname_spec.rb
|
67
72
|
spec/remove_command_spec.rb
|
@@ -71,6 +76,6 @@ spec/spec.opts
|
|
71
76
|
spec/switch_command_spec.rb
|
72
77
|
spec/which_spec.rb
|
73
78
|
tools/pik.bat
|
74
|
-
tools/pik/
|
75
|
-
tools/pik/
|
76
|
-
tools/pik/
|
79
|
+
tools/pik/pik_runner
|
80
|
+
tools/pik/pik_runner.exe
|
81
|
+
tools/pik/pik_runner.exy
|
data/README.rdoc
CHANGED
@@ -2,9 +2,11 @@
|
|
2
2
|
|
3
3
|
http://github.com/vertiginous/pik
|
4
4
|
|
5
|
-
|
5
|
+
Mailing List: http://groups.google.com/group/discuss_pik
|
6
6
|
|
7
|
-
Rubyforge:
|
7
|
+
Rubyforge: http://rubyforge.org/projects/pik/
|
8
|
+
|
9
|
+
Bugs/Feature requests: http://github.com/vertiginous/pik/issues
|
8
10
|
|
9
11
|
Gordon Thiesfeld
|
10
12
|
|
@@ -58,23 +60,18 @@ Windows, more than one version of Ruby (otherwise, what's the point?) and Rubyge
|
|
58
60
|
|
59
61
|
== INSTALL:
|
60
62
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
pik run "gem uninstall pik"
|
65
|
-
|
66
|
-
2. Install the pik gem
|
67
|
-
|
68
|
-
gem install pik
|
63
|
+
* If you're upgrading from a version <= 0.1.1, you'll want to delete the pik.bat file
|
64
|
+
from all of your ruby versions. Gem uninstall should do the trick.
|
69
65
|
|
70
|
-
|
71
|
-
|
66
|
+
* Install pik to a location that's in your path, but someplace other than your ruby\bin dir
|
67
|
+
If you're upgrading from a more recent version, pik_install will overwrite the older files as needed.
|
68
|
+
|
72
69
|
>path
|
73
70
|
PATH=C:\tools\;C:\ruby\186-p368-mingw32\bin;C:\WINDOWS\system32;C:\WINDOWS
|
74
71
|
|
75
72
|
>pik_install C:\tools
|
76
73
|
|
77
|
-
|
74
|
+
* If this is a first-time install, add all the versions of ruby that you want to use with pik
|
78
75
|
|
79
76
|
>pik add
|
80
77
|
Adding: 186: ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]
|
@@ -94,6 +91,11 @@ Note:
|
|
94
91
|
inside of the IronRuby lib:
|
95
92
|
|
96
93
|
pik config gem_home=C:\ruby\ironruby-091\lib\ironruby\gems\1.8
|
94
|
+
|
95
|
+
Also, if you're using a version of JRuby older than 1.4.0RC2, you'll probably need to set the JAVA_HOME env
|
96
|
+
variable.
|
97
|
+
|
98
|
+
set JAVA_HOME=C:\Program Files\Java\jre6
|
97
99
|
|
98
100
|
== EXAMPLES:
|
99
101
|
|
data/Rakefile
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
+
require 'win32/process'
|
4
5
|
|
5
6
|
file 'tools/pik/pik.exy' do
|
6
7
|
Dir.chdir 'tools/pik' do
|
7
|
-
sh('ruby -rexerb/mkexy
|
8
|
+
sh('ruby -rexerb/mkexy pik_runner')
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
11
12
|
file 'tools/pik/pik.exe', :needs => 'tools/pik/pik.exy' do
|
12
13
|
Dir.chdir 'tools/pik' do
|
13
|
-
sh('ruby -S exerb
|
14
|
+
sh('ruby -S exerb pik_runner.exy')
|
14
15
|
end
|
15
16
|
end
|
16
17
|
|
@@ -50,20 +51,31 @@ Hoe.spec('pik') do
|
|
50
51
|
|
51
52
|
----------------------------------------------------------------------------
|
52
53
|
|
53
|
-
|
54
|
-
|
54
|
+
* If you're upgrading from a version <= 0.1.1, you'll want to delete the pik.bat file
|
55
|
+
from all of your ruby versions. Gem uninstall should do the trick.
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
3. You need to install pik to a location that's in your path, but someplace other than your ruby\\bin dir
|
57
|
+
* Install pik to a location that's in your path, but someplace other than your ruby\\bin dir
|
58
|
+
If you're upgrading from a more recent version, pik_install will overwrite the older files as needed.
|
59
|
+
|
60
|
+
>path
|
61
|
+
PATH=C:\\tools\\;C:\\ruby\\186-p368-mingw32\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS
|
63
62
|
|
64
|
-
pik_install C:\\
|
63
|
+
>pik_install C:\\tools
|
65
64
|
|
66
|
-
|
65
|
+
* If this is a first-time install, add all the versions of ruby that you want to use with pik
|
66
|
+
|
67
|
+
>pik add
|
68
|
+
Adding: 186: ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]
|
69
|
+
Located at: c:/ruby/186-p368-mingw32/bin
|
70
|
+
|
71
|
+
>pik add C:\\ruby\\IronRuby-091\\bin
|
72
|
+
Adding: 091: IronRuby 0.9.1.0 on .NET 2.0.0.0
|
73
|
+
Located at: C:/ruby/IronRuby-091/bin
|
74
|
+
|
75
|
+
>pik add C:\\ruby\\jruby-1.4.0RC1\\bin
|
76
|
+
Adding: 140: jruby 1.4.0RC1 (ruby 1.8.7 patchlevel 174) (2009-09-30 80c263b) (Java HotSpot(TM) Client VM 1.6.0_14) [x86-java]
|
77
|
+
Located at: C:/ruby/jruby-1.4.0RC1/bin
|
78
|
+
|
67
79
|
|
68
80
|
----------------------------------------------------------------------------
|
69
81
|
|
@@ -74,8 +86,60 @@ end
|
|
74
86
|
require 'cucumber'
|
75
87
|
require 'cucumber/rake/task'
|
76
88
|
|
89
|
+
namespace :cucumber do
|
90
|
+
|
91
|
+
directory "C:/temp"
|
92
|
+
|
93
|
+
desc "sets up C:\\temp for pik's cuke tests"
|
94
|
+
task :setup => "C:/temp" do
|
95
|
+
ENV['HOME'] = "C:\\temp"
|
96
|
+
sh "pik config installs=\"C:\\temp\\more spaces in path\\ruby\""
|
97
|
+
sh "pik install jruby"
|
98
|
+
sh "pik install ironruby"
|
99
|
+
sh "pik install ruby"
|
100
|
+
sh "pik install ruby 1.8"
|
101
|
+
end
|
102
|
+
|
103
|
+
namespace :phonyweb do
|
104
|
+
|
105
|
+
task :start => 'hosts:add' do
|
106
|
+
@web = Process.create(:app_name => "ruby C:\\scripts\\repo\\pik\\phony_web\\server.rb")
|
107
|
+
end
|
108
|
+
|
109
|
+
task :kill => 'hosts:remove' do
|
110
|
+
Process.kill(3, @web.process_id)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# this is used with the phony web server for
|
115
|
+
# testing the install and list command
|
116
|
+
# without sucking up bandwidth. It also makes the
|
117
|
+
# tests run faster
|
118
|
+
namespace :hosts do
|
119
|
+
|
120
|
+
HOSTS = File.join(ENV['SystemRoot'], 'System32','drivers','etc','hosts')
|
121
|
+
desc "adds fake hosts to system's hosts file"
|
122
|
+
task :add do
|
123
|
+
File.open(HOSTS,'a+'){|f|
|
124
|
+
f.puts "127.0.0.1 www.jruby.org rubyforge.org www.rubyforge.org jruby.kenai.com dist.codehaus.org"
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
desc "remove fake hosts from system's hosts file"
|
129
|
+
task :remove do
|
130
|
+
new_hosts = File.open(HOSTS, 'r').readlines.reject{ |i| i =~ /^127\.0\.0\.1 www\.jruby\.org/ }
|
131
|
+
File.open(HOSTS, 'w+'){|f| f.puts new_hosts }
|
132
|
+
end
|
133
|
+
|
134
|
+
task :rm => :remove
|
135
|
+
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
77
139
|
Cucumber::Rake::Task.new(:features) do |t|
|
78
140
|
t.cucumber_opts = "features -f html -o ../pik_cucumber.html -f progress"
|
79
141
|
end
|
80
142
|
|
143
|
+
task :cuke => ['cucumber:phonyweb:start', :features, 'cucumber:phonyweb:kill']
|
144
|
+
|
81
145
|
# vim: syntax=Ruby
|
data/bin/pik_install
CHANGED
@@ -12,12 +12,16 @@ tools_dir = File.join(File.dirname(__FILE__), '..', 'tools')
|
|
12
12
|
if File.directory?(install_dir)
|
13
13
|
puts "Installing to #{install_dir}\n\n"
|
14
14
|
cp File.join(tools_dir, 'pik.bat'), install_dir ,
|
15
|
-
|
15
|
+
:verbose => true
|
16
16
|
mkdir_p File.join(install_dir, 'pik'), :verbose => true
|
17
|
-
cp File.join(tools_dir, 'pik', '
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
cp File.join(tools_dir, 'pik', 'pik_runner.exe'),
|
18
|
+
File.join(install_dir, 'pik') ,
|
19
|
+
:verbose => true
|
20
|
+
|
21
|
+
old_exe = File.join(install_dir, 'pik', 'pik.exe')
|
22
|
+
rm(old_exe, :verbose => true) if File.exist?(old_exe)
|
23
|
+
|
24
|
+
puts "\npik is installed"
|
21
25
|
else
|
22
26
|
puts "#{install_dir} is not a directory. pik was not installed."
|
23
27
|
end
|
@@ -29,8 +29,8 @@ Feature: add command
|
|
29
29
|
|
30
30
|
Scenario: add a version with spaces in the path.
|
31
31
|
Given I have an empty config.yml
|
32
|
-
When I run "pik add "C:\temp\more spaces in path\ruby\
|
33
|
-
Then I should see "Adding: 140: jruby 1.4.
|
34
|
-
And I should see "Located at: C:\temp\more spaces in path\ruby\
|
32
|
+
When I run "pik add "C:\temp\more spaces in path\ruby\jruby-140RC2\bin""
|
33
|
+
Then I should see "Adding: 140: jruby 1.4.0RC2 (ruby 1.8.7 patchlevel 174)"
|
34
|
+
And I should see "Located at: C:\temp\more spaces in path\ruby\jruby-140RC2\bin"
|
35
35
|
|
36
36
|
|
data/features/env.rb
CHANGED
@@ -2,19 +2,19 @@ config=<<CONFIG
|
|
2
2
|
---
|
3
3
|
"091: IronRuby 0.9.1.0 on .NET 2.0.0.0":
|
4
4
|
:path: !ruby/object:Pathname
|
5
|
-
path: c:/temp/more spaces in path/ruby/
|
6
|
-
"140: jruby 1.4.
|
5
|
+
path: c:/temp/more spaces in path/ruby/ironruby-091/bin
|
6
|
+
"140: jruby 1.4.0RC2 (ruby 1.8.7 patchlevel 174) (2009-10-21 7e77f32) (Java HotSpot(TM) Client VM 1.6.0_14) [x86-java]":
|
7
7
|
:path: !ruby/object:Pathname
|
8
|
-
path: C:/temp/more spaces in path/ruby/
|
8
|
+
path: C:/temp/more spaces in path/ruby/jruby-140RC2/bin
|
9
9
|
"186: ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]":
|
10
10
|
:path: !ruby/object:Pathname
|
11
11
|
path: c:/ruby/186-p368-mingw32/bin
|
12
12
|
"186: ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]":
|
13
13
|
:path: !ruby/object:Pathname
|
14
|
-
path: c:/temp/more spaces in path/ruby/
|
14
|
+
path: c:/temp/more spaces in path/ruby/ruby-186-p383/bin
|
15
15
|
"191: ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]":
|
16
16
|
:path: !ruby/object:Pathname
|
17
|
-
path: c:/temp/more spaces in path/ruby/
|
17
|
+
path: c:/temp/more spaces in path/ruby/ruby-191-p243/bin
|
18
18
|
---
|
19
19
|
:download_dir: !ruby/object:Pathname
|
20
20
|
path: C:\\temp\\path with spaces\\downloads
|
@@ -10,3 +10,20 @@ Feature: install command
|
|
10
10
|
And I should see " to: C:\temp\path with spaces\downloads"
|
11
11
|
And I should see "** Extracting: C:\temp\path with spaces\downloads"
|
12
12
|
And I should see "** Adding: 191: ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]"
|
13
|
+
|
14
|
+
|
15
|
+
Scenario: install IronRuby
|
16
|
+
When I run "pik in ironruby"
|
17
|
+
Then I should see "** Downloading: http://rubyforge.org/frs/download.php/64504/ironruby-0.9.1.zip"
|
18
|
+
And I should see " to: C:\temp\path with spaces\downloads\ironruby-0.9.1.zip"
|
19
|
+
And I should see "** Extracting: C:\temp\path with spaces\downloads\ironruby-0.9.1.zip"
|
20
|
+
And I should see "** Adding: 091: IronRuby 0.9.1.0 on .NET 2.0.0.0"
|
21
|
+
And I should see " Located at: C:\temp\path with spaces\IronRuby-091\bin"
|
22
|
+
|
23
|
+
Scenario: install Ruby 1.8.6
|
24
|
+
When I run "pik in ruby 1.8"
|
25
|
+
Then I should see "** Downloading: http://rubyforge.org/frs/download.php/62267/ruby-1.8.6-p383-i386-mingw32.7z"
|
26
|
+
And I should see " to: C:\temp\path with spaces\downloads\ruby-1.8.6-p383-i386-mingw32.7z"
|
27
|
+
And I should see "** Extracting: C:\temp\path with spaces\downloads\ruby-1.8.6-p383-i386-mingw32.7z"
|
28
|
+
And I should see "** Adding: 186: ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]"
|
29
|
+
And I should see " Located at: C:\temp\path with spaces\Ruby-186-p383\bin"
|
@@ -15,4 +15,13 @@ Feature: list command
|
|
15
15
|
Scenario: list verbose output
|
16
16
|
When I run "pik list -v"
|
17
17
|
Then I should find "^\d+\: .+\*$"
|
18
|
-
And I should find "path\: C\:[\\\/].+"
|
18
|
+
And I should find "path\: C\:[\\\/].+"
|
19
|
+
|
20
|
+
Scenario: list remote packages
|
21
|
+
When I run "pik list -r"
|
22
|
+
And I should see "IronRuby:"
|
23
|
+
And I should see "0.9.1:"
|
24
|
+
And I should see "JRuby:"
|
25
|
+
And I should see "1.4.0RC2:"
|
26
|
+
Then I should see "Ruby:"
|
27
|
+
And I should see " 1.8.6-p383"
|
@@ -14,7 +14,7 @@ Feature: switch command
|
|
14
14
|
Examples:
|
15
15
|
| version | patterns |
|
16
16
|
| IronRuby 0.9.1.0 on .NET 2.0.0.0 | Ir 91 |
|
17
|
-
| jruby 1.4.
|
17
|
+
| jruby 1.4.0RC2 (ruby 1.8.7 patchlevel 174) | jruby 1.4 |
|
18
18
|
| ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32] | 186 383 |
|
19
19
|
| ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] | 191 p2 |
|
20
20
|
|
@@ -27,7 +27,7 @@ Feature: switch command
|
|
27
27
|
Examples:
|
28
28
|
| version | patterns |
|
29
29
|
| IronRuby 0.9.1.0 on .NET 2.0.0.0 | Ir 91 |
|
30
|
-
| jruby 1.4.
|
30
|
+
| jruby 1.4.0RC2 (ruby 1.8.7 patchlevel 174) | jruby 1.4 |
|
31
31
|
| ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32] | 186 383 |
|
32
32
|
| ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] | 191 p2 |
|
33
33
|
|
@@ -16,3 +16,8 @@ Feature: tag command
|
|
16
16
|
And I run "pik tags mingw run echo."
|
17
17
|
Then I should see "ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]"
|
18
18
|
And I should see "ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]"
|
19
|
+
|
20
|
+
Scenario: run tags with no options
|
21
|
+
When I run "pik tags"
|
22
|
+
Then I should see "The tags command allows you to run a subset of versions."
|
23
|
+
And I should see "C:\>pik tags mingw,jruby gem install my_gem"
|
data/lib/pik.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Pik
|
2
|
-
VERSION = '0.2.
|
2
|
+
VERSION = '0.2.3'
|
3
3
|
end
|
4
4
|
|
5
5
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
@@ -8,6 +8,8 @@ require 'pathname'
|
|
8
8
|
require 'fileutils'
|
9
9
|
require 'rbconfig'
|
10
10
|
|
11
|
+
require 'pik/pik'
|
12
|
+
require 'pik/batch_file'
|
11
13
|
require 'pik/core_ext/pathname'
|
12
14
|
require 'pik/commands'
|
13
15
|
require 'pik/commands/config_file_editor'
|
@@ -27,9 +29,10 @@ require 'pik/commands/default_command'
|
|
27
29
|
require 'pik/commands/implode_command'
|
28
30
|
require 'pik/commands/tag_command'
|
29
31
|
require 'pik/config_file'
|
32
|
+
require 'pik/implementations'
|
30
33
|
require 'pik/windows_env'
|
31
34
|
require 'pik/which'
|
32
|
-
|
35
|
+
|
33
36
|
require 'pik/search_path'
|
34
37
|
|
35
38
|
require 'highline'
|
data/lib/pik/commands/command.rb
CHANGED
@@ -83,7 +83,7 @@ module Pik
|
|
83
83
|
@config = config_ || ConfigFile.new
|
84
84
|
@hl = HighLine.new
|
85
85
|
add_sigint_handler
|
86
|
-
options.program_name = "#{
|
86
|
+
options.program_name = "#{PIK_BATCH.basename('.*')} #{self.class.names.join('|')}"
|
87
87
|
command_options
|
88
88
|
parse_options
|
89
89
|
create(PIK_HOME) unless PIK_HOME.exist?
|
@@ -5,56 +5,24 @@ require 'pik/contrib/progressbar'
|
|
5
5
|
module Pik
|
6
6
|
|
7
7
|
class Install < Command
|
8
|
-
|
8
|
+
|
9
9
|
aka :in
|
10
10
|
it "Downloads and installs different ruby versions."
|
11
11
|
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
'1.9.1-p243' =>
|
18
|
-
'http://rubyforge.org/frs/download.php/62269/ruby-1.9.1-p243-i386-mingw32.7z'
|
19
|
-
},
|
20
|
-
'ironruby' => {
|
21
|
-
'0.9.1' =>
|
22
|
-
'http://rubyforge.org/frs/download.php/64504/ironruby-0.9.1.zip',
|
23
|
-
'0.9.0' =>
|
24
|
-
'http://rubyforge.org/frs/download.php/61382/ironruby-0.9.0.zip'
|
25
|
-
},
|
26
|
-
'jruby' => {
|
27
|
-
'1.4.0RC1' =>
|
28
|
-
'http://dist.codehaus.org/jruby/1.4.0RC1/jruby-bin-1.4.0RC1.zip'
|
29
|
-
}
|
30
|
-
}
|
12
|
+
def initialize(args=ARGV, config_=nil)
|
13
|
+
super
|
14
|
+
@download_dir = config.global[:download_dir] || PIK_HOME + 'downloads'
|
15
|
+
@install_root = config.global[:install_dir] || PIK_BATCH.dirname + 'pik'
|
16
|
+
FileUtils.mkdir_p @download_dir.to_s
|
31
17
|
end
|
32
18
|
|
33
19
|
def execute
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
if versions[version]
|
39
|
-
target += version
|
40
|
-
version = versions[version]
|
41
|
-
@args.each{ |i| version = version.select{|k,v| k =~ Regexp.new(Regexp.escape(i)) } }
|
42
|
-
t, version = most_recent(version)
|
43
|
-
target += "_#{t}"
|
44
|
-
elsif URI.parse(version.to_s) === URI::HTTP
|
45
|
-
version = URI.parse(version.to_s)
|
46
|
-
target = @args.shift
|
47
|
-
else
|
48
|
-
raise VersionUnknown
|
49
|
-
end
|
50
|
-
install_root = config.global[:install_dir] || PIK_BATCH.dirname + 'pik'
|
51
|
-
target = install_root + target.gsub('.','')
|
52
|
-
FileUtils.mkdir_p target
|
53
|
-
file = download(version)
|
20
|
+
implementation = Implementations[@args.shift]
|
21
|
+
target, package = implementation.find(*@args)
|
22
|
+
target = @install_root + "#{implementation.subclass}-#{target.gsub('.','')}"
|
23
|
+
file = download(package)
|
54
24
|
extract(target, file)
|
55
25
|
add( Pathname(target) + 'bin' )
|
56
|
-
rescue VersionUnknown
|
57
|
-
puts 'unknown'
|
58
26
|
end
|
59
27
|
|
60
28
|
def command_options
|
@@ -77,20 +45,17 @@ SEP
|
|
77
45
|
options.separator sep
|
78
46
|
end
|
79
47
|
|
80
|
-
def
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
def download(version, download_dir=@download_dir)
|
85
|
-
target = download_dir + version.split('/').last
|
86
|
-
puts "** Downloading: #{version}\n to: #{target.windows}\n\n"
|
87
|
-
URI.download(version,target.to_s, {:progress => true})
|
48
|
+
def download(package, download_dir=@download_dir)
|
49
|
+
target = download_dir + package. split('/').last
|
50
|
+
puts "** Downloading: #{package} \n to: #{target.windows}\n\n"
|
51
|
+
URI.download(package, target.to_s, {:progress => true})
|
88
52
|
puts
|
89
53
|
return target
|
90
54
|
end
|
91
55
|
|
92
56
|
def extract(target, file)
|
93
57
|
if Which::SevenZip.exe
|
58
|
+
FileUtils.mkdir_p target
|
94
59
|
extract_(file, target)
|
95
60
|
else
|
96
61
|
file = download_seven_zip
|