pik 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,11 @@
1
+ === 0.2.2 / 2009-10-20
2
+
3
+ * Pik::Command#get_version now handles paths with spaces. Thanks to Dominic Sisneros and Vassilis Rizopoulos
4
+ * All Cucumber scenarios are run against 'C:\temp\path with spaces' instead of 'C:\temp'
5
+
1
6
  === 0.2.1 / 2009-10-19
2
7
 
3
- * bugfix - path to pik could have spaces.
8
+ * bugfix - path to pik could have spaces - thanks, Dominic Sisneros
4
9
  * update install instructions
5
10
 
6
11
  === 0.2.0 / 2009-10-18
@@ -4,7 +4,6 @@ README.rdoc
4
4
  Rakefile
5
5
  bin/pik_install
6
6
  features/add_command.feature
7
- features/checkup_command.feature
8
7
  features/config_command.feature
9
8
  features/default_command.feature
10
9
  features/env.rb
@@ -1,7 +1,10 @@
1
1
  = pik
2
2
 
3
3
  http://github.com/vertiginous/pik
4
- http://rubyforge.org/projects/pik/
4
+
5
+ Bugs/Feature: http://github.com/vertiginous/pik/issues
6
+
7
+ Rubyforge: http://rubyforge.org/projects/pik/
5
8
 
6
9
  Gordon Thiesfeld
7
10
 
data/Rakefile CHANGED
@@ -1,6 +1,38 @@
1
1
  # -*- ruby -*-
2
2
 
3
3
  require 'rubygems'
4
+
5
+ file 'tools/pik/pik.exy' do
6
+ Dir.chdir 'tools/pik' do
7
+ sh('ruby -rexerb/mkexy pik')
8
+ end
9
+ end
10
+
11
+ file 'tools/pik/pik.exe', :needs => 'tools/pik/pik.exy' do
12
+ Dir.chdir 'tools/pik' do
13
+ sh('ruby -S exerb pik.exy')
14
+ end
15
+ end
16
+
17
+ task :build, :needs => 'tools/pik/pik.exe'
18
+
19
+ task :install, :needs => :build do
20
+ sh('ruby bin/pik_install C:\\bin')
21
+ end
22
+
23
+ task :clobber_exe do
24
+ rm_rf 'tools/pik/pik.exe'
25
+ end
26
+
27
+ task :clobber_exy, :needs => :clobber_exe do
28
+ rm_rf 'tools/pik/pik.exy'
29
+ end
30
+
31
+ task :rebuild, :needs => [:clobber_exy, :build]
32
+ task :reinstall, :needs => [:clobber_exy, :install]
33
+
34
+ task :package => :rebuild
35
+
4
36
  require 'hoe'
5
37
 
6
38
  $LOAD_PATH.unshift('lib')
@@ -27,7 +59,7 @@ Hoe.spec('pik') do
27
59
 
28
60
  gem install pik
29
61
 
30
- 3. You need to install pik to a location that's in your path, but someplace other than your ruby\bin dir
62
+ 3. You need to install pik to a location that's in your path, but someplace other than your ruby\\bin dir
31
63
 
32
64
  pik_install C:\\some\\other\\path
33
65
 
@@ -39,40 +71,11 @@ PIM
39
71
 
40
72
  end
41
73
 
42
- file 'tools/pik/pik.exy' do
43
- Dir.chdir 'tools/pik' do
44
- sh('ruby -rexerb/mkexy pik')
45
- end
46
- end
47
-
48
- file 'tools/pik/pik.exe', :needs => 'tools/pik/pik.exy' do
49
- Dir.chdir 'tools/pik' do
50
- sh('ruby -S exerb pik.exy')
51
- end
52
- end
53
-
54
- task :build, :needs => 'tools/pik/pik.exe'
55
-
56
- task :install, :needs => :build do
57
- sh('ruby bin/pik_install C:\\bin')
58
- end
59
-
60
- task :clobber_exe do
61
- rm_rf 'tools/pik/pik.exe'
62
- end
63
-
64
- task :clobber_exy, :needs => :clobber_exe do
65
- rm_rf 'tools/pik/pik.exy'
66
- end
67
-
68
- task :rebuild, :needs => [:clobber_exy, :build]
69
- task :reinstall, :needs => [:clobber_exy, :install]
70
-
71
74
  require 'cucumber'
