mini_portile 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +13 -0
- data/Rakefile +10 -1
- data/examples/Rakefile +85 -27
- data/lib/mini_portile.rb +51 -31
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01126f5630688f97f3ee6fe7d5350299597f7bf9
|
4
|
+
data.tar.gz: 0d187a46934aa17f7d1a175fb85212164e3c7e75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4600f5802cc11e9b3cc22b3bcd5b775d7fadb49a30df4ccfa8c09e07699cda449f2515f3115a8d669d4e938f567dec88183cc06f510df0a708232f38d955816
|
7
|
+
data.tar.gz: 170c8eef4ba7a276c4e28a7bddfd148db1f4e7f25cecc06592e6e1a92abd020385a5dbd9dbf8aecfd358d3d09055362bcb58bdcb2be1b791d9cfe5a929b92f4d
|
data/History.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
=== 0.6.0 / 2014-04-18
|
2
|
+
|
3
|
+
* Enhancements:
|
4
|
+
* Add default cert store and custom certs from `SSL_CERT_FILE` if present.
|
5
|
+
This increases compatibility with Ruby 1.8.7.
|
6
|
+
|
7
|
+
* Bugfixes:
|
8
|
+
* Specify Accept-Encoding to make sure a raw file content is downloaded.
|
9
|
+
Pull #30. [knu]
|
10
|
+
|
11
|
+
* Internal:
|
12
|
+
* Improve examples and use them as test harness.
|
13
|
+
|
1
14
|
=== 0.5.3 / 2014-03-24
|
2
15
|
|
3
16
|
* Bugfixes:
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require "rubygems/package_task"
|
|
4
4
|
GEM_SPEC = Gem::Specification.new do |s|
|
5
5
|
# basic information
|
6
6
|
s.name = "mini_portile"
|
7
|
-
s.version = "0.
|
7
|
+
s.version = "0.6.0"
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
|
10
10
|
# description and details
|
@@ -42,3 +42,12 @@ Gem::PackageTask.new(GEM_SPEC) do |pkg|
|
|
42
42
|
pkg.need_tar = false
|
43
43
|
pkg.need_zip = false
|
44
44
|
end
|
45
|
+
|
46
|
+
desc "Test MiniPortile by compiling examples"
|
47
|
+
task :test do
|
48
|
+
Dir.chdir("examples") do
|
49
|
+
sh "rake ports:all"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
task :default => [:test]
|
data/examples/Rakefile
CHANGED
@@ -1,46 +1,104 @@
|
|
1
1
|
require File.expand_path("mini_portile", File.join(File.dirname(__FILE__), "../lib"))
|
2
2
|
|
3
|
-
|
3
|
+
recipes = []
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
# libiconv
|
6
|
+
libiconv = MiniPortile.new "libiconv", "1.14"
|
7
|
+
libiconv.files << "ftp://ftp.gnu.org/pub/gnu/#{libiconv.name}/#{libiconv.name}-#{libiconv.version}.tar.gz"
|
8
8
|
|
9
|
-
|
10
|
-
$recipes[:sqlite3].files << "http://sqlite.org/sqlite-autoconf-3070500.tar.gz"
|
9
|
+
recipes.push libiconv
|
11
10
|
|
12
|
-
|
13
|
-
|
11
|
+
# sqlite3
|
12
|
+
sqlite3 = MiniPortile.new "sqlite3", "3.8.4.1"
|
13
|
+
sqlite3.files << "http://sqlite.org/2014/sqlite-autoconf-3080401.tar.gz"
|
14
|
+
|
15
|
+
recipes.push sqlite3
|
16
|
+
|
17
|
+
# c-ares
|
18
|
+
c_ares = MiniPortile.new "c-ares", "1.7.5"
|
19
|
+
c_ares.files << "https://s3.amazonaws.com/distfiles.openknapsack.org/#{c_ares.name}/#{c_ares.name}-#{c_ares.version}.tar.gz"
|
20
|
+
|
21
|
+
recipes.push c_ares
|
22
|
+
|
23
|
+
# zlib
|
24
|
+
class ZlibRecipe < MiniPortile
|
25
|
+
def windows?
|
26
|
+
!(host =~ /mswin|mingw/).nil?
|
27
|
+
end
|
14
28
|
|
15
|
-
|
16
|
-
|
17
|
-
recipe = $recipes[:libiconv]
|
18
|
-
checkpoint = "ports/.#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
|
29
|
+
def configure
|
30
|
+
return super unless windows?
|
19
31
|
|
20
|
-
|
21
|
-
|
22
|
-
|
32
|
+
Dir.chdir work_path do
|
33
|
+
mk = File.read 'win32/Makefile.gcc'
|
34
|
+
File.open 'win32/Makefile.gcc', 'wb' do |f|
|
35
|
+
f.puts "BINARY_PATH = #{path}/bin"
|
36
|
+
f.puts "LIBRARY_PATH = #{path}/lib"
|
37
|
+
f.puts "INCLUDE_PATH = #{path}/include"
|
38
|
+
|
39
|
+
cross_build? and
|
40
|
+
mk.sub!(/^PREFIX\s*=\s*$/, "PREFIX = #{host}-")
|
41
|
+
|
42
|
+
f.puts mk
|
43
|
+
end
|
23
44
|
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def configure_defaults
|
48
|
+
["--static"]
|
49
|
+
end
|
50
|
+
|
51
|
+
def configured?
|
52
|
+
return super unless windows?
|
53
|
+
|
54
|
+
!!(File.read(File.join(work_path, 'win32/Makefile.gcc')) =~ /^BINARY_PATH/)
|
55
|
+
end
|
56
|
+
|
57
|
+
def compile
|
58
|
+
return super unless windows?
|
59
|
+
|
60
|
+
execute "compile", "make -f win32/Makefile.gcc"
|
61
|
+
end
|
62
|
+
|
63
|
+
def install
|
64
|
+
return if installed?
|
65
|
+
return super unless windows?
|
66
|
+
|
67
|
+
execute "install", %Q(#{make_cmd} -f win32/Makefile.gcc install)
|
68
|
+
end
|
24
69
|
|
25
|
-
|
70
|
+
def cross_build?
|
71
|
+
host != original_host
|
26
72
|
end
|
73
|
+
end
|
74
|
+
|
75
|
+
zlib = ZlibRecipe.new "zlib", "1.2.8"
|
76
|
+
zlib.files << "http://zlib.net/#{zlib.name}-#{zlib.version}.tar.gz"
|
77
|
+
|
78
|
+
recipes.push zlib
|
79
|
+
|
80
|
+
namespace :ports do
|
81
|
+
directory "ports"
|
82
|
+
|
83
|
+
recipes.each do |recipe|
|
84
|
+
desc "Install port #{recipe.name} #{recipe.version}"
|
85
|
+
task recipe.name => ["ports"] do |t|
|
86
|
+
checkpoint = "ports/.#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
|
27
87
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
88
|
+
unless File.exist?(checkpoint)
|
89
|
+
recipe.cook
|
90
|
+
touch checkpoint
|
91
|
+
end
|
32
92
|
|
33
|
-
|
34
|
-
recipe.cook
|
35
|
-
touch checkpoint
|
93
|
+
recipe.activate
|
36
94
|
end
|
37
95
|
|
38
|
-
recipe.
|
96
|
+
task :all => recipe.name
|
39
97
|
end
|
40
98
|
|
41
99
|
desc "Install all ports and display installation location"
|
42
|
-
task :all
|
43
|
-
|
100
|
+
task :all do
|
101
|
+
recipes.each do |recipe|
|
44
102
|
puts "Artifacts of '#{recipe.name}' in '#{recipe.path}'"
|
45
103
|
end
|
46
104
|
puts "LDFLAGS: " << ENV['LDFLAGS'].inspect
|
@@ -49,7 +107,7 @@ end
|
|
49
107
|
|
50
108
|
desc "Adjust all recipes host for cross-compilation"
|
51
109
|
task :cross do
|
52
|
-
|
110
|
+
recipes.each do |recipe|
|
53
111
|
recipe.host = "i686-w64-mingw32"
|
54
112
|
end
|
55
113
|
end
|
data/lib/mini_portile.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rbconfig'
|
2
2
|
require 'net/http'
|
3
|
+
require 'net/https'
|
3
4
|
require 'net/ftp'
|
4
5
|
require 'fileutils'
|
5
6
|
require 'tempfile'
|
@@ -321,46 +322,65 @@ private
|
|
321
322
|
|
322
323
|
def download_file_http(url, full_path, count = 3)
|
323
324
|
filename = File.basename(full_path)
|
325
|
+
uri = URI.parse(url)
|
324
326
|
|
325
327
|
if ENV['http_proxy']
|
326
|
-
|
328
|
+
_, userinfo, p_host, p_port = URI.split(ENV['http_proxy'])
|
327
329
|
proxy_user, proxy_pass = userinfo.split(/:/) if userinfo
|
328
|
-
http = Net::HTTP
|
330
|
+
http = Net::HTTP.new(uri.host, uri.port, p_host, p_port, proxy_user, proxy_pass)
|
329
331
|
else
|
330
|
-
http = Net::HTTP
|
332
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
333
|
+
|
334
|
+
if URI::HTTPS === uri
|
335
|
+
http.use_ssl = true
|
336
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
337
|
+
|
338
|
+
store = OpenSSL::X509::Store.new
|
339
|
+
|
340
|
+
# Auto-include system-provided certificates
|
341
|
+
store.set_default_paths
|
342
|
+
|
343
|
+
if ENV.has_key?("SSL_CERT_FILE") && File.exist?(ENV["SSL_CERT_FILE"])
|
344
|
+
store.add_file ENV["SSL_CERT_FILE"]
|
345
|
+
end
|
346
|
+
|
347
|
+
http.cert_store = store
|
348
|
+
end
|
331
349
|
end
|
332
350
|
|
333
351
|
message "Downloading #{filename} "
|
334
|
-
http.
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
352
|
+
http.start do |h|
|
353
|
+
h.request_get(uri.path, 'Accept-Encoding' => 'identity') do |response|
|
354
|
+
case response
|
355
|
+
when Net::HTTPNotFound
|
356
|
+
output "404 - Not Found"
|
357
|
+
return false
|
358
|
+
|
359
|
+
when Net::HTTPClientError
|
360
|
+
output "Error: Client Error: #{response.inspect}"
|
361
|
+
return false
|
362
|
+
|
363
|
+
when Net::HTTPRedirection
|
364
|
+
raise "Too many redirections for the original URL, halting." if count <= 0
|
365
|
+
url = response["location"]
|
366
|
+
return download_file(url, full_path, count - 1)
|
367
|
+
|
368
|
+
when Net::HTTPOK
|
369
|
+
return with_tempfile(filename, full_path) do |temp_file|
|
370
|
+
size = 0
|
371
|
+
progress = 0
|
372
|
+
total = response.header["Content-Length"].to_i
|
373
|
+
response.read_body do |chunk|
|
374
|
+
temp_file << chunk
|
375
|
+
size += chunk.size
|
376
|
+
new_progress = (size * 100) / total
|
377
|
+
unless new_progress == progress
|
378
|
+
message "\rDownloading %s (%3d%%) " % [filename, new_progress]
|
379
|
+
end
|
380
|
+
progress = new_progress
|
360
381
|
end
|
361
|
-
|
382
|
+
output
|
362
383
|
end
|
363
|
-
output
|
364
384
|
end
|
365
385
|
end
|
366
386
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_portile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luis Lavena
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Simplistic port-like solution for developers. It provides a standard
|
14
14
|
and simplified way to compile against dependency libraries without messing up your
|
@@ -21,37 +21,37 @@ extra_rdoc_files:
|
|
21
21
|
- History.txt
|
22
22
|
- LICENSE.txt
|
23
23
|
files:
|
24
|
-
- examples/Rakefile
|
25
|
-
- lib/mini_portile.rb
|
26
|
-
- Rakefile
|
27
24
|
- History.txt
|
28
25
|
- LICENSE.txt
|
29
26
|
- README.rdoc
|
27
|
+
- Rakefile
|
28
|
+
- examples/Rakefile
|
29
|
+
- lib/mini_portile.rb
|
30
30
|
homepage: http://github.com/luislavena/mini_portile
|
31
31
|
licenses:
|
32
32
|
- MIT
|
33
33
|
metadata: {}
|
34
34
|
post_install_message:
|
35
35
|
rdoc_options:
|
36
|
-
- --main
|
36
|
+
- "--main"
|
37
37
|
- README.rdoc
|
38
|
-
- --title
|
38
|
+
- "--title"
|
39
39
|
- MiniPortile -- Documentation
|
40
40
|
require_paths:
|
41
41
|
- lib
|
42
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 1.8.7
|
47
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
|
-
- -
|
49
|
+
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: 1.3.5
|
52
52
|
requirements: []
|
53
53
|
rubyforge_project:
|
54
|
-
rubygems_version: 2.
|
54
|
+
rubygems_version: 2.2.2
|
55
55
|
signing_key:
|
56
56
|
specification_version: 4
|
57
57
|
summary: Simplistic port-like solution for developers
|