Permalink
Browse files

add ansicon as a package

  • Loading branch information...
1 parent cab6c4a commit 7f33fa3ec5d714120cd42777f1535c28e9bc427a @vertiginous committed Jan 26, 2011
Showing with 48 additions and 11 deletions.
  1. +3 −3 lib/pik/commands/command.rb
  2. +37 −3 lib/pik/commands/package_command.rb
  3. +6 −4 lib/pik/installer.rb
  4. +2 −1 lib/pik/packages.rb
@@ -128,9 +128,9 @@ def delete_old_pik_script
Pik.script_file.path.delete if Pik.script_file.path.exist?
end
- def sh(cmd)
- puts cmd if debug
- system(cmd)
+ def sh(*cmd)
+ Log.debug cmd.join(' ') if debug
+ system(*cmd)
end
def hl
@@ -14,6 +14,8 @@ def execute
sevenzip
when "sqlite"
sqlite
+ when 'ansicon'
+ ansicon
else
help
end
@@ -46,6 +48,16 @@ def devkit
end
end
+ def ansicon
+ check_7zip
+ file = download(url('ansicon'))
+ extract(install_root, file, {:recurse => ansicon_arch, :extract => :flat})
+ sh(install_root + "ansicon.exe", "-i")
+ msg = "Ansicon is installed for new shells. Run 'ansicon -p'\n"
+ msg << " to install it for this shell"
+ Log.info msg
+ end
+
def sqlite
check_7zip
file = download(url('sqlite'))
@@ -54,6 +66,7 @@ def sqlite
def sevenzip
file = download(url('7zip'))
+ Log.info "Extracting: #{file.windows}\n to: #{install_root}"
Zip.fake_unzip(file.to_s, /\.exe|\.dll$/, install_root.to_s)
end
@@ -64,9 +77,20 @@ def url(package)
def command_options
super
sep =<<-SEP
- sqlite: 'pik package sqlite install'
- 7zip: 'pik package 7zip install'
- devkit: 'pik package devkit install' # Installed to mingw versions only.
+ sqlite: 'pik package sqlite install'
+ 7zip: 'pik package 7zip install'
+ ansicon: 'pik package ansicon install'
+ devkit: 'pik package devkit install' # Installed to mingw versions only.
+
+In some cases, The package command assumes that pik is
+installed on your path. If it is not, you'll want to use
+the path parameter so pik can install files to a location
+that is in your path.
+
+ pik package install sqlite C:\\bin
+
+In the case of the devkit, it is STRONGLY recommended
+that you don't install to a path with spaces.
If you have an idea for another package, submit a
feature request at https://github.com/vertiginous/pik/issues
@@ -91,6 +115,16 @@ def mingw?(version)
Pik::VersionParser.parse(version).platform =~ /mingw/
end
+ #determines x86 or x64 architecture
+ def ansicon_arch
+ key = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
+ if Reg.new.hklm(key, 'PROCESSOR_ARCHITECTURE') =~ /64/
+ 'x64'
+ else
+ 'x86'
+ end
+ end
+
end
end
View
@@ -59,14 +59,16 @@ def mv_r(src, dest, options = {})
end
end
- def extract(target, file)
+ def extract(target, file, options={})
target.mkpath
# based on filetypes, extract the files
- Log.info "Extracting: #{file.windows}\n to: #{target}" #if verbose
+ Log.info "Extracting: #{file.windows}\n to: #{target}"
case file.to_s
when /(^.+\.zip$)/, /(^.+\.7z$)/, /(^.+\.exe$)/
- file = Pathname($1)
- cmd = " \"#{seven_zip}\" x \"#{file.windows}\" -y -o\"#{target}\" > NUL"
+ file = Pathname($1)
+ recurse = "-r #{options[:recurse]}" if options[:recurse]
+ ext = options[:extract] == :flat ? 'e' : 'x'
+ cmd = "\"#{seven_zip}\" #{ext} \"#{file.windows}\" -y #{recurse} -o\"#{target}\" > NUL"
Log.debug cmd
system(cmd)
else
View
@@ -12,7 +12,8 @@ def [](key)
PACKAGES = {
"sqlite"=>{:url=>"http://www.sqlite.org/sqlite-dll-win32-x86-3070400.zip"},
"devkit"=>{:url=>"http://cdn.rubyinstaller.org/archives/devkits/DevKit-tdm-32-4.5.1-20101231-1457.7z"},
- "7zip"=>{:url=>"http://downloads.sourceforge.net/sevenzip/7za920.zip"}
+ "7zip"=>{:url=>"http://downloads.sourceforge.net/sevenzip/7za920.zip"},
+ "ansicon"=>{:url=>"http://adoxa.110mb.com/ansicon/ansi132.zip"}
}
end

0 comments on commit 7f33fa3

Please sign in to comment.