72
75
  require 'cucumber/rake/task'
73
76
 
74
77
  Cucumber::Rake::Task.new(:features) do |t|
75
- t.cucumber_opts = "features --format pretty"
78
+ t.cucumber_opts = "features -f html -o ../pik_cucumber.html -f progress"
76
79
  end
77
80
 
78
81
  # vim: syntax=Ruby
@@ -26,3 +26,11 @@ Feature: add command
26
26
  Scenario: add a nonexistent version
27
27
  When I run "pik add C:\ruby\nonexistent_ruby\bin"
28
28
  Then I should see "Couldn't find a Ruby version at C:\ruby\nonexistent_ruby\bin"
29
+
30
+ Scenario: add a version with spaces in the path.
31
+ Given I have an empty config.yml
32
+ When I run "pik add "C:\temp\more spaces in path\ruby\jruby_140RC1\bin""
33
+ Then I should see "Adding: 140: jruby 1.4.0RC1 (ruby 1.8.7 patchlevel 174)"
34
+ And I should see "Located at: C:\temp\more spaces in path\ruby\jruby_140RC1\bin"
35
+
36
+
@@ -1,48 +1,41 @@
1
1
  config=<<CONFIG
2
2
  ---
3
- "090: IronRuby 0.9.0.0 on .NET 2.0.0.0":
4
- :gem_home: !ruby/object:Pathname
5
- path: c:\\ruby\\ironruby-0.9.0\\lib\\ironruby\\gems\\1.8
6
- :path: !ruby/object:Pathname
7
- path: C:/ruby/IronRuby-0.9.0/bin
8
3
  "091: IronRuby 0.9.1.0 on .NET 2.0.0.0":
9
- :gem_home: !ruby/object:Pathname
10
- path: c:\\temp\\ruby\\ironruby_091\\lib\\ironruby\\gems\\1.8
11
- :path: !ruby/object:Pathname
12
- path: c:/temp/ruby/ironruby_091/bin
13
- "131: jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) Client VM 1.6.0_14) [x86-java]":
14
4
  :path: !ruby/object:Pathname
15
- path: C:/ruby/jruby-131/bin
5
+ path: c:/temp/more spaces in path/ruby/ironruby_091/bin
16
6
  "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]":
17
7
  :path: !ruby/object:Pathname
18
- path: c:/temp/ruby/jruby_140RC1/bin
19
- "185: ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32]":
20
- :path: !ruby/object:Pathname
21
- path: C:/ruby/185-p012-mswin32/bin
22
- "186: ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]":
23
- :path: !ruby/object:Pathname
24
- path: C:/ruby/186-p287-mswin32/bin
8
+ path: C:/temp/more spaces in path/ruby/jruby_140RC1/bin
25
9
  "186: ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]":
26
10
  :path: !ruby/object:Pathname
27
11
  path: c:/ruby/186-p368-mingw32/bin
28
- "191: ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]":
12
+ "186: ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]":
29
13
  :path: !ruby/object:Pathname
30
- path: C:/ruby/191-p129-mingw32/bin
14
+ path: c:/temp/more spaces in path/ruby/ruby_186-p383/bin
31
15
  "191: ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]":
32
16
  :path: !ruby/object:Pathname
33
- path: C:/ruby/191-p243-mingw32/bin
17
+ path: c:/temp/more spaces in path/ruby/ruby_191-p243/bin
34
18
  ---
35
19
  :download_dir: !ruby/object:Pathname
36
- path: c:\\temp\\.pik\\downloads
20
+ path: C:\\temp\\path with spaces\\downloads
37
21
  :install_dir: !ruby/object:Pathname
38
- path: c:\\temp\\ruby
22
+ path: C:\\temp\\path with spaces
39
23
  CONFIG
40
24
 
25
+ require 'yaml'
26
+ require 'pathname'
27
+ require 'fileutils'
28
+ require 'lib/pik'
29
+
41
30
  REAL_PATH = ENV['PATH']
42
- FAKE_PIK_HOME = 'c:/temp/.pik'
43
- ENV['HOME'] = "C:\\temp"
31
+
32
+ ENV['HOME'] = "C:\\temp\\path with spaces"
44
33
  ENV['JAVA_HOME'] = "C:\\Program Files\\Java\\jre6"
45
34
 
