libgems 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. data/ChangeLog +5811 -0
  2. data/History.txt +887 -0
  3. data/LICENSE.txt +51 -0
  4. data/README.md +87 -0
  5. data/Rakefile +113 -0
  6. data/lib/gauntlet_libgems.rb +50 -0
  7. data/lib/libgems.rb +1246 -0
  8. data/lib/libgems/builder.rb +102 -0
  9. data/lib/libgems/command.rb +534 -0
  10. data/lib/libgems/command_manager.rb +182 -0
  11. data/lib/libgems/commands/build_command.rb +53 -0
  12. data/lib/libgems/commands/cert_command.rb +86 -0
  13. data/lib/libgems/commands/check_command.rb +80 -0
  14. data/lib/libgems/commands/cleanup_command.rb +106 -0
  15. data/lib/libgems/commands/contents_command.rb +98 -0
  16. data/lib/libgems/commands/dependency_command.rb +195 -0
  17. data/lib/libgems/commands/environment_command.rb +133 -0
  18. data/lib/libgems/commands/fetch_command.rb +67 -0
  19. data/lib/libgems/commands/generate_index_command.rb +133 -0
  20. data/lib/libgems/commands/help_command.rb +172 -0
  21. data/lib/libgems/commands/install_command.rb +178 -0
  22. data/lib/libgems/commands/list_command.rb +35 -0
  23. data/lib/libgems/commands/lock_command.rb +110 -0
  24. data/lib/libgems/commands/mirror_command.rb +111 -0
  25. data/lib/libgems/commands/outdated_command.rb +33 -0
  26. data/lib/libgems/commands/owner_command.rb +75 -0
  27. data/lib/libgems/commands/pristine_command.rb +93 -0
  28. data/lib/libgems/commands/push_command.rb +56 -0
  29. data/lib/libgems/commands/query_command.rb +280 -0
  30. data/lib/libgems/commands/rdoc_command.rb +91 -0
  31. data/lib/libgems/commands/search_command.rb +31 -0
  32. data/lib/libgems/commands/server_command.rb +86 -0
  33. data/lib/libgems/commands/sources_command.rb +157 -0
  34. data/lib/libgems/commands/specification_command.rb +125 -0
  35. data/lib/libgems/commands/stale_command.rb +27 -0
  36. data/lib/libgems/commands/uninstall_command.rb +83 -0
  37. data/lib/libgems/commands/unpack_command.rb +121 -0
  38. data/lib/libgems/commands/update_command.rb +160 -0
  39. data/lib/libgems/commands/which_command.rb +86 -0
  40. data/lib/libgems/config_file.rb +345 -0
  41. data/lib/libgems/custom_require.rb +44 -0
  42. data/lib/libgems/defaults.rb +101 -0
  43. data/lib/libgems/dependency.rb +227 -0
  44. data/lib/libgems/dependency_installer.rb +286 -0
  45. data/lib/libgems/dependency_list.rb +208 -0
  46. data/lib/libgems/doc_manager.rb +242 -0
  47. data/lib/libgems/errors.rb +35 -0
  48. data/lib/libgems/exceptions.rb +91 -0
  49. data/lib/libgems/ext.rb +18 -0
  50. data/lib/libgems/ext/builder.rb +56 -0
  51. data/lib/libgems/ext/configure_builder.rb +25 -0
  52. data/lib/libgems/ext/ext_conf_builder.rb +24 -0
  53. data/lib/libgems/ext/rake_builder.rb +39 -0
  54. data/lib/libgems/format.rb +81 -0
  55. data/lib/libgems/gem_openssl.rb +92 -0
  56. data/lib/libgems/gem_path_searcher.rb +100 -0
  57. data/lib/libgems/gem_runner.rb +79 -0
  58. data/lib/libgems/gemcutter_utilities.rb +49 -0
  59. data/lib/libgems/indexer.rb +720 -0
  60. data/lib/libgems/install_update_options.rb +125 -0
  61. data/lib/libgems/installer.rb +604 -0
  62. data/lib/libgems/local_remote_options.rb +135 -0
  63. data/lib/libgems/old_format.rb +153 -0
  64. data/lib/libgems/package.rb +97 -0
  65. data/lib/libgems/package/f_sync_dir.rb +23 -0
  66. data/lib/libgems/package/tar_header.rb +266 -0
  67. data/lib/libgems/package/tar_input.rb +222 -0
  68. data/lib/libgems/package/tar_output.rb +144 -0
  69. data/lib/libgems/package/tar_reader.rb +106 -0
  70. data/lib/libgems/package/tar_reader/entry.rb +141 -0
  71. data/lib/libgems/package/tar_writer.rb +241 -0
  72. data/lib/libgems/package_task.rb +126 -0
  73. data/lib/libgems/platform.rb +183 -0
  74. data/lib/libgems/remote_fetcher.rb +414 -0
  75. data/lib/libgems/require_paths_builder.rb +18 -0
  76. data/lib/libgems/requirement.rb +153 -0
  77. data/lib/libgems/security.rb +814 -0
  78. data/lib/libgems/server.rb +872 -0
  79. data/lib/libgems/source_index.rb +597 -0
  80. data/lib/libgems/source_info_cache.rb +395 -0
  81. data/lib/libgems/source_info_cache_entry.rb +56 -0
  82. data/lib/libgems/spec_fetcher.rb +337 -0
  83. data/lib/libgems/specification.rb +1487 -0
  84. data/lib/libgems/test_utilities.rb +147 -0
  85. data/lib/libgems/text.rb +65 -0
  86. data/lib/libgems/uninstaller.rb +278 -0
  87. data/lib/libgems/user_interaction.rb +527 -0
  88. data/lib/libgems/validator.rb +240 -0
  89. data/lib/libgems/version.rb +316 -0
  90. data/lib/libgems/version_option.rb +65 -0
  91. data/lib/rbconfig/datadir.rb +20 -0
  92. data/test/bogussources.rb +8 -0
  93. data/test/data/gem-private_key.pem +27 -0
  94. data/test/data/gem-public_cert.pem +20 -0
  95. data/test/fake_certlib/openssl.rb +7 -0
  96. data/test/foo/discover.rb +0 -0
  97. data/test/gem_installer_test_case.rb +97 -0
  98. data/test/gem_package_tar_test_case.rb +132 -0
  99. data/test/gemutilities.rb +605 -0
  100. data/test/insure_session.rb +43 -0
  101. data/test/mockgemui.rb +56 -0
  102. data/test/plugin/exception/libgems_plugin.rb +2 -0
  103. data/test/plugin/load/libgems_plugin.rb +1 -0
  104. data/test/plugin/standarderror/libgems_plugin.rb +2 -0
  105. data/test/private_key.pem +27 -0
  106. data/test/public_cert.pem +20 -0
  107. data/test/rubygems_plugin.rb +21 -0
  108. data/test/simple_gem.rb +66 -0
  109. data/test/test_config.rb +12 -0
  110. data/test/test_gem.rb +780 -0
  111. data/test/test_gem_builder.rb +27 -0
  112. data/test/test_gem_command.rb +178 -0
  113. data/test/test_gem_command_manager.rb +207 -0
  114. data/test/test_gem_commands_build_command.rb +74 -0
  115. data/test/test_gem_commands_cert_command.rb +124 -0
  116. data/test/test_gem_commands_check_command.rb +18 -0
  117. data/test/test_gem_commands_contents_command.rb +156 -0
  118. data/test/test_gem_commands_dependency_command.rb +216 -0
  119. data/test/test_gem_commands_environment_command.rb +144 -0
  120. data/test/test_gem_commands_fetch_command.rb +76 -0
  121. data/test/test_gem_commands_generate_index_command.rb +135 -0
  122. data/test/test_gem_commands_install_command.rb +315 -0
  123. data/test/test_gem_commands_list_command.rb +36 -0
  124. data/test/test_gem_commands_lock_command.rb +68 -0
  125. data/test/test_gem_commands_mirror_command.rb +60 -0
  126. data/test/test_gem_commands_outdated_command.rb +40 -0
  127. data/test/test_gem_commands_owner_command.rb +105 -0
  128. data/test/test_gem_commands_pristine_command.rb +108 -0
  129. data/test/test_gem_commands_push_command.rb +81 -0
  130. data/test/test_gem_commands_query_command.rb +426 -0
  131. data/test/test_gem_commands_server_command.rb +59 -0
  132. data/test/test_gem_commands_sources_command.rb +209 -0
  133. data/test/test_gem_commands_specification_command.rb +139 -0
  134. data/test/test_gem_commands_stale_command.rb +38 -0
  135. data/test/test_gem_commands_uninstall_command.rb +83 -0
  136. data/test/test_gem_commands_unpack_command.rb +199 -0
  137. data/test/test_gem_commands_update_command.rb +207 -0
  138. data/test/test_gem_commands_which_command.rb +66 -0
  139. data/test/test_gem_config_file.rb +287 -0
  140. data/test/test_gem_dependency.rb +149 -0
  141. data/test/test_gem_dependency_installer.rb +661 -0
  142. data/test/test_gem_dependency_list.rb +230 -0
  143. data/test/test_gem_doc_manager.rb +31 -0
  144. data/test/test_gem_ext_configure_builder.rb +84 -0
  145. data/test/test_gem_ext_ext_conf_builder.rb +173 -0
  146. data/test/test_gem_ext_rake_builder.rb +81 -0
  147. data/test/test_gem_format.rb +70 -0
  148. data/test/test_gem_gem_path_searcher.rb +78 -0
  149. data/test/test_gem_gem_runner.rb +45 -0
  150. data/test/test_gem_gemcutter_utilities.rb +103 -0
  151. data/test/test_gem_indexer.rb +673 -0
  152. data/test/test_gem_install_update_options.rb +68 -0
  153. data/test/test_gem_installer.rb +857 -0
  154. data/test/test_gem_local_remote_options.rb +97 -0
  155. data/test/test_gem_package_tar_header.rb +130 -0
  156. data/test/test_gem_package_tar_input.rb +112 -0
  157. data/test/test_gem_package_tar_output.rb +97 -0
  158. data/test/test_gem_package_tar_reader.rb +46 -0
  159. data/test/test_gem_package_tar_reader_entry.rb +109 -0
  160. data/test/test_gem_package_tar_writer.rb +144 -0
  161. data/test/test_gem_package_task.rb +59 -0
  162. data/test/test_gem_platform.rb +264 -0
  163. data/test/test_gem_remote_fetcher.rb +740 -0
  164. data/test/test_gem_requirement.rb +292 -0
  165. data/test/test_gem_server.rb +356 -0
  166. data/test/test_gem_silent_ui.rb +113 -0
  167. data/test/test_gem_source_index.rb +461 -0
  168. data/test/test_gem_spec_fetcher.rb +410 -0
  169. data/test/test_gem_specification.rb +1334 -0
  170. data/test/test_gem_stream_ui.rb +218 -0
  171. data/test/test_gem_text.rb +43 -0
  172. data/test/test_gem_uninstaller.rb +146 -0
  173. data/test/test_gem_validator.rb +63 -0
  174. data/test/test_gem_version.rb +181 -0
  175. data/test/test_gem_version_option.rb +89 -0
  176. data/test/test_kernel.rb +59 -0
  177. metadata +402 -0
@@ -0,0 +1,141 @@
1
+ # encoding: utf-8
2
+ #++
3
+ # Copyright (C) 2004 Mauricio Julio Fernández Pradier
4
+ # See LICENSE.txt for additional licensing information.
5
+ #--
6
+
7
+ ##
8
+ # Class for reading entries out of a tar file
9
+
10
+ class LibGems::Package::TarReader::Entry
11
+
12
+ ##
13
+ # Header for this tar entry
14
+
15
+ attr_reader :header
16
+
17
+ ##
18
+ # Creates a new tar entry for +header+ that will be read from +io+
19
+
20
+ def initialize(header, io)
21
+ @closed = false
22
+ @header = header
23
+ @io = io
24
+ @orig_pos = @io.pos
25
+ @read = 0
26
+ end
27
+
28
+ def check_closed # :nodoc:
29
+ raise IOError, "closed #{self.class}" if closed?
30
+ end
31
+
32
+ ##
33
+ # Number of bytes read out of the tar entry
34
+
35
+ def bytes_read
36
+ @read
37
+ end
38
+
39
+ ##
40
+ # Closes the tar entry
41
+
42
+ def close
43
+ @closed = true
44
+ end
45
+
46
+ ##
47
+ # Is the tar entry closed?
48
+
49
+ def closed?
50
+ @closed
51
+ end
52
+
53
+ ##
54
+ # Are we at the end of the tar entry?
55
+
56
+ def eof?
57
+ check_closed
58
+
59
+ @read >= @header.size
60
+ end
61
+
62
+ ##
63
+ # Full name of the tar entry
64
+
65
+ def full_name
66
+ if @header.prefix != "" then
67
+ File.join @header.prefix, @header.name
68
+ else
69
+ @header.name
70
+ end
71
+ end
72
+
73
+ ##
74
+ # Read one byte from the tar entry
75
+
76
+ def getc
77
+ check_closed
78
+
79
+ return nil if @read >= @header.size
80
+
81
+ ret = @io.getc
82
+ @read += 1 if ret
83
+
84
+ ret
85
+ end
86
+
87
+ ##
88
+ # Is this tar entry a directory?
89
+
90
+ def directory?
91
+ @header.typeflag == "5"
92
+ end
93
+
94
+ ##
95
+ # Is this tar entry a file?
96
+
97
+ def file?
98
+ @header.typeflag == "0"
99
+ end
100
+
101
+ ##
102
+ # The position in the tar entry
103
+
104
+ def pos
105
+ check_closed
106
+
107
+ bytes_read
108
+ end
109
+
110
+ ##
111
+ # Reads +len+ bytes from the tar file entry, or the rest of the entry if
112
+ # nil
113
+
114
+ def read(len = nil)
115
+ check_closed
116
+
117
+ return nil if @read >= @header.size
118
+
119
+ len ||= @header.size - @read
120
+ max_read = [len, @header.size - @read].min
121
+
122
+ ret = @io.read max_read
123
+ @read += ret.size
124
+
125
+ ret
126
+ end
127
+
128
+ ##
129
+ # Rewinds to the beginning of the tar file entry
130
+
131
+ def rewind
132
+ check_closed
133
+
134
+ raise LibGems::Package::NonSeekableIO unless @io.respond_to? :pos=
135
+
136
+ @io.pos = @orig_pos
137
+ @read = 0
138
+ end
139
+
140
+ end
141
+
@@ -0,0 +1,241 @@
1
+ # -*- coding: utf-8 -*-
2
+ #--
3
+ # Copyright (C) 2004 Mauricio Julio Fernández Pradier
4
+ # See LICENSE.txt for additional licensing information.
5
+ #++
6
+
7
+ ##
8
+ # Allows writing of tar files
9
+
10
+ class LibGems::Package::TarWriter
11
+
12
+ class FileOverflow < StandardError; end
13
+
14
+ ##
15
+ # IO wrapper that allows writing a limited amount of data
16
+
17
+ class BoundedStream
18
+
19
+ ##
20
+ # Maximum number of bytes that can be written
21
+
22
+ attr_reader :limit
23
+
24
+ ##
25
+ # Number of bytes written
26
+
27
+ attr_reader :written
28
+
29
+ ##
30
+ # Wraps +io+ and allows up to +limit+ bytes to be written
31
+
32
+ def initialize(io, limit)
33
+ @io = io
34
+ @limit = limit
35
+ @written = 0
36
+ end
37
+
38
+ ##
39
+ # Writes +data+ onto the IO, raising a FileOverflow exception if the
40
+ # number of bytes will be more than #limit
41
+
42
+ def write(data)
43
+ if data.size + @written > @limit
44
+ raise FileOverflow, "You tried to feed more data than fits in the file."
45
+ end
46
+ @io.write data
47
+ @written += data.size
48
+ data.size
49
+ end
50
+
51
+ end
52
+
53
+ ##
54
+ # IO wrapper that provides only #write
55
+
56
+ class RestrictedStream
57
+
58
+ ##
59
+ # Creates a new RestrictedStream wrapping +io+
60
+
61
+ def initialize(io)
62
+ @io = io
63
+ end
64
+
65
+ ##
66
+ # Writes +data+ onto the IO
67
+
68
+ def write(data)
69
+ @io.write data
70
+ end
71
+
72
+ end
73
+
74
+ ##
75
+ # Creates a new TarWriter, yielding it if a block is given
76
+
77
+ def self.new(io)
78
+ writer = super
79
+
80
+ return writer unless block_given?
81
+
82
+ begin
83
+ yield writer
84
+ ensure
85
+ writer.close
86
+ end
87
+
88
+ nil
89
+ end
90
+
91
+ ##
92
+ # Creates a new TarWriter that will write to +io+
93
+
94
+ def initialize(io)
95
+ @io = io
96
+ @closed = false
97
+ end
98
+
99
+ ##
100
+ # Adds file +name+ with permissions +mode+, and yields an IO for writing the
101
+ # file to
102
+
103
+ def add_file(name, mode) # :yields: io
104
+ check_closed
105
+
106
+ raise LibGems::Package::NonSeekableIO unless @io.respond_to? :pos=
107
+
108
+ name, prefix = split_name name
109
+
110
+ init_pos = @io.pos
111
+ @io.write "\0" * 512 # placeholder for the header
112
+
113
+ yield RestrictedStream.new(@io) if block_given?
114
+
115
+ size = @io.pos - init_pos - 512
116
+
117
+ remainder = (512 - (size % 512)) % 512
118
+ @io.write "\0" * remainder
119
+
120
+ final_pos = @io.pos
121
+ @io.pos = init_pos
122
+
123
+ header = LibGems::Package::TarHeader.new :name => name, :mode => mode,
124
+ :size => size, :prefix => prefix
125
+
126
+ @io.write header
127
+ @io.pos = final_pos
128
+
129
+ self
130
+ end
131
+
132
+ ##
133
+ # Add file +name+ with permissions +mode+ +size+ bytes long. Yields an IO
134
+ # to write the file to.
135
+
136
+ def add_file_simple(name, mode, size) # :yields: io
137
+ check_closed
138
+
139
+ name, prefix = split_name name
140
+
141
+ header = LibGems::Package::TarHeader.new(:name => name, :mode => mode,
142
+ :size => size, :prefix => prefix).to_s
143
+
144
+ @io.write header
145
+ os = BoundedStream.new @io, size
146
+
147
+ yield os if block_given?
148
+
149
+ min_padding = size - os.written
150
+ @io.write("\0" * min_padding)
151
+
152
+ remainder = (512 - (size % 512)) % 512
153
+ @io.write("\0" * remainder)
154
+
155
+ self
156
+ end
157
+
158
+ ##
159
+ # Raises IOError if the TarWriter is closed
160
+
161
+ def check_closed
162
+ raise IOError, "closed #{self.class}" if closed?
163
+ end
164
+
165
+ ##
166
+ # Closes the TarWriter
167
+
168
+ def close
169
+ check_closed
170
+
171
+ @io.write "\0" * 1024
172
+ flush
173
+
174
+ @closed = true
175
+ end
176
+
177
+ ##
178
+ # Is the TarWriter closed?
179
+
180
+ def closed?
181
+ @closed
182
+ end
183
+
184
+ ##
185
+ # Flushes the TarWriter's IO
186
+
187
+ def flush
188
+ check_closed
189
+
190
+ @io.flush if @io.respond_to? :flush
191
+ end
192
+
193
+ ##
194
+ # Creates a new directory in the tar file +name+ with +mode+
195
+
196
+ def mkdir(name, mode)
197
+ check_closed
198
+
199
+ name, prefix = split_name(name)
200
+
201
+ header = LibGems::Package::TarHeader.new :name => name, :mode => mode,
202
+ :typeflag => "5", :size => 0,
203
+ :prefix => prefix
204
+
205
+ @io.write header
206
+
207
+ self
208
+ end
209
+
210
+ ##
211
+ # Splits +name+ into a name and prefix that can fit in the TarHeader
212
+
213
+ def split_name(name) # :nodoc:
214
+ raise LibGems::Package::TooLongFileName if name.size > 256
215
+
216
+ if name.size <= 100 then
217
+ prefix = ""
218
+ else
219
+ parts = name.split(/\//)
220
+ newname = parts.pop
221
+ nxt = ""
222
+
223
+ loop do
224
+ nxt = parts.pop
225
+ break if newname.size + 1 + nxt.size > 100
226
+ newname = nxt + "/" + newname
227
+ end
228
+
229
+ prefix = (parts + [nxt]).join "/"
230
+ name = newname
231
+
232
+ if name.size > 100 or prefix.size > 155 then
233
+ raise LibGems::Package::TooLongFileName
234
+ end
235
+ end
236
+
237
+ return name, prefix
238
+ end
239
+
240
+ end
241
+
@@ -0,0 +1,126 @@
1
+ # Copyright (c) 2003, 2004 Jim Weirich, 2009 Eric Hodel
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'libgems'
23
+ begin
24
+ gem 'rake'
25
+ rescue LibGems::LoadError
26
+ end
27
+
28
+ require 'rake/packagetask'
29
+
30
+ ##
31
+ # Create a package based upon a LibGems::Specification. LibGems packages, as well as
32
+ # zip files and tar/gzipped packages can be produced by this task.
33
+ #
34
+ # In addition to the Rake targets generated by Rake::PackageTask, a
35
+ # LibGems::PackageTask will also generate the following tasks:
36
+ #
37
+ # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.gem"</b>]
38
+ # Create a SlimGems package with the given name and version.
39
+ #
40
+ # Example using a LibGems::Specification:
41
+ #
42
+ # require 'libgems'
43
+ # require 'libgems/package_task'
44
+ #
45
+ # spec = LibGems::Specification.new do |s|
46
+ # s.platform = LibGems::Platform::RUBY
47
+ # s.summary = "Ruby based make-like utility."
48
+ # s.name = 'rake'
49
+ # s.version = PKG_VERSION
50
+ # s.requirements << 'none'
51
+ # s.require_path = 'lib'
52
+ # s.autorequire = 'rake'
53
+ # s.files = PKG_FILES
54
+ # s.description = <<-EOF
55
+ # Rake is a Make-like program implemented in Ruby. Tasks
56
+ # and dependencies are specified in standard Ruby syntax.
57
+ # EOF
58
+ # end
59
+ #
60
+ # LibGems::PackageTask.new(spec) do |pkg|
61
+ # pkg.need_zip = true
62
+ # pkg.need_tar = true
63
+ # end
64
+
65
+ class LibGems::PackageTask < Rake::PackageTask
66
+
67
+ ##
68
+ # Ruby LibGems::Specification containing the metadata for this package. The
69
+ # name, version and package_files are automatically determined from the
70
+ # gemspec and don't need to be explicitly provided.
71
+
72
+ attr_accessor :gem_spec
73
+
74
+ ##
75
+ # Create a LibGems Package task library. Automatically define the gem if a
76
+ # block is given. If no block is supplied, then #define needs to be called
77
+ # to define the task.
78
+
79
+ def initialize(gem_spec)
80
+ init gem_spec
81
+ yield self if block_given?
82
+ define if block_given?
83
+ end
84
+
85
+ ##
86
+ # Initialization tasks without the "yield self" or define operations.
87
+
88
+ def init(gem)
89
+ super gem.full_name, :noversion
90
+ @gem_spec = gem
91
+ @package_files += gem_spec.files if gem_spec.files
92
+ end
93
+
94
+ ##
95
+ # Create the Rake tasks and actions specified by this LibGems::PackageTask.
96
+ # (+define+ is automatically called if a block is given to +new+).
97
+
98
+ def define
99
+ super
100
+
101
+ task :package => [:gem]
102
+
103
+ gem_file = gem_spec.file_name
104
+ gem_path = File.join package_dir, gem_file
105
+ gem_dir = File.join package_dir, gem_spec.full_name
106
+
107
+ desc "Build the gem file #{gem_file}"
108
+ task :gem => [gem_path]
109
+
110
+ trace = Rake.application.options.trace
111
+ LibGems.configuration.verbose = trace
112
+
113
+ file gem_path => [package_dir, gem_dir] + @gem_spec.files do
114
+ chdir(gem_dir) do
115
+ when_writing "Creating #{gem_spec.file_name}" do
116
+ LibGems::Builder.new(gem_spec).build
117
+ verbose trace do
118
+ mv gem_file, '..'
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
124
+
125
+ end
126
+