Skip to content

Commit

Permalink
Big update, messed up CR+LF, LF and UTF8 encoding.
Browse files Browse the repository at this point in the history
Yeah, I was responsible, sue me.
  • Loading branch information
luislavena committed May 19, 2008
1 parent 3ccb019 commit 976c328
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 101 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2008-05-18 Luis Lavena
2008-05-18 Luis Lavena

* rake/extracttask.rb: Use 7-Zip as extract() utility to solve some
extration troubles and speedup extraction process.
Expand Down
8 changes: 4 additions & 4 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* Try getting Readline 5.0 (or 5.2) working and passing all test
(test/test_readline.rb)
* Implements all the dependencies required by Setup.nt extensions.
* Try getting Readline 5.0 (or 5.2) working and passing all test
(test/test_readline.rb)

* Implements all the dependencies required by Setup.nt extensions.
88 changes: 44 additions & 44 deletions rake/downloadtask.rb
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
#
# This Rake Task is a striped down version of Buildr download task
# I took the code from http://rubyforge.org/projects/buildr
#
# I've striped down dependencies on Net::SSH and Facets to
# stay as simple as possible.
#
# Original code from Assaf Arkin, released under Apache License
# (http://buildr.rubyforge.org/license.html)
#

require 'rake'
require 'tempfile'

require File.join(File.dirname(__FILE__), 'contrib', 'uri_ext')

def download(args)
args = URI.parse(args) if args.is_a?(String)

options = {
:progress => true,
:verbose => Rake.application.options.trace
}

# Given only a download URL, download into a temporary file.
# You can infer the file from task name.
if URI === args
temp = Tempfile.open(File.basename(args.to_s))
file_create(temp.path) do |task|
# Since temporary file exists, force a download.
class << task ; def needed?() ; true ; end ; end
task.sources << args
task.enhance { args.download(temp, options) }
end
else
# Download to a file task instead
fail unless args.keys.size == 1
uri = URI.parse(args.values.first.to_s)
file_create(args.keys.first) do |task|
task.sources << uri
task.enhance { uri.download(task.name, options) }
end
end
end
#
# This Rake Task is a striped down version of Buildr download task
# I took the code from http://rubyforge.org/projects/buildr
#
# I've striped down dependencies on Net::SSH and Facets to
# stay as simple as possible.
#
# Original code from Assaf Arkin, released under Apache License
# (http://buildr.rubyforge.org/license.html)
#

require 'rake'
require 'tempfile'

require File.join(File.dirname(__FILE__), 'contrib', 'uri_ext')

def download(args)
args = URI.parse(args) if args.is_a?(String)

options = {
:progress => true,
:verbose => Rake.application.options.trace
}

# Given only a download URL, download into a temporary file.
# You can infer the file from task name.
if URI === args
temp = Tempfile.open(File.basename(args.to_s))
file_create(temp.path) do |task|
# Since temporary file exists, force a download.
class << task ; def needed?() ; true ; end ; end
task.sources << args
task.enhance { args.download(temp, options) }
end
else
# Download to a file task instead
fail unless args.keys.size == 1
uri = URI.parse(args.values.first.to_s)
file_create(args.keys.first) do |task|
task.sources << uri
task.enhance { uri.download(task.name, options) }
end
end
end
2 changes: 1 addition & 1 deletion rake/extracttask.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'tmpdir'
require 'tmpdir'
require 'fileutils'

def extract(file, target, options = {})
Expand Down
42 changes: 21 additions & 21 deletions rakefile.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#!/usr/bin/env ruby

# Load Rake
begin
require 'rake'
rescue LoadError
require 'rubygems'
require 'rake'
end

# Added download task from buildr
require 'rake/downloadtask'
require 'rake/extracttask'

# RubyInstaller configuration data
require 'config/ruby_installer'

Dir.glob("#{RubyInstaller::ROOT}/recipes/**/*.rake").sort.each do |ext|
puts "Loading #{File.basename(ext)}" if Rake.application.options.trace
load ext
end
#!/usr/bin/env ruby

# Load Rake
begin
require 'rake'
rescue LoadError
require 'rubygems'
require 'rake'
end

# Added download task from buildr
require 'rake/downloadtask'
require 'rake/extracttask'

# RubyInstaller configuration data
require 'config/ruby_installer'

Dir.glob("#{RubyInstaller::ROOT}/recipes/**/*.rake").sort.each do |ext|
puts "Loading #{File.basename(ext)}" if Rake.application.options.trace
load ext
end
60 changes: 30 additions & 30 deletions recipes/extract_utils/extract_utils.rake
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
require 'rake/contrib/unzip'

namespace(:extract_utils) do
package = RubyInstaller::ExtractUtils
directory package.target
CLEAN.include(package.target)

# Put files for the :download task
package.files.each do |f|
file_source = "#{package.url}/#{f}"
file_target = "downloads/#{f}"
download file_target => file_source

# depend on downloads directory
file file_target => "downloads"

# download task need these files as pre-requisites
task :download => file_target
end

task :extract_utils => [:download, package.target] do
package.files.each do |f|
filename = "downloads/#{f}"
Zip.fake_unzip(filename, /\.exe|\.dll$/, package.target)
end
end
end

task :download => ['extract_utils:download']
task :extract_utils => ['extract_utils:extract_utils']
require 'rake/contrib/unzip'

namespace(:extract_utils) do
package = RubyInstaller::ExtractUtils
directory package.target
CLEAN.include(package.target)

# Put files for the :download task
package.files.each do |f|
file_source = "#{package.url}/#{f}"
file_target = "downloads/#{f}"
download file_target => file_source

# depend on downloads directory
file file_target => "downloads"

# download task need these files as pre-requisites
task :download => file_target
end

task :extract_utils => [:download, package.target] do
package.files.each do |f|
filename = "downloads/#{f}"
Zip.fake_unzip(filename, /\.exe|\.dll$/, package.target)
end
end
end

task :download => ['extract_utils:download']
task :extract_utils => ['extract_utils:extract_utils']

0 comments on commit 976c328

Please sign in to comment.