35
+ PIK_LOG = 'log\\output.log'
36
+ TEST_PIK_HOME = Pathname.new( ENV['HOME'] || ENV['USERPROFILE'] ) + '.pik'
37
+ FAKE_PIK_HOME = 'c:/temp/path with spaces/.pik'
38
+
46
39
  Before do
47
40
  ENV['PATH'] = REAL_PATH
48
41
  FileUtils.rm_rf FAKE_PIK_HOME
@@ -6,7 +6,7 @@ Feature: implode command
6
6
 
7
7
 
8
8
  Scenario: pik implode
9
- Given I have a directory "C:/temp/.pik"
9
+ Given I have a directory "C:/temp/path with spaces/.pik"
10
10
  And it contains a config.yml
11
11
  When I run "pik implode -f"
12
12
  Then the directory should be deleted
@@ -7,7 +7,6 @@ Feature: install command
7
7
  Scenario: install from the intarwebs
8
8
  When I run "pik install ruby"
9
9
  Then I should see "** Downloading: http://rubyforge.org/frs/download.php/62269/ruby-1.9.1-p243-i386-mingw32.7z"
10
- And I should see " to: c:\temp\.pik"
11
- And I should see "** Extracting: c:\temp\.pik\downloads"
12
- And I should see "** Adding: "
13
-
10
+ And I should see " to: C:\temp\path with spaces\downloads"
11
+ And I should see "** Extracting: C:\temp\path with spaces\downloads"
12
+ And I should see "** Adding: 191: ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]"
@@ -6,13 +6,13 @@ Feature: remove command
6
6
 
7
7
  Scenario: remove a version from the config
8
8
  Given I have already added "ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]"
9
- When I run "pik remove 186 min -f"
9
+ When I run "pik remove 186 383 -f"
10
10
  Then I should see "removed"
11
11
  And the version should be removed.
12
12
 
13
13
  Scenario: remove a version from the config and the filesystem
14
- Given I have already added "ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]"
15
- When I run "pik remove 186 min -f "
16
- Then I should see "removed"
17
- And the version should be removed.
14
+ # Given I have already added "ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]"
15
+ # When I run "pik remove 186 min -f "
16
+ # Then I should see "removed"
17
+ # And the version should be removed.
18
18
 
@@ -6,17 +6,17 @@ Feature: run command
6
6
 
7
7
  Scenario: run code
8
8
  When I run "pik run "path""
9
- Then I should find "PATH=" 9 times
9
+ Then I should find "PATH=" 5 times
10
10
  And I should see each version's path listed
11
11
  And I should see each version listed.
12
12
 
13
13
  Scenario: ruby command
14
14
  When I run "pik ruby -e "puts 'hello world!'" "
15
- Then I should find "hello world!" 9 times
15
+ Then I should find "hello world!" 5 times
16
16
  And I should see each version listed.
17
17
 
18
18
  Scenario: gem command
19
19
  When I run "pik gem -v"
20
- Then I should find "\n\d\.\d\.\d\n" 9 times
20
+ Then I should find "\n\d\.\d\.\d\n" 5 times
21
21
  And I should see each version listed.
22
22
 
@@ -1,14 +1,7 @@
1
- require 'yaml'
2
- require 'pathname'
3
- require 'fileutils'
4
-
5
- PIK_LOG = 'log\\output.log'
6
- PIK_HOME = Pathname.new( ENV['HOME'] || ENV['USERPROFILE'] ) + '.pik'
7
-
8
1
  Given /^I have.+added "(.+)"/ do |version|
9
2
  @version = version
10
3
  @version_reg = Regexp.new(Regexp.escape(version), Regexp::IGNORECASE)
11
- @config_file = PIK_HOME + 'config.yml'
4
+ @config_file = TEST_PIK_HOME + 'config.yml'
12
5
  @original_config = YAML.load(File.read(@config_file))
13
6
  @ver = @original_config.keys.grep(@version_reg){|k| @original_config[k] }
14
7
  @ver.size.should eql(1)
@@ -38,12 +31,12 @@ Given /^it contains a config\.yml/ do
38
31
  end
39
32
 
40
33
  Given /^I have no \.pik directory/ do
41
- FileUtils.rm_rf PIK_HOME
42
- PIK_HOME.should_not exist
34
+ FileUtils.rm_rf TEST_PIK_HOME
35
+ TEST_PIK_HOME.should_not exist
43
36
  end
44
37
 
