Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
unknown
committed
Sep 4, 2009
1 parent
9a417bc
commit 341fbd1
Showing
38 changed files
with
1,118 additions
and
598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
# -*- ruby -*- | ||
|
||
require 'autotest/restart' | ||
|
||
# Autotest.add_hook :initialize do |at| | ||
# at.extra_files << "../some/external/dependency.rb" | ||
# | ||
# at.libs << ":../some/external" | ||
# | ||
# at.add_exception 'vendor' | ||
# | ||
# at.add_mapping(/dependency.rb/) do |f, _| | ||
# at.files_matching(/test_.*rb$/) | ||
# end | ||
# | ||
# %w(TestA TestB).each do |klass| | ||
# at.extra_class_map[klass] = "test/test_misc.rb" | ||
# end | ||
# end | ||
|
||
# Autotest.add_hook :run_command do |at| | ||
# system "rake build" | ||
# end | ||
# -*- ruby -*- | ||
require 'win32console' | ||
require 'autotest/restart' | ||
|
||
Autotest.add_hook :initialize do |at| | ||
# at.extra_files << "../some/external/dependency.rb" | ||
|
||
# at.libs << ":../some/external" | ||
|
||
at.add_exception 'bin' | ||
|
||
# at.add_mapping(/dependency.rb/) do |f, _| | ||
# at.files_matching(/test_.*rb$/) | ||
# end | ||
|
||
# %w(TestA TestB).each do |klass| | ||
# at.extra_class_map[klass] = "test/test_misc.rb" | ||
# end | ||
end | ||
|
||
# Autotest.add_hook :run_command do |at| | ||
# system "rake build" | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
=== 0.0.2 / 2009-06-02 | ||
|
||
* several minor enhancements | ||
*updated help messages | ||
*updated readme | ||
*some formatting of output | ||
|
||
=== 0.0.1 / 2009-06-02 | ||
|
||
* 1 major enhancement | ||
|
||
* Birthday! | ||
|
||
=== 0.0.3 / 2009-06-10 | ||
|
||
* added 'add_gem_home' command | ||
due to changes in the config, you'll have to delete your "%HOME%\.pik\config.yml" and recreate it. | ||
* don't use GEM_HOME on XP with rubygems 1.3.4, wait for 1.3.5, or point them to a path without spaces. | ||
|
||
=== 0.0.2 / 2009-06-02 | ||
|
||
* several minor enhancements | ||
*updated help messages | ||
*updated readme | ||
*some formatting of output | ||
|
||
=== 0.0.1 / 2009-06-02 | ||
|
||
* 1 major enhancement | ||
|
||
* Birthday! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,30 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# pik switch 186 | ||
# pik switch 186 mingw | ||
# pik switch 191 --system | ||
|
||
# pik config default=186 mingw | ||
# pik config home | ||
# pik config rubyopt=(on|off) | ||
|
||
# pik checkup | ||
|
||
# pik search | ||
# pik add (path_to_ruby) | ||
# pik help (command) | ||
|
||
|
||
require File.join(File.dirname(__FILE__), '..', 'lib', 'pik') | ||
|
||
Pik::Runner.execute | ||
#!/usr/bin/env ruby | ||
require File.join(File.dirname(__FILE__), '..', 'lib', 'pik') | ||
|
||
include Pik | ||
|
||
args = ARGV | ||
cmd = args.shift || 'help' | ||
cmd = cmd.downcase.to_sym | ||
|
||
Command.clean_gem_batch | ||
|
||
begin | ||
config = ConfigFile.new | ||
command = Commands.find(cmd) | ||
command ||= if args = [Command.choose_from(ARGV.unshift(cmd), config)] | ||
Switch | ||
else | ||
Help | ||
end | ||
cmd = command.new(args, config) | ||
cmd.execute | ||
rescue QuitError | ||
puts "\nQuitting..." | ||
rescue => e | ||
puts "\nThere was an error" | ||
puts " Error: #{e.message}\n\n" | ||
puts e.backtrace | ||
ensure | ||
cmd.close if cmd | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,29 @@ | ||
class Pik | ||
module Pik | ||
VERSION = '0.0.3' | ||
end | ||
|
||
$LOAD_PATH.unshift(File.dirname(__FILE__)) | ||
|
||
require 'erb' | ||
require 'highline' | ||
require 'fileutils' | ||
require 'pathname' | ||
require 'rbconfig' | ||
|
||
require 'pik/runner' | ||
require 'pik/config' | ||
require 'pik/checkup' | ||
require 'pik/windows_file' | ||
$LOAD_PATH.unshift File.dirname(__FILE__) | ||
require 'pik/core_ext/pathname' | ||
require 'pik/commands' | ||
require 'pik/commands/config_file_editor' | ||
require 'pik/commands/batch_file_editor' | ||
require 'pik/commands/command' | ||
require 'pik/commands/list_command' | ||
require 'pik/commands/add_command' | ||
require 'pik/commands/help_command' | ||
require 'pik/commands/switch_command' | ||
require 'pik/commands/run_command' | ||
require 'pik/commands/remove_command' | ||
require 'pik/commands/checkup_command' | ||
require 'pik/commands/config_command' | ||
require 'pik/commands/gemdup_command' | ||
require 'pik/config_file' | ||
require 'pik/windows_env' | ||
require 'pik/batch_file' | ||
require 'pik/search_path' | ||
|
||
PIK_HOME = File.join( (ENV['HOME'] || ENV['USERPROFILE']) , '.pik') | ||
|
||
|
||
PIK_HOME = Pathname.new( ENV['HOME'] || ENV['USERPROFILE'] ) + '.pik' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,11 @@ | ||
class Pik | ||
# class Pik | ||
|
||
class Checkup | ||
# class Checkup | ||
|
||
def initialize(text) | ||
@text = text | ||
# pp @text | ||
@output = ["Checkup results:"] | ||
end | ||
# def initialize(text) | ||
# @text = text | ||
# @output = ["Checkup results:"] | ||
# end | ||
|
||
def check | ||
home | ||
rubyopt | ||
path | ||
pathext | ||
|
||
puts | ||
puts | ||
|
||
self | ||
end | ||
|
||
def to_s | ||
ERB.new(@output.join("\n\n")).result | ||
end | ||
|
||
def rubyopt | ||
unless WindowsEnv.user['rubyopt'].empty? && WindowsEnv.system['rubyopt'].empty? | ||
fail('rubyopt') | ||
else | ||
pass('rubyopt') | ||
end | ||
end | ||
|
||
def home | ||
if WindowsEnv.user['home'].empty? | ||
fail('home') | ||
else | ||
pass('home') | ||
end | ||
end | ||
|
||
def path | ||
dirs = (WindowsEnv.user['path'] + WindowsEnv.system['path']).split(';') | ||
dirs = dirs.select{|dir| File.exist?( File.join(dir,'ruby.exe') ) } | ||
unless dirs.size == 1 | ||
fail('path') | ||
else | ||
pass('path') | ||
end | ||
end | ||
|
||
def pathext | ||
p_ext = WindowsEnv.system['pathext'].downcase | ||
unless p_ext.include?('.rb') && p_ext.include?('.rbw') | ||
fail('pathext') | ||
else | ||
pass('pathext') | ||
end | ||
end | ||
|
||
def pass(test) | ||
print '.' | ||
$stdout.flush | ||
@output << @text[test][:pass] | ||
end | ||
|
||
def fail(test) | ||
print 'F' | ||
@output << @text[test][:fail] | ||
end | ||
|
||
end | ||
|
||
end | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module Pik | ||
|
||
module Commands | ||
|
||
def self.clear | ||
commands.clear | ||
end | ||
|
||
def self.add(command) | ||
commands << command | ||
end | ||
|
||
def self.find(command) | ||
commands.find{ |cmd| cmd.names.include?(command.to_sym) } | ||
end | ||
|
||
def self.list | ||
commands.map{|c| c.names }.flatten | ||
end | ||
|
||
def self.description | ||
commands.sort_by{|c| c.name }.map do |cmd| | ||
" %-15s %s" % [cmd.names.join('|'), cmd.summary] | ||
end.join("\n") + | ||
"\n\nFor help on a particular command, use 'pik help COMMAND'." | ||
end | ||
|
||
def self.commands | ||
@commands ||= [] | ||
end | ||
|
||
|
||
end | ||
|
||
end |
Oops, something went wrong.