pik 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/Manifest.txt +9 -8
- data/README.rdoc +13 -3
- data/Rakefile +35 -14
- data/bin/pik_install +50 -10
- data/features/support/env.rb +2 -2
- data/features/{switch_command.feature → use_command.feature} +3 -3
- data/lib/pik.rb +32 -23
- data/lib/pik/commands/command.rb +5 -15
- data/lib/pik/commands/config_command.rb +0 -1
- data/lib/pik/commands/default_command.rb +4 -4
- data/lib/pik/commands/devkit_command.rb +3 -3
- data/lib/pik/commands/install_command.rb +2 -2
- data/lib/pik/commands/{batch_file_editor.rb → script_file_editor.rb} +10 -29
- data/lib/pik/commands/update_command.rb +2 -2
- data/lib/pik/commands/{switch_command.rb → use_command.rb} +3 -3
- data/lib/pik/core_ext/pathname.rb +6 -2
- data/lib/pik/scripts/bash_file.rb +36 -0
- data/lib/pik/scripts/batch_file.rb +32 -0
- data/lib/pik/scripts/ps_file.rb +33 -0
- data/lib/pik/scripts/script_file.rb +45 -0
- data/lib/pik/search_path.rb +4 -0
- data/spec/batch_file_spec.rb +2 -2
- data/spec/pathname_spec.rb +7 -0
- data/spec/search_path_spec.rb +29 -8
- data/spec/switch_command_spec.rb +10 -10
- data/tools/pik.bat +2 -1
- data/tools/pik.ps1 +3 -0
- data/tools/pik_runner.exe +0 -0
- metadata +18 -33
- data/lib/pik/batch_file.rb +0 -70
- data/lib/pik/pik.rb +0 -10
- data/tools/pik/pik_runner +0 -42
- data/tools/pik/pik_runner.exe +0 -0
- data/tools/pik/pik_runner.exy +0 -296
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
=== 0.2.8 / 2010-06-22
|
2
|
+
** BACKWARD COMPATIBILITY CHANGE
|
3
|
+
pik will now install new rubies to %USERPROFILE%\rubies\, instead of %PIK_BIN%\pik\ this was necessary to all for installation into %PROGRAMFILES% dir. If you'd like to keep the old path, run:
|
4
|
+
>pik config install_dir=C:\path\to\pik
|
5
|
+
**
|
6
|
+
* fixed bug in 'devkit update' - gcc.bat file was writing to/overwriting sh.bat
|
7
|
+
* added support for powershell
|
8
|
+
* added support for Git Bash
|
9
|
+
* it is now possible to install pik to %PROGRAMFILES%
|
1
10
|
|
2
11
|
=== 0.2.7 / 2010-06-15
|
3
12
|
* cleaner list output
|
data/Manifest.txt
CHANGED
@@ -18,15 +18,13 @@ features/run_command.feature
|
|
18
18
|
features/step_definitions/pik_commands.rb
|
19
19
|
features/support/env.rb
|
20
20
|
features/support/proxy.ru
|
21
|
-
features/switch_command.feature
|
22
21
|
features/tag_command.feature
|
23
22
|
features/uninstall_command.feature
|
23
|
+
features/use_command.feature
|
24
24
|
features/version.feature
|
25
25
|
lib/pik.rb
|
26
|
-
lib/pik/batch_file.rb
|
27
26
|
lib/pik/commands.rb
|
28
27
|
lib/pik/commands/add_command.rb
|
29
|
-
lib/pik/commands/batch_file_editor.rb
|
30
28
|
lib/pik/commands/command.rb
|
31
29
|
lib/pik/commands/config_command.rb
|
32
30
|
lib/pik/commands/config_file_editor.rb
|
@@ -40,10 +38,11 @@ lib/pik/commands/install_command.rb
|
|
40
38
|
lib/pik/commands/list_command.rb
|
41
39
|
lib/pik/commands/remove_command.rb
|
42
40
|
lib/pik/commands/run_command.rb
|
43
|
-
lib/pik/commands/
|
41
|
+
lib/pik/commands/script_file_editor.rb
|
44
42
|
lib/pik/commands/tag_command.rb
|
45
43
|
lib/pik/commands/uninstall_command.rb
|
46
44
|
lib/pik/commands/update_command.rb
|
45
|
+
lib/pik/commands/use_command.rb
|
47
46
|
lib/pik/config_file.rb
|
48
47
|
lib/pik/contrib/progressbar.rb
|
49
48
|
lib/pik/contrib/unzip.rb
|
@@ -57,7 +56,10 @@ lib/pik/contrib/zip/ziprequire.rb
|
|
57
56
|
lib/pik/core_ext/pathname.rb
|
58
57
|
lib/pik/implementations.rb
|
59
58
|
lib/pik/options.rb
|
60
|
-
lib/pik/
|
59
|
+
lib/pik/scripts/bash_file.rb
|
60
|
+
lib/pik/scripts/batch_file.rb
|
61
|
+
lib/pik/scripts/ps_file.rb
|
62
|
+
lib/pik/scripts/script_file.rb
|
61
63
|
lib/pik/search_path.rb
|
62
64
|
lib/pik/version_parser.rb
|
63
65
|
lib/pik/which.rb
|
@@ -83,6 +85,5 @@ spec/switch_command_spec.rb
|
|
83
85
|
spec/version_parser_spec.rb
|
84
86
|
spec/which_spec.rb
|
85
87
|
tools/pik.bat
|
86
|
-
tools/pik
|
87
|
-
tools/
|
88
|
-
tools/pik/pik_runner.exy
|
88
|
+
tools/pik.ps1
|
89
|
+
tools/pik_runner.exe
|
data/README.rdoc
CHANGED
@@ -12,7 +12,7 @@ Gordon Thiesfeld
|
|
12
12
|
|
13
13
|
== DESCRIPTION:
|
14
14
|
|
15
|
-
Pik is a tool to manage multiple versions of ruby on Windows.
|
15
|
+
Pik is a tool to manage multiple versions of ruby on Windows. It can be used from the Windows command line (cmd.exe), Windows PowerShell, or Git Bash. I have yet to test on cygwin.
|
16
16
|
|
17
17
|
>pik help commands
|
18
18
|
|
@@ -42,15 +42,17 @@ Pik is a tool to manage multiple versions of ruby on Windows.
|
|
42
42
|
|
43
43
|
== REQUIREMENTS:
|
44
44
|
|
45
|
-
Windows
|
45
|
+
Windows
|
46
46
|
|
47
47
|
* Build dependencies: exerb-mingw, highline, hpricot, crown, upx, wix
|
48
48
|
|
49
49
|
* Development dependencies: rake, cucumber, rspec, hoe, hoe-git, rack, rack-cache
|
50
50
|
|
51
51
|
== INSTALL:
|
52
|
+
|
53
|
+
You can install pik via rubygems, or the Windows installer, or you can update pik with pik
|
52
54
|
|
53
|
-
|
55
|
+
=== Install pik using rubygems
|
54
56
|
|
55
57
|
>gem install pik
|
56
58
|
...
|
@@ -73,7 +75,15 @@ So I run:
|
|
73
75
|
...
|
74
76
|
|
75
77
|
pik is installed
|
78
|
+
|
79
|
+
=== Install pik using the installer
|
80
|
+
|
81
|
+
If you want to install to a machine that doesn't have Ruby installed yet, you can download the latest msi file from github[http://github.com/vertiginous/pik/downloads]. Or, just run:
|
76
82
|
|
83
|
+
>msiexec /i http://github.com/downloads/vertiginous/pik/pik-n.n.n.msi
|
84
|
+
|
85
|
+
The MSI installer currently doesn't install the needed files to use Pik from Git Bash. Also, there was a bug in the upgrade code in 0.2.7, so you should uninstall the current version before installing the new one.
|
86
|
+
|
77
87
|
If you install to a directory that's not in your path, you'll need to add it to the path yourself. Microsoft has good instructions[http://support.microsoft.com/kb/310519] on that. After that, you should be ready to run pik.
|
78
88
|
|
79
89
|
* If this is a first-time install, look at pik add, and pik install to set up your environment.
|
data/Rakefile
CHANGED
@@ -24,11 +24,11 @@ ENV['SPEC_OPTS']= '-O spec/spec.opts'
|
|
24
24
|
|
25
25
|
lib = FileList["lib/**/*.rb"]
|
26
26
|
|
27
|
-
file 'tools/
|
28
|
-
Dir.chdir 'tools
|
29
|
-
sh('ruby -rexerb/mkexy pik_runner -v')
|
27
|
+
file 'tools/pik_runner.exy', :needs => ['tools/pik_runner'] + lib do
|
28
|
+
Dir.chdir 'tools' do
|
29
|
+
sh('ruby -rexerb/mkexy pik_runner pik.bat -v')
|
30
30
|
end
|
31
|
-
exy = YAML.load(File.read('tools/
|
31
|
+
exy = YAML.load(File.read('tools/pik_runner.exy'))
|
32
32
|
zlib1 = {
|
33
33
|
'file' => File.join(RbConfig::CONFIG['bindir'], 'zlib1.dll'),
|
34
34
|
'type' => 'extension-library'
|
@@ -36,28 +36,28 @@ file 'tools/pik/pik_runner.exy', :needs => ['tools/pik/pik_runner'] + lib do
|
|
36
36
|
exy['file']['zlib1.dll'] = zlib1
|
37
37
|
exy['resource'] = EXE_VERSION
|
38
38
|
|
39
|
-
File.open('tools/
|
39
|
+
File.open('tools/pik_runner.exy', 'w+'){ |f| f.puts YAML.dump(exy) }
|
40
40
|
end
|
41
41
|
|
42
|
-
file 'tools/
|
43
|
-
Dir.chdir 'tools
|
42
|
+
file 'tools/pik_runner.exe', :needs => ['tools/pik_runner.exy'] do
|
43
|
+
Dir.chdir 'tools' do
|
44
44
|
sh('ruby -S exerb pik_runner.exy')
|
45
45
|
sh('upx -9 pik_runner.exe') unless ENV['QUICK']
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
task :build, :needs => 'tools/
|
49
|
+
task :build, :needs => 'tools/pik_runner.exe'
|
50
50
|
|
51
51
|
task :install, :needs => :build do
|
52
52
|
sh('ruby bin/pik_install C:\\bin')
|
53
53
|
end
|
54
54
|
|
55
55
|
task :clobber_exe do
|
56
|
-
rm_rf 'tools/
|
56
|
+
rm_rf 'tools/pik_runner.exe'
|
57
57
|
end
|
58
58
|
|
59
59
|
task :clobber_exy, :needs => :clobber_exe do
|
60
|
-
rm_rf 'tools/
|
60
|
+
rm_rf 'tools/pik_runner.exy'
|
61
61
|
end
|
62
62
|
|
63
63
|
task :rebuild, :needs => [:clobber_exy, :build]
|
@@ -73,7 +73,6 @@ Hoe.spec('pik') do
|
|
73
73
|
developer('Gordon Thiesfeld', 'gthiesfeld@gmail.com')
|
74
74
|
|
75
75
|
self.need_tar = false
|
76
|
-
self.extra_deps = {'highline' => '>= 0.0.0'}
|
77
76
|
self.readme_file = 'README.rdoc'
|
78
77
|
self.post_install_message =<<-PIM
|
79
78
|
|
@@ -130,17 +129,22 @@ Cucumber::Rake::Task.new(:features) do |t|
|
|
130
129
|
t.cucumber_opts = "features -f html -o ../pik_cucumber.html -f progress"
|
131
130
|
end
|
132
131
|
|
132
|
+
desc "generate a guid"
|
133
133
|
task :guid do
|
134
134
|
puts
|
135
135
|
puts UUID.new.generate.upcase
|
136
136
|
end
|
137
137
|
|
138
|
+
require 'nokogiri'
|
138
139
|
directory 'pkg'
|
140
|
+
@package = 'pik'
|
141
|
+
@wix_file = "lib/installer/#{@package}.wxs"
|
142
|
+
@wxs = Nokogiri::XML(File.open(@wix_file))
|
143
|
+
@product = @wxs.at_css("Product")
|
139
144
|
|
140
|
-
@package
|
145
|
+
msi_file = "pkg/#{@package}-#{Pik::VERSION}.msi"
|
141
146
|
|
142
|
-
msi_file
|
143
|
-
file msi_file, :needs => 'tools/pik/pik_runner.exe'
|
147
|
+
file msi_file, :needs => 'tools/pik_runner.exe'
|
144
148
|
|
145
149
|
task :installer, :needs => [msi_file, :light]
|
146
150
|
|
@@ -163,5 +167,22 @@ task :light, :needs => :candle do
|
|
163
167
|
sh("light -nologo -ext WixUtilExtension -ext WixUIExtension #{wixobj_files} -o ../../#{msi_file}")
|
164
168
|
end
|
165
169
|
end
|
170
|
+
|
171
|
+
def version_string
|
172
|
+
@version.gsub(".","")
|
173
|
+
end
|
174
|
+
|
175
|
+
task :upgrade do
|
176
|
+
@product["Version"] = Pik::VERSION
|
177
|
+
|
178
|
+
upgrade_max = @product.at_css("UpgradeVersion[Property = 'OLDAPPFOUND']")
|
179
|
+
upgrade_max["Maximum"] = Pik::VERSION
|
180
|
+
|
181
|
+
upgrade_min = @product.at_css("UpgradeVersion[Property = 'NEWAPPFOUND']")
|
182
|
+
upgrade_min["Minimum"] = Pik::VERSION
|
183
|
+
|
184
|
+
@product["Id"] = UUID.new.generate
|
185
|
+
File.open(@wix_file, 'w+'){|f| f.puts @wxs }
|
186
|
+
end
|
166
187
|
# vim: syntax=Ruby
|
167
188
|
|
data/bin/pik_install
CHANGED
@@ -25,18 +25,50 @@ abort usage unless ARGV.first
|
|
25
25
|
|
26
26
|
puts "Thank you for using pik.\n\n"
|
27
27
|
|
28
|
-
install_dir
|
29
|
-
|
28
|
+
install_dir = ARGV.first
|
29
|
+
|
30
|
+
pik_home = File.join(ENV['USERPROFILE'], '.pik')
|
31
|
+
|
32
|
+
src_dir = File.join(File.dirname(File.dirname(__FILE__)), 'tools')
|
33
|
+
|
34
|
+
bash_install_dir = install_dir.tr('\\','/').sub(/^(.):/){|s| "/#{s[0,1].downcase}"}
|
35
|
+
|
36
|
+
mkdir_p install_dir, :verbose => true
|
37
|
+
mkdir_p pik_home, :verbose => true
|
38
|
+
|
39
|
+
old_dir = File.join(install_dir, 'pik')
|
40
|
+
old_pik = File.join(old_dir, 'pik_runner.exe')
|
41
|
+
if File.exist? old_pik
|
42
|
+
puts "cleaning up old files"
|
43
|
+
rm old_pik, :verbose => true
|
44
|
+
end
|
45
|
+
|
46
|
+
begin
|
47
|
+
rmdir(old_dir, :verbose=> true) if File.exist? old_dir
|
48
|
+
rescue Errno::ENOTEMPTY
|
49
|
+
puts "warning: can't delete #{old_dir}, directory not empty"
|
50
|
+
puts "continuing intall..."
|
51
|
+
end
|
30
52
|
|
31
53
|
puts "Installing to #{install_dir}\n\n"
|
32
|
-
cp File.join(
|
33
|
-
|
54
|
+
cp File.join(src_dir, 'pik_runner.exe'), install_dir, :verbose => true
|
55
|
+
cp File.join(src_dir, 'pik.bat'), install_dir, :verbose => true
|
56
|
+
cp File.join(src_dir, 'pik.ps1'), install_dir, :verbose => true
|
57
|
+
|
58
|
+
pikrc_file = File.join(pik_home, '.pikrc')
|
59
|
+
pikrc_contents =<<PIKRC
|
60
|
+
#!/bin/sh
|
61
|
+
pik_path=#{bash_install_dir}
|
62
|
+
|
63
|
+
function pik {
|
64
|
+
$pik_path/pik_runner.exe pik.sh $@
|
65
|
+
[[ -s $USERPROFILE/.pik/pik.sh ]] && source $USERPROFILE/.pik/pik.sh
|
66
|
+
}
|
67
|
+
PIKRC
|
68
|
+
puts
|
69
|
+
puts "creating #{pikrc_file}"
|
70
|
+
File.open(pikrc_file, 'w+'){|f| f.puts pikrc_contents }
|
34
71
|
|
35
|
-
mkdir_p File.join(install_dir, 'pik'), :verbose => true
|
36
|
-
cp File.join(tools_dir, 'pik', 'pik_runner.exe'),
|
37
|
-
File.join(install_dir, 'pik') ,
|
38
|
-
:verbose => true
|
39
|
-
|
40
72
|
puts "\npik is installed"
|
41
73
|
|
42
74
|
unless ENV['PATH'].downcase.include?( install_dir.downcase.gsub('/',"\\") )
|
@@ -52,4 +84,12 @@ SYSTEM_PATH_MSG
|
|
52
84
|
|
53
85
|
puts system_path_msg
|
54
86
|
|
55
|
-
end
|
87
|
+
end
|
88
|
+
|
89
|
+
puts
|
90
|
+
puts bash_msg =<<BASH_MSG
|
91
|
+
if you want to use pik with git bash, add the following line to your ~/.bashrc:
|
92
|
+
|
93
|
+
[[ -s $USERPROFILE/.pik/.pikrc ]] && source $USERPROFILE/.pik/.pikrc
|
94
|
+
|
95
|
+
BASH_MSG
|
data/features/support/env.rb
CHANGED
@@ -35,11 +35,11 @@ require 'win32/process'
|
|
35
35
|
REAL_PATH = SearchPath.new(ENV['PATH']).replace(RbConfig::CONFIG['bindir'], 'C:\temp\more spaces in path\ruby\Ruby-186-p398-2\bin').join
|
36
36
|
OTHER_RUBY = 'c:\\temp\\more spaces in path\\ruby\\Ruby-191-p378-1\\bin'
|
37
37
|
|
38
|
-
ENV['
|
38
|
+
ENV['USERPROFILE'] = "C:\\temp\\path with spaces"
|
39
39
|
ENV['http_proxy'] = "http://localhost:9292"
|
40
40
|
|
41
41
|
PIK_LOG = 'log\\output.log'
|
42
|
-
TEST_PIK_HOME = Pathname.new( ENV['
|
42
|
+
TEST_PIK_HOME = Pathname.new( ENV['USERPROFILE'] ) + '.pik'
|
43
43
|
FAKE_PIK_HOME = 'c:/temp/path with spaces/.pik'
|
44
44
|
PID_FILE = 'c:/temp/proxy/proxy.pid'
|
45
45
|
|
@@ -1,12 +1,12 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: use command
|
2
2
|
In order to switch from one ruby version to another
|
3
3
|
A developer
|
4
4
|
Wants an interface to the program
|
5
5
|
So that she can easily update the path and other environment variables.
|
6
6
|
|
7
|
-
Scenario Outline: Switching versions with
|
7
|
+
Scenario Outline: Switching versions with use command
|
8
8
|
Given I have added "<version>" to pik
|
9
|
-
When I run "pik
|
9
|
+
When I run "pik use <patterns> -v" and check the path
|
10
10
|
Then I should see "<version>"
|
11
11
|
And the path should point to it.
|
12
12
|
And the GEM_HOME might get set.
|
data/lib/pik.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
module Pik
|
2
|
-
VERSION = '0.2.7'
|
3
|
-
end
|
4
|
-
|
5
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
6
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'vendor/lib'))
|
7
3
|
|
@@ -12,24 +8,17 @@ require 'find'
|
|
12
8
|
require 'open-uri'
|
13
9
|
require 'rbconfig'
|
14
10
|
|
15
|
-
ENV['GEM_HOME'] = nil
|
16
|
-
ENV['GEM_PATH'] = nil
|
17
|
-
# real_home = ENV['HOME']
|
18
|
-
# ENV['HOME'] = "nul"
|
19
|
-
|
20
|
-
# require 'rubygems'
|
21
|
-
|
22
|
-
# ENV['HOME'] = real_home
|
23
|
-
|
24
11
|
require 'hpricot'
|
25
12
|
require 'highline'
|
26
13
|
|
27
|
-
require 'pik/pik'
|
28
|
-
require 'pik/batch_file'
|
29
14
|
require 'pik/core_ext/pathname'
|
15
|
+
require 'pik/scripts/script_file'
|
16
|
+
require 'pik/scripts/batch_file'
|
17
|
+
require 'pik/scripts/ps_file'
|
18
|
+
require 'pik/scripts/bash_file'
|
30
19
|
require 'pik/commands'
|
31
20
|
require 'pik/commands/config_file_editor'
|
32
|
-
require 'pik/commands/
|
21
|
+
require 'pik/commands/script_file_editor'
|
33
22
|
require 'pik/commands/command'
|
34
23
|
require 'pik/commands/devkit_command'
|
35
24
|
require 'pik/commands/install_command'
|
@@ -37,7 +26,7 @@ require 'pik/commands/list_command'
|
|
37
26
|
require 'pik/commands/add_command'
|
38
27
|
require 'pik/commands/help_command'
|
39
28
|
require 'pik/commands/info_command'
|
40
|
-
require 'pik/commands/
|
29
|
+
require 'pik/commands/use_command'
|
41
30
|
require 'pik/commands/run_command'
|
42
31
|
require 'pik/commands/remove_command'
|
43
32
|
require 'pik/commands/config_command'
|
@@ -54,14 +43,34 @@ require 'pik/version_parser'
|
|
54
43
|
require 'pik/windows_env'
|
55
44
|
require 'pik/which'
|
56
45
|
|
57
|
-
|
46
|
+
module Pik
|
47
|
+
VERSION = '0.2.8'
|
48
|
+
Scripts = {
|
49
|
+
'.cmd' => BatchFile,
|
50
|
+
'.bat' => BatchFile,
|
51
|
+
'.ps1' => PsFile,
|
52
|
+
'.sh' => BashFile
|
53
|
+
}
|
58
54
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
55
|
+
def self.print_error(error)
|
56
|
+
puts "\nThere was an error."
|
57
|
+
puts " Error: #{error.message}\n\n"
|
58
|
+
puts error.backtrace.map{|m| " in: #{m}" }
|
59
|
+
puts
|
60
|
+
end
|
61
|
+
|
64
62
|
end
|
65
63
|
|
64
|
+
|
66
65
|
Pik::Commands.deprecate(:checkup => "The checkup command is deprecated, using the info command instead.")
|
67
66
|
Pik::Commands.deprecate(:cu => "The cu command is deprecated, using the info command instead.")
|
67
|
+
|
68
|
+
PIK_HOME = Pathname.new( ENV['USERPROFILE'] ) + '.pik'
|
69
|
+
|
70
|
+
if defined?(ExerbRuntime) || $0 =~ /pik_runner/
|
71
|
+
PIK_SCRIPT = Pathname.new(ARGV.shift).ruby
|
72
|
+
SCRIPT_LANG = Pik::Scripts[PIK_SCRIPT.extname]
|
73
|
+
SCRIPT_FILE = SCRIPT_LANG.new(PIK_HOME + 'pik')
|
74
|
+
else
|
75
|
+
SCRIPT_FILE = Pik::BatchFile.new(PIK_HOME + 'pik')
|
76
|
+
end
|
data/lib/pik/commands/command.rb
CHANGED
@@ -9,7 +9,7 @@ module Pik
|
|
9
9
|
end
|
10
10
|
|
11
11
|
class Command
|
12
|
-
|
12
|
+
|
13
13
|
attr_reader :config
|
14
14
|
|
15
15
|
attr_reader :options
|
@@ -47,14 +47,6 @@ module Pik
|
|
47
47
|
def self.names
|
48
48
|
@names ||= [cmd_name]
|
49
49
|
end
|
50
|
-
|
51
|
-
def self.clean_gem_batch
|
52
|
-
BatchFile.open(PIK_BATCH) do |gem_bat|
|
53
|
-
# remove old calls to .pik/pik batches
|
54
|
-
gem_bat.remove_line( /call.+pik.+bat/i )
|
55
|
-
gem_bat.write
|
56
|
-
end
|
57
|
-
end
|
58
50
|
|
59
51
|
def self.choose_from(patterns, config)
|
60
52
|
if patterns.empty?
|
@@ -85,11 +77,11 @@ module Pik
|
|
85
77
|
@config = config_ || ConfigFile.new
|
86
78
|
@hl = HighLine.new
|
87
79
|
add_sigint_handler
|
88
|
-
options.program_name = "
|
80
|
+
options.program_name = "pik #{self.class.names.join('|')}"
|
89
81
|
command_options
|
90
82
|
parse_options
|
91
83
|
create(PIK_HOME) unless PIK_HOME.exist?
|
92
|
-
|
84
|
+
delete_old_pik_script
|
93
85
|
end
|
94
86
|
|
95
87
|
def close
|
@@ -162,10 +154,8 @@ module Pik
|
|
162
154
|
home.mkpath
|
163
155
|
end
|
164
156
|
|
165
|
-
def
|
166
|
-
|
167
|
-
File.delete(f) if File.ctime(f) < cutoff
|
168
|
-
end
|
157
|
+
def delete_old_pik_script
|
158
|
+
SCRIPT_FILE.path.delete if SCRIPT_FILE.path.exist?
|
169
159
|
end
|
170
160
|
|
171
161
|
def sh(cmd)
|