45
38
  Given /^I have an empty config\.yml/ do
46
- File.open(PIK_HOME + 'config.yml','w'){|f| }
39
+ File.open(TEST_PIK_HOME + 'config.yml','w'){|f| }
47
40
  end
48
41
 
49
42
  Given /^I have not installed pik to (.+)$/ do |path|
@@ -61,7 +54,7 @@ When /^I run "pik_install (.+)"$/ do |args|
61
54
  end
62
55
 
63
56
  When /^I run "pik (.+?)" and "pik (.+)",$/ do |args1, args2|
64
- %x[tools\\pik.bat #{args1} > #{PIK_LOG} 2>&1 && tools\\pik.bat #{args2} > #{PIK_LOG} 2>&1]
57
+ %x[tools\\pik.bat #{args1} > #{PIK_LOG} 2>&1 & tools\\pik.bat #{args2} >> #{PIK_LOG} 2>&1]
65
58
  end
66
59
 
67
60
  When /^I run "pik (.+?)"$/ do |args|
@@ -80,6 +73,12 @@ Then /^I should see "(.*)"$/ do |data|
80
73
  stdout = File.read(PIK_LOG)
81
74
  stdout.should match(Regexp.new(Regexp.escape(data)))
82
75
  end
76
+
77
+
78
+ Then /^I should see the Pik::VERSION$/ do
79
+ stdout = File.read(PIK_LOG)
80
+ stdout.should match(Regexp.new(Regexp.escape(Pik::VERSION)))
81
+ end
83
82
 
84
83
  Then /^I should find "(.*)"$/ do |regexp|
85
84
  stdout = File.read(PIK_LOG)
@@ -107,7 +106,7 @@ end
107
106
 
108
107
  Then /^I should see each version.s path listed$/ do
109
108
  stdout = File.read(PIK_LOG)
110
- config_file = PIK_HOME + 'config.yml'
109
+ config_file = TEST_PIK_HOME + 'config.yml'
111
110
  config = YAML.load(File.read(config_file))
112
111
  config.each{|k,v|
113
112
  path = Regexp.new(Regexp.escape(v[:path].to_s.gsub('/','\\')))
@@ -117,7 +116,7 @@ end
117
116
 
118
117
  Then /^I should see each version listed\.$/ do
119
118
  stdout = File.read(PIK_LOG)
120
- config_file = PIK_HOME + 'config.yml'
119
+ config_file = TEST_PIK_HOME + 'config.yml'
121
120
  config = YAML.load(File.read(config_file))
122
121
  config.each{|k,v|
123
122
  version = Regexp.new(Regexp.escape(k.split(': ')[1..-1].join(': ')))
@@ -136,7 +135,7 @@ Then /^the GEM_HOME might get set\.$/ do
136
135
  end
137
136
 
138
137
  Then /^the directory should be deleted$/ do
139
- Pathname(@dir).should_not exist
138
+ Pathname(TEST_PIK_HOME).should_not exist
140
139
  end
141
140
 
142
141
  Then /^nothing should be added to the config file\.$/ do
@@ -149,7 +148,6 @@ Then /^the version should be removed\.$/ do
149
148
  @current_config.size.should eql(@original_config.size - 1)
150
149
  end
151
150
 
152
-
153
151
  Then /^a gem_home option should be added to the config\.$/ do
154
152
  @ver[0][:gem_home].should be_nil
155
153
  @current_config = YAML.load(File.read(@config_file))
@@ -15,8 +15,7 @@ Feature: switch command
15
15
  | version | patterns |
16
16
  | IronRuby 0.9.1.0 on .NET 2.0.0.0 | Ir 91 |
17
17
  | jruby 1.4.0RC1 (ruby 1.8.7 patchlevel 174) | jruby 1.4 |
18
- | ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] | 186 ms |
19
- | ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32] | 186 mi |
18
+ | ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32] | 186 383 |
20
19
  | ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] | 191 p2 |
21
20
 
22
21
  Scenario Outline: Switching versions with pattern only
@@ -29,7 +28,6 @@ Feature: switch command
29
28
  | version | patterns |
30
29
  | IronRuby 0.9.1.0 on .NET 2.0.0.0 | Ir 91 |
31
30
  | jruby 1.4.0RC1 (ruby 1.8.7 patchlevel 174) | jruby 1.4 |
32
- | ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] | 186 ms |
33
- | ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32] | 186 mi |
31
+ | ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32] | 186 383 |
34
32
  | ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] | 191 p2 |
35
33
 
@@ -11,8 +11,8 @@ Feature: tag command
11
11
  And I should see " - 091: IronRuby 0.9.1.0 on .NET 2.0.0.0"
12
12
 
13
13
  Scenario: run tagged versions
14
- When I run "pik Ir 91" and "pik tag iron",
15
- And I run "pik Ir 90" and "pik tag iron",
16
- And I run "pik tags iron run echo."
17
- Then I should find "IronRuby 0.9.1.0 on .NET 2.0.0.0"
18
- And I should find "IronRuby 0.9.0.0 on .NET 2.0.0.0"
14
+ When I run "pik 191" and "pik tag mingw",
15
+ And I run "pik 186 383" and "pik tag mingw",
16
+ And I run "pik tags mingw run echo."
17
+ Then I should see "ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]"
18
+ And I should see "ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]"
@@ -6,4 +6,5 @@ Feature: display pik version
6
6
 
7
7
  Scenario: Listing versions
8
8
  When I run "pik -V"
9
- Then I should find "^pik \d.\d.\d"
9
+ Then I should see "pik "
10
+ And I should see the Pik::VERSION
data/lib/pik.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Pik
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
4
4
 
5
5
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -118,7 +118,7 @@ module Pik
118
118
 
119
119
  def get_version(path=Which::Ruby.find)
120
120
  cmd = Which::Ruby.exe(path)
121
- ruby_ver = `#{cmd} -v`
121
+ ruby_ver = `"#{cmd}" -v`
122
122
  ruby_ver =~ /ruby (\d\.\d\.\d)/i
123
123
  major = $1.gsub('.','')
124
124
  "#{major}: #{ruby_ver.strip}"
@@ -67,7 +67,7 @@ SEP
67
67
 
68
68
  def echo_ruby_version(path)
69
69
  rb = Which::Ruby.exe(path)
70
- puts `#{rb} -v `
70
+ puts `"#{rb}" -v `
71
71
  end
72
72
 
73
73
  end
Binary file
@@ -1,5 +1,5 @@
1
1
  # Generated by mkexy
2
- # on 2009-10-18 23:27
2
+ # on 2009-10-26 13:54
3
3
 
4
4
  general:
5
5
  startup: pik
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.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gordon Thiesfeld
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-19 00:00:00 -05:00
12
+ date: 2009-10-26 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -63,7 +63,6 @@ files:
63
63
  - Rakefile
64
64
  - bin/pik_install
65
65
  - features/add_command.feature
66
- - features/checkup_command.feature
67
66
  - features/config_command.feature
68
67
  - features/default_command.feature
69
68
  - features/env.rb
@@ -138,13 +137,27 @@ has_rdoc: true
138
137
  homepage: http://github.com/vertiginous/pik
139
138
  licenses: []
140
139
 
141
- post_install_message: "\n\
142
- ----------------------------------------------------------------------------\n\n\
143
- 1. If you've used a version previous to this one, you'll need to uninstall them.\n Don't worry, this will leave your pik config intact.\n \n pik run \"gem uninstall pik\"\n \n\
144
- 2. Install the pik gem\n\n gem install pik\n \n\
145
- 3. You need to install pik to a location that's in your path, but someplace other than your ruby\bin dir\n\n pik_install C:\\some\\other\\path\n \n\
146
- 4. Add all the versions of ruby that you want to use with pik\n\n\
147
- ---------------------------------------------------------------------------- \n\n"
140
+ post_install_message: |+
141
+
142
+ ----------------------------------------------------------------------------
143
+
144
+ 1. If you've used a version previous to this one, you'll need to uninstall them.
145
+ Don't worry, this will leave your pik config intact.
146
+
147
+ pik run "gem uninstall pik"
148
+
149
+ 2. Install the pik gem
150
+
151
+ gem install pik
152
+
153
+ 3. You need to install pik to a location that's in your path, but someplace other than your ruby\bin dir
154
+
155
+ pik_install C:\some\other\path
156
+
157
+ 4. Add all the versions of ruby that you want to use with pik
158
+
159
+ ----------------------------------------------------------------------------
160
+
148
161
  rdoc_options:
149
162
  - --main
150
163
  - README.rdoc
File without changes