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
@@ -0,0 +1,157 @@
|
|
1
|
+
describe Pik::Implementations do
|
2
|
+
|
3
|
+
describe 'ruby' do
|
4
|
+
it 'should return a Implementations::Ruby object' do
|
5
|
+
Pik::Implementations.ruby.should be_an(Pik::Implementations::Ruby)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'jruby' do
|
10
|
+
it 'should return a Implementations::JRuby object' do
|
11
|
+
Pik::Implementations.jruby.should be_an(Pik::Implementations::JRuby)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'ironruby' do
|
16
|
+
it 'should return a Implementations::IronRuby object' do
|
17
|
+
Pik::Implementations.ironruby.should be_an(Pik::Implementations::IronRuby)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '[]' do
|
22
|
+
it 'should return the given implementation object.' do
|
23
|
+
Pik::Implementations['ironruby'].should be_an(Pik::Implementations::IronRuby)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should raise an exception if the implementation isn't recognized" do
|
27
|
+
err = lambda { Pik::Implementations['unicornruby'] }
|
28
|
+
err.should raise_error(StandardError, "Pik isn't aware of an implementation called 'unicornruby' for Windows.")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'list' do
|
33
|
+
|
34
|
+
it "should return a hash with containing each implemnatation's version hash" do
|
35
|
+
list = Pik::Implementations.list
|
36
|
+
list.should be_a(Hash)
|
37
|
+
list.should include('Ruby')
|
38
|
+
list.should include('JRuby')
|
39
|
+
list.should include('IronRuby')
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
describe Pik::Implementations::Ruby do
|
47
|
+
before(:each) do
|
48
|
+
# ruby
|
49
|
+
ruby = mock('URI')
|
50
|
+
URI.should_receive(:parse).with('http://rubyforge.org/frs/?group_id=167').any_number_of_times.and_return(ruby)
|
51
|
+
@ruby_htm = File.read('spec/html/ruby.htm')
|
52
|
+
ruby.should_receive(:read).any_number_of_times.and_return(@ruby_htm)
|
53
|
+
|
54
|
+
@ruby = Pik::Implementations::Ruby.new
|
55
|
+
end
|
56
|
+
|
57
|
+
describe 'read' do
|
58
|
+
|
59
|
+
it "should return HTML from the Implementation's page" do
|
60
|
+
@ruby.read.should == @ruby_htm
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'versions' do
|
66
|
+
|
67
|
+
it "should return a hash contain each package" do
|
68
|
+
versions = @ruby.versions
|
69
|
+
versions.should be_a(Hash)
|
70
|
+
versions.should include('1.8.6-p383')
|
71
|
+
versions.should include('1.9.1-p243')
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
describe 'find' do
|
77
|
+
|
78
|
+
it 'should find the most recent version if no argument is given' do
|
79
|
+
v = '1.9.1-p243'
|
80
|
+
u = "http://rubyforge.org/frs/download.php/62269/ruby-1.9.1-p243-i386-mingw32.7z"
|
81
|
+
@ruby.find.should eql( [v, u] )
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should find a specific version if arguments are given' do
|
85
|
+
v = '1.8.6-p383'
|
86
|
+
u = "http://rubyforge.org/frs/download.php/62267/ruby-1.8.6-p383-i386-mingw32.7z"
|
87
|
+
@ruby.find('1.8').should eql( [v, u] )
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
describe Pik::Implementations::JRuby do
|
95
|
+
before(:each) do
|
96
|
+
# jruby
|
97
|
+
jruby = mock('URI')
|
98
|
+
URI.should_receive(:parse).with("http://www.jruby.org/download").any_number_of_times.and_return(jruby)
|
99
|
+
@jruby_htm = File.read('spec/html/jruby.htm')
|
100
|
+
jruby.should_receive(:read).any_number_of_times.and_return(@jruby_htm)
|
101
|
+
|
102
|
+
@jruby = Pik::Implementations::JRuby.new
|
103
|
+
end
|
104
|
+
|
105
|
+
describe 'read' do
|
106
|
+
|
107
|
+
it "should return HTML from the Implementation's page" do
|
108
|
+
@jruby.read.should == @jruby_htm
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
describe 'versions' do
|
114
|
+
|
115
|
+
it "should return a hash contain each package" do
|
116
|
+
versions = @jruby.versions
|
117
|
+
versions.should be_a(Hash)
|
118
|
+
versions.should include('1.3.0')
|
119
|
+
versions.should include('1.4.0RC2')
|
120
|
+
versions['1.4.0RC2'].should eql( "http://jruby.kenai.com/downloads/1.4.0RC2/jruby-bin-1.4.0RC2.zip" )
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
describe Pik::Implementations::IronRuby do
|
128
|
+
before(:each) do
|
129
|
+
# ironruby
|
130
|
+
ironruby = mock('URI')
|
131
|
+
URI.should_receive(:parse).with('http://rubyforge.org/frs/?group_id=4359').any_number_of_times.and_return(ironruby)
|
132
|
+
@ironruby_htm = File.read('spec/html/ironruby.htm')
|
133
|
+
ironruby.should_receive(:read).any_number_of_times.and_return(@ironruby_htm)
|
134
|
+
|
135
|
+
@ironruby = Pik::Implementations::IronRuby.new
|
136
|
+
end
|
137
|
+
|
138
|
+
describe 'read' do
|
139
|
+
|
140
|
+
it "should return HTML from the Implementation's page" do
|
141
|
+
@ironruby.read.should == @ironruby_htm
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
describe 'versions' do
|
147
|
+
|
148
|
+
it "should return a hash contain each package" do
|
149
|
+
versions = @ironruby.versions
|
150
|
+
versions.should be_a(Hash)
|
151
|
+
versions.should include('0.3.0')
|
152
|
+
versions.should include('0.9.1')
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
data/spec/list_command_spec.rb
CHANGED
@@ -8,21 +8,11 @@ describe Pik::List do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
describe 'execute' do
|
11
|
-
it "should show config output" do
|
12
|
-
cmd = `#{@cmd} list`
|
13
|
-
cmd.should match(/186: ruby 1\.8\.6 \(2009\-03\-31 patchlevel 368\)/)
|
14
|
-
end
|
15
11
|
|
16
12
|
it "should have an alias of ls" do
|
17
13
|
Pik::List.names.should include(:ls)
|
18
14
|
end
|
19
15
|
|
20
|
-
it "should show current ruby version with an '*'" do
|
21
|
-
version = `ruby -v`.strip
|
22
|
-
cmd = `#{@cmd} list`
|
23
|
-
cmd.should match(/#{Regexp.escape(version)} \*/)
|
24
|
-
end
|
25
|
-
|
26
16
|
it "should have a verbose options" do
|
27
17
|
@ls = Pik::List.new(['-v'])
|
28
18
|
@ls.verbose.should be_true
|
data/spec/search_path_spec.rb
CHANGED
@@ -48,9 +48,10 @@ describe SearchPath do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
describe '#add' do
|
51
|
-
it "should add an element to the
|
51
|
+
it "should add an element to the beginning" do
|
52
52
|
path = 'C:/ruby/191/bin'
|
53
|
-
new_path = 'C:\
|
53
|
+
new_path = 'C:\ruby\191\bin;'
|
54
|
+
new_path << 'C:\Program Files\Common Files\Shoes\0.r1134\..;'
|
54
55
|
new_path << 'C:\bin;'
|
55
56
|
new_path << 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;'
|
56
57
|
new_path << 'C:\Program Files\Common Files\Shoes\0.r395\..;'
|
@@ -64,8 +65,8 @@ describe SearchPath do
|
|
64
65
|
new_path << 'C:\Program Files\jEdit;'
|
65
66
|
new_path << 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\;'
|
66
67
|
new_path << 'C:\ruby\186-mswin32\bin;'
|
67
|
-
new_path << 'C:\Program Files\Putty
|
68
|
-
|
68
|
+
new_path << 'C:\Program Files\Putty'
|
69
|
+
|
69
70
|
@path.add(path)
|
70
71
|
@path.join.should == new_path
|
71
72
|
end
|
@@ -94,9 +95,10 @@ describe SearchPath do
|
|
94
95
|
@path.join.should == new_path
|
95
96
|
end
|
96
97
|
|
97
|
-
it "should add an element to the
|
98
|
+
it "should add an element to the beginning if it doesn't already exist" do
|
98
99
|
path = 'C:/xray/yankee/zebra'
|
99
|
-
new_path = 'C:\
|
100
|
+
new_path = 'C:\xray\yankee\zebra;'
|
101
|
+
new_path << 'C:\Program Files\Common Files\Shoes\0.r1134\..;'
|
100
102
|
new_path << 'C:\bin;'
|
101
103
|
new_path << 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;'
|
102
104
|
new_path << 'C:\Program Files\Common Files\Shoes\0.r395\..;'
|
@@ -110,8 +112,8 @@ describe SearchPath do
|
|
110
112
|
new_path << 'C:\Program Files\jEdit;'
|
111
113
|
new_path << 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\;'
|
112
114
|
new_path << 'C:\ruby\186-mswin32\bin;'
|
113
|
-
new_path << 'C:\Program Files\Putty
|
114
|
-
|
115
|
+
new_path << 'C:\Program Files\Putty'
|
116
|
+
|
115
117
|
@path.replace_or_add('C:/xray/yankee/alpha', path)
|
116
118
|
@path.join.should == new_path
|
117
119
|
end
|
data/tools/pik.bat
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
@ECHO OFF
|
2
|
-
"%~dpn0\%~
|
2
|
+
"%~dpn0\%~n0_runner.exe" "%~dpf0" %*
|
Binary file
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# Generated by mkexy
|
2
|
-
# on 2009-10-26 13:
|
2
|
+
# on 2009-10-26 13:52
|
3
3
|
|
4
4
|
general:
|
5
|
-
startup:
|
5
|
+
startup: pik_runner
|
6
6
|
core: cui
|
7
7
|
kcode: none
|
8
8
|
|
9
9
|
file:
|
10
|
-
|
10
|
+
pik_runner:
|
11
11
|
stringio.so:
|
12
12
|
file: c:/ruby/186-p368-mingw32/lib/ruby/1.8/i386-mingw32/stringio.so
|
13
13
|
type: extension-library
|
@@ -49,6 +49,10 @@ file:
|
|
49
49
|
file: c:/ruby/186-p368-mingw32/lib/ruby/1.8/fileutils.rb
|
50
50
|
rbconfig.rb:
|
51
51
|
file: c:/ruby/186-p368-mingw32/lib/ruby/1.8/i386-mingw32/rbconfig.rb
|
52
|
+
pik/pik.rb:
|
53
|
+
file: ./../../lib/pik/pik.rb
|
54
|
+
pik/batch_file.rb:
|
55
|
+
file: ./../../lib/pik/batch_file.rb
|
52
56
|
pik/core_ext/pathname.rb:
|
53
57
|
file: ./../../lib/pik/core_ext/pathname.rb
|
54
58
|
pik/commands.rb:
|
@@ -166,14 +170,20 @@ file:
|
|
166
170
|
file: ./../../lib/pik/commands/tag_command.rb
|
167
171
|
pik/config_file.rb:
|
168
172
|
file: ./../../lib/pik/config_file.rb
|
173
|
+
parsedate.rb:
|
174
|
+
file: c:/ruby/186-p368-mingw32/lib/ruby/1.8/parsedate.rb
|
175
|
+
time.rb:
|
176
|
+
file: c:/ruby/186-p368-mingw32/lib/ruby/1.8/time.rb
|
177
|
+
open-uri.rb:
|
178
|
+
file: c:/ruby/186-p368-mingw32/lib/ruby/1.8/open-uri.rb
|
179
|
+
pik/implementations.rb:
|
180
|
+
file: ./../../lib/pik/implementations.rb
|
169
181
|
win32/registry.rb:
|
170
182
|
file: c:/ruby/186-p368-mingw32/lib/ruby/1.8/win32/registry.rb
|
171
183
|
pik/windows_env.rb:
|
172
184
|
file: ./../../lib/pik/windows_env.rb
|
173
185
|
pik/which.rb:
|
174
186
|
file: ./../../lib/pik/which.rb
|
175
|
-
pik/batch_file.rb:
|
176
|
-
file: ./../../lib/pik/batch_file.rb
|
177
187
|
pik/search_path.rb:
|
178
188
|
file: ./../../lib/pik/search_path.rb
|
179
189
|
strscan.so:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pik
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gordon Thiesfeld
|
@@ -109,8 +109,9 @@ files:
|
|
109
109
|
- lib/pik/contrib/zip/zipfilesystem.rb
|
110
110
|
- lib/pik/contrib/zip/ziprequire.rb
|
111
111
|
- lib/pik/core_ext/pathname.rb
|
112
|
+
- lib/pik/implementations.rb
|
112
113
|
- lib/pik/options.rb
|
113
|
-
- lib/pik/
|
114
|
+
- lib/pik/pik.rb
|
114
115
|
- lib/pik/search_path.rb
|
115
116
|
- lib/pik/which.rb
|
116
117
|
- lib/pik/windows_env.rb
|
@@ -121,6 +122,10 @@ files:
|
|
121
122
|
- spec/default_command_spec.rb
|
122
123
|
- spec/gemsync_command_spec.rb
|
123
124
|
- spec/help_command_spec.rb
|
125
|
+
- spec/html/ironruby.htm
|
126
|
+
- spec/html/jruby.htm
|
127
|
+
- spec/html/ruby.htm
|
128
|
+
- spec/implementations_spec.rb
|
124
129
|
- spec/list_command_spec.rb
|
125
130
|
- spec/pathname_spec.rb
|
126
131
|
- spec/remove_command_spec.rb
|
@@ -130,9 +135,9 @@ files:
|
|
130
135
|
- spec/switch_command_spec.rb
|
131
136
|
- spec/which_spec.rb
|
132
137
|
- tools/pik.bat
|
133
|
-
- tools/pik/
|
134
|
-
- tools/pik/
|
135
|
-
- tools/pik/
|
138
|
+
- tools/pik/pik_runner
|
139
|
+
- tools/pik/pik_runner.exe
|
140
|
+
- tools/pik/pik_runner.exy
|
136
141
|
has_rdoc: true
|
137
142
|
homepage: http://github.com/vertiginous/pik
|
138
143
|
licenses: []
|
@@ -141,20 +146,31 @@ post_install_message: |+
|
|
141
146
|
|
142
147
|
----------------------------------------------------------------------------
|
143
148
|
|
144
|
-
|
145
|
-
|
149
|
+
* If you're upgrading from a version <= 0.1.1, you'll want to delete the pik.bat file
|
150
|
+
from all of your ruby versions. Gem uninstall should do the trick.
|
146
151
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
3. You need to install pik to a location that's in your path, but someplace other than your ruby\bin dir
|
152
|
+
* Install pik to a location that's in your path, but someplace other than your ruby\bin dir
|
153
|
+
If you're upgrading from a more recent version, pik_install will overwrite the older files as needed.
|
154
|
+
|
155
|
+
>path
|
156
|
+
PATH=C:\tools\;C:\ruby\186-p368-mingw32\bin;C:\WINDOWS\system32;C:\WINDOWS
|
154
157
|
|
155
|
-
pik_install C:\
|
158
|
+
>pik_install C:\tools
|
156
159
|
|
157
|
-
|
160
|
+
* If this is a first-time install, add all the versions of ruby that you want to use with pik
|
161
|
+
|
162
|
+
>pik add
|
163
|
+
Adding: 186: ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]
|
164
|
+
Located at: c:/ruby/186-p368-mingw32/bin
|
165
|
+
|
166
|
+
>pik add C:\ruby\IronRuby-091\bin
|
167
|
+
Adding: 091: IronRuby 0.9.1.0 on .NET 2.0.0.0
|
168
|
+
Located at: C:/ruby/IronRuby-091/bin
|
169
|
+
|
170
|
+
>pik add C:\ruby\jruby-1.4.0RC1\bin
|
171
|
+
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]
|
172
|
+
Located at: C:/ruby/jruby-1.4.0RC1/bin
|
173
|
+
|
158
174
|
|
159
175
|
----------------------------------------------------------------------------
|
160
176
|
|
data/lib/pik/runner.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Pik
|
2
|
-
|
3
|
-
class Runner
|
4
|
-
|
5
|
-
def add_gem_home(*patterns)
|
6
|
-
to_add = get_version
|
7
|
-
new_dir = @options[:default] ? Gem.default_path.first : @hl.ask("Enter a path to a GEM_HOME dir")
|
8
|
-
if @hl.agree("Add a GEM_HOME and GEM_PATH for '#{to_add}'? [Yn] ")
|
9
|
-
@config[to_add][:gem_home] = new_dir
|
10
|
-
@hl.say("GEM_HOME and GEM_PATH added for: #{to_add} ")
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|