crate 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/HISTORY CHANGED
@@ -1,4 +1,26 @@
1
1
  = Changelog
2
+ == Version 0.2.1 2009-01-18
3
+
4
+ === Enhancements
5
+ * update with new amalgalite vesion
6
+ * update to new openssl version
7
+
8
+ === Bugfixes
9
+ * fix missing libs on final build
10
+ * fix lib ordering on final build
11
+
12
+ == Version 0.2.0 2008-12-20
13
+
14
+ === Enhancements
15
+ * use Net::FTP for passive ftp [ jonbrenner ]
16
+ * use Net::HTTP instead of open-uri
17
+
18
+ === Bugfixes
19
+ * update sha1 hash for amalgalite gem [ jonbrenner ]
20
+ * update dependencies, removing progressbar and adding logging
21
+ * fix digest check task [ jonbrenner ]
22
+ * set binary mode for writing downloaded files to disk
23
+
2
24
  == Version 0.1.1
3
25
 
4
26
  * fix packing of ruby stdlib extension's pure ruby components
data/README CHANGED
@@ -4,12 +4,13 @@
4
4
  * {Rubyforge Project}[http://rubyforge.org/projects/copiousfreetime/]
5
5
  * email jeremy at copiousfreetime dot org
6
6
  * git clone url git://github.com/copiousfreetime/crate.git
7
- * {Packaging an Application With Crate}[http://copiousfreetime.org/articles/2008/11/30/package-an-application-with-crate.html
7
+ * {Packaging an Application With Crate}[http://copiousfreetime.org/articles/2008/11/30/package-an-application-with-crate.html]
8
+ * {RubyConf '08 Presentation}[http://rubyconf2008.confreaks.com/crate-packaging-your-ruby-application.html]
8
9
 
9
10
  == DESCRIPTION
10
11
 
11
12
  Crate is a developer tool to help package up your application as a custom static
12
- build of the ruby interpreter plus all dependedent binary extensions. All the
13
+ build of the ruby interpreter plus all dependent binary extensions. All the
13
14
  pure ruby code (the ruby application, the ruby stdlib, etc ) is packed into one
14
15
  or more SQLite databases.
15
16
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # The recipe for integrating amalgalite into the ruby build
3
3
  #
4
- Crate::GemIntegration.new("amalgalite", "0.5.1") do |t|
5
- t.upstream_source = "http://rubyforge.org/frs/download.php/47660/amalgalite-0.5.1.gem"
6
- t.upstream_sha1 = "fca93f2ab3abf46c86e78202d46489f25b7acb33"
4
+ Crate::GemIntegration.new("amalgalite", "0.7.1") do |t|
5
+ t.upstream_source = "http://rubyforge.org/frs/download.php/50393/amalgalite-0.7.1.gem"
6
+ t.upstream_sha1 = "84a84fd1192cef2d77701ec74afc8325a2a99ca7"
7
7
  end
@@ -1,10 +1,10 @@
1
1
  #
2
2
  # Crate recipe for openssl
3
3
  #
4
- Crate::Dependency.new("openssl", "0.9.8i") do |t|
4
+ Crate::Dependency.new("openssl", "0.9.8j") do |t|
5
5
  t.depends_on( "zlib" )
6
- t.upstream_source = "http://www.openssl.org/source/openssl-0.9.8i.tar.gz"
7
- t.upstream_sha1 = "b2e029cfb68bf32eae997d60317a40945db5a65f"
6
+ t.upstream_source = "http://openssl.org/source/openssl-0.9.8j.tar.gz"
7
+ t.upstream_sha1 = "f70f7127a26e951e8a0d854c0c9e6b4c24df78e4"
8
8
 
9
9
  t.build_commands = [
10
10
  "./config --prefix=#{File.join( '/', 'usr' )} zlib no-threads no-shared",
@@ -0,0 +1,14 @@
1
+ * make sure the headers for openssl match up
2
+ --- ext/openssl/openssl_missing.h 2008-08-03 22:43:34.000000000 -0600
3
+ +++ ext/openssl/openssl_missing.h 2009-01-18 17:46:19.000000000 -0700
4
+ @@ -120,8 +120,8 @@
5
+ int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
6
+ int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
7
+ int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
8
+ -int BN_rand_range(BIGNUM *r, BIGNUM *range);
9
+ -int BN_pseudo_rand_range(BIGNUM *r, BIGNUM *range);
10
+ +int BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
11
+ +int BN_pseudo_rand_range(BIGNUM *r, const BIGNUM *range);
12
+ char *CONF_get1_default_config_file(void);
13
+ int PEM_def_callback(char *buf, int num, int w, void *key);
14
+
data/gemspec.rb CHANGED
@@ -6,7 +6,7 @@ Crate::GEM_SPEC = Gem::Specification.new do |spec|
6
6
  proj = Configuration.for('project')
7
7
  spec.name = proj.name
8
8
  spec.version = Crate::VERSION
9
-
9
+
10
10
  spec.author = proj.author
11
11
  spec.email = proj.email
12
12
  spec.homepage = proj.homepage
@@ -14,34 +14,33 @@ Crate::GEM_SPEC = Gem::Specification.new do |spec|
14
14
  spec.description = proj.description
15
15
  spec.platform = Gem::Platform::RUBY
16
16
 
17
-
17
+
18
18
  pkg = Configuration.for('packaging')
19
19
  spec.files = pkg.files.all
20
20
  spec.executables = pkg.files.bin.collect { |b| File.basename(b) }
21
21
 
22
22
  # add dependencies here
23
- spec.add_dependency("rake", ">= 0.8.1")
24
- spec.add_dependency("configuration", "~> 0.0.5")
25
- spec.add_dependency("progressbar")
26
- spec.add_dependency("archive-tar-minitar")
27
- spec.add_dependency("amalgalite", "~> 0.5.0")
28
-
29
-
30
-
23
+ spec.add_dependency( "rake", "~> 0.8.3")
24
+ spec.add_dependency( "configuration", "~> 0.0.5")
25
+ spec.add_dependency( "archive-tar-minitar")
26
+ spec.add_dependency( "amalgalite", "~> 0.7")
27
+ spec.add_dependency( "logging", "~> 0.9" )
28
+
29
+
31
30
  if rdoc = Configuration.for_if_exist?('rdoc') then
32
31
  spec.has_rdoc = true
33
32
  spec.extra_rdoc_files = pkg.files.rdoc
34
33
  spec.rdoc_options = rdoc.options + [ "--main" , rdoc.main_page ]
35
34
  else
36
35
  spec.has_rdoc = false
37
- end
36
+ end
38
37
 
39
38
  if test = Configuration.for_if_exist?('testing') then
40
39
  spec.test_files = test.files
41
- end
40
+ end
42
41
 
43
42
  if rf = Configuration.for_if_exist?('rubyforge') then
44
43
  spec.rubyforge_project = rf.project
45
- end
44
+ end
46
45
 
47
46
  end
@@ -16,6 +16,7 @@ Logging::Appender.stdout.layout = Logging::Layouts::Pattern.new(
16
16
  )
17
17
 
18
18
  module Crate
19
+ class Error < ::StandardError; end
19
20
 
20
21
  # The root directory of the project is considered to be the parent directory
21
22
  # of the 'lib' directory.
@@ -159,7 +159,7 @@ module Crate
159
159
  def define_verify
160
160
  desc "Verify source against its checksum"
161
161
  task :verify => "#{name}:download" do
162
- if @digenst then
162
+ if @digest then
163
163
  if @digest.valid?( local_source ) then
164
164
  logger.info "#{local_source} validates against #{@digest.hex}"
165
165
  else
@@ -158,10 +158,11 @@ CRATE_BOOT_H
158
158
  def link_project
159
159
  link_options = %w[ CFLAGS XCFLAGS LDFLAGS ].collect { |c| compile_params[c] }.join(' ')
160
160
  Dir.chdir( ::Crate.ruby.pkg_dir ) do
161
- dot_a = FileList[ "**/*.a" ]
161
+ dot_a = FileList[ "ext/**/*.a" ]
162
+ dot_a << %w[ libssl.a libcrypto.a libz.a libruby-static.a ] # order is important on the last 4
162
163
  dot_o = [ "ext/extinit.o", File.join( project_root, "crate_boot.o" )]
163
164
  libs = compile_params['LIBS']
164
- cmd = "#{compile_params['CC']} #{link_options} #{dot_o.join(' ')} #{dot_a.join(' ')} -o #{File.join( dist_dir, name) }"
165
+ cmd = "#{compile_params['CC']} #{link_options} #{dot_o.join(' ')} #{libs} #{dot_a.join(' ')} -o #{File.join( dist_dir, name) }"
165
166
  logger.debug cmd
166
167
  sh cmd
167
168
  end
@@ -174,7 +175,7 @@ CRATE_BOOT_H
174
175
  lib_db = File.join( dist_dir, "lib.db" )
175
176
  app_db = File.join( dist_dir, "app.db" )
176
177
  directory dist_dir
177
- packer_cmd = "~/Projects/amalgalite/bin/amalgalite-pack"
178
+ packer_cmd = "amalgalite-pack"
178
179
 
179
180
  task :pack_ruby => dist_dir do
180
181
  prefix = File.join( ::Crate.ruby.pkg_dir, "lib" )
@@ -1,14 +1,20 @@
1
1
  require 'archive/tar/minitar'
2
2
  require 'zlib'
3
- require 'open-uri'
4
3
  require 'fileutils'
5
- require 'progressbar'
6
4
  require 'rubygems/installer'
5
+ require 'net/ftp'
6
+ require 'net/http'
7
7
 
8
8
  module Crate
9
9
  #
10
10
  # Utiltiy methods useful for many items
11
11
  module Utils
12
+
13
+ def logger
14
+ @logger ||= Logging::Logger['Crate::Utils']
15
+ end
16
+ extend self
17
+
12
18
  #
13
19
  # Changes into a directory and unpacks the archive.
14
20
  #
@@ -26,6 +32,7 @@ module Crate
26
32
  end
27
33
  end
28
34
 
35
+
29
36
  #
30
37
  # Verify the given file against a digest value. If the digest value is nil
31
38
  # then it is a no-op.
@@ -34,30 +41,63 @@ module Crate
34
41
  return ( against ? against.verify( file ) : true )
35
42
  end
36
43
 
44
+
37
45
  #
38
- # download the given URI to a specified location, show progress with a
39
- # progress bar.
46
+ # download the given URI to a specified location
40
47
  #
41
48
  def download( uri, to )
42
49
  to_dir = File.dirname( to )
43
50
  FileUtils.mkdir_p( to_dir ) unless File.directory?( to_dir )
44
51
 
45
- pbar = nil
46
- File.open( to , "w" ) do |outf|
47
- begin
48
- uri.open( :content_length_proc => lambda { |t| pbar = ::ProgressBar.new( File.basename( local_source ), t ) if t && 0 < t },
49
- :progress_proc => lambda { |s| pbar.set s if pbar } ) do |inf|
50
- outf.write inf.read
51
- end
52
- rescue => e
53
- puts
54
- STDERR.puts "Error downloading #{uri.to_s} : #{e}"
55
- exit 1
52
+ begin
53
+ case uri
54
+ when URI::FTP : download_via_ftp( uri, to )
55
+ when URI::HTTP : download_via_http( uri, to )
56
+ else
57
+ raise ::Crate::Error, "Downloading is only supported via FTP or HTTP at this time"
56
58
  end
59
+ rescue => e
60
+ puts
61
+ STDERR.puts "Error downloading #{uri.to_s} : #{e}"
62
+ exit 1
57
63
  end
58
64
  end
59
65
 
66
+
67
+ # download vi FTP
60
68
  #
69
+ def download_via_ftp( uri, to )
70
+ Net::FTP.open( uri.host ) do |ftp|
71
+ ftp.passive = true
72
+ ftp.login
73
+ ftp.getbinaryfile( uri.path, to )
74
+ end
75
+ end
76
+
77
+
78
+ # download via HTTP, following redirects
79
+ #
80
+ def download_via_http( uri, to, limit = 10 )
81
+ uri = URI.parse( uri ) unless URI === uri
82
+ raise ::Crate::Error, "Reached HTTP Redirect limit with #{uri.to_s}" if limit == 0
83
+ Net::HTTP.start( uri.host, uri.port ) do |http|
84
+ http.request_get( uri.request_uri ) do |response|
85
+ case response
86
+ when Net::HTTPSuccess then
87
+ Utils.logger.debug "success! saving to #{to}"
88
+ File.open( to, "wb" ) do |outf|
89
+ response.read_body { |bytes| outf.write bytes }
90
+ end
91
+ when Net::HTTPRedirection then
92
+ Utils.logger.debug "redirect to #{response['location']}"
93
+ download_via_http( response['location'], to, limit - 1 )
94
+ else response.error!
95
+ end
96
+ end
97
+ end
98
+ end
99
+
100
+
61
101
  # Apply the given patch file in a particular directory
62
102
  #
63
103
  def apply_patch( patch_file, location )
@@ -65,10 +105,5 @@ module Crate
65
105
  %x[ patch -p0 < #{patch_file} ]
66
106
  end
67
107
  end
68
-
69
- #
70
- # Wrap a command sending its output to the the Crate.project logger at the
71
- # debug level
72
- #
73
108
  end
74
109
  end
@@ -6,7 +6,7 @@
6
6
  module Crate
7
7
  module Version
8
8
  MAJOR = 0
9
- MINOR = 1
9
+ MINOR = 2
10
10
  BUILD = 1
11
11
 
12
12
  def to_a
@@ -45,7 +45,7 @@ if rf_conf = Configuration.for_if_exist?("rubyforge") then
45
45
  info = Utils.announcement
46
46
 
47
47
  puts "Subject : #{info[:subject]}"
48
- msg = "#{info[:title]}\n\n#{info[:urls]}\n\n#{info[:release_notes]}"
48
+ msg = "#{info[:title]}\n\n#{info[:urls]}\n\n#{info[:description]}\n\n#{info[:release_notes]}"
49
49
  puts msg
50
50
 
51
51
  rubyforge = RubyForge.new
@@ -54,7 +54,7 @@ module Utils
54
54
  #
55
55
  def release_notes_from(history_file)
56
56
  releases = {}
57
- File.read(history_file).split(/^(?==)/).each do |section|
57
+ File.read(history_file).split(/^(?=== Version)/).each do |section|
58
58
  lines = section.split("\n")
59
59
  md = %r{Version ((\w+\.)+\w+)}.match(lines.first)
60
60
  next unless md
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Hinegardner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-01 00:00:00 -07:00
12
+ date: 2009-01-18 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -18,9 +18,9 @@ dependencies:
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - ">="
21
+ - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: 0.8.1
23
+ version: 0.8.3
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: configuration
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: 0.0.5
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
- name: progressbar
36
+ name: archive-tar-minitar
37
37
  type: :runtime
38
38
  version_requirement:
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,26 +43,26 @@ dependencies:
43
43
  version: "0"
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
- name: archive-tar-minitar
46
+ name: amalgalite
47
47
  type: :runtime
48
48
  version_requirement:
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: "0"
53
+ version: "0.7"
54
54
  version:
55
55
  - !ruby/object:Gem::Dependency
56
- name: amalgalite
56
+ name: logging
57
57
  type: :runtime
58
58
  version_requirement:
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ~>
62
62
  - !ruby/object:Gem::Version
63
- version: 0.5.0
63
+ version: "0.9"
64
64
  version:
65
- description: Crate is a developer tool to help package up your application as a custom static build of the ruby interpreter plus all dependedent binary extensions. All the pure ruby code (the ruby application, the ruby stdlib, etc ) is packed into one or more SQLite databases. The final distributable pieces are a single executable and a few SQLite databases which can be then wrapped up appropriately as an OS X App; a self extracting executable for Windows; a shar archive, rpm or tarball for Unixes.
65
+ description: Crate is a developer tool to help package up your application as a custom static build of the ruby interpreter plus all dependent binary extensions. All the pure ruby code (the ruby application, the ruby stdlib, etc ) is packed into one or more SQLite databases. The final distributable pieces are a single executable and a few SQLite databases which can be then wrapped up appropriately as an OS X App; a self extracting executable for Windows; a shar archive, rpm or tarball for Unixes.
66
66
  email: jeremy@copiousfreetime.org
67
67
  executables:
68
68
  - crate
@@ -111,6 +111,7 @@ files:
111
111
  - data/recipes/openssl/openssl.rake
112
112
  - data/recipes/ruby
113
113
  - data/recipes/ruby/ext-extmk.rb.patch
114
+ - data/recipes/ruby/ext-openssl-openssl_missing.h.patch
114
115
  - data/recipes/ruby/ruby.rake
115
116
  - data/recipes/rubygems
116
117
  - data/recipes/rubygems/rubygems.rake
@@ -155,6 +156,6 @@ rubyforge_project: copiousfreetime
155
156
  rubygems_version: 1.3.1
156
157
  signing_key:
157
158
  specification_version: 2
158
- summary: Crate is a developer tool to help package up your application as a custom static build of the ruby interpreter plus all dependedent binary extensions
159
+ summary: Crate is a developer tool to help package up your application as a custom static build of the ruby interpreter plus all dependent binary extensions
159
160
  test_files: []
160
161