Class: LogicalConstruct::PackTarball

Inherits:
Mattock::Tasklib
  • Object
show all
Defined in:
lib/logical-construct/archive-tasks.rb

Instance Method Summary collapse

Instance Method Details

#defineObject



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/logical-construct/archive-tasks.rb', line 184

def define
  super
  in_namespace do
    file listfile.absolute_path => [Rake.application.rakefile, marshalling.absolute_path] + source_files do |task|
      require 'pathname'
      source_pathname = Pathname.new(unpacked_dir.absolute_path)
      files = source_files.map do |path|
        Pathname.new(path)
      end.find_all do |pathname|
        not (pathname.directory? and not pathname.children.empty?)
      end.map do |pathname|
        pathname.relative_path_from source_pathname
      end

      File::open(listfile.absolute_path, "w") do |list|
        list.write(files.join("\n"))
      end
    end

    PackTarballTask.define_task(archive.absolute_path => [marshalling.absolute_path] + source_files + [listfile.absolute_path]) do |task|
      copy_settings_to(task)
    end
    task archive.absolute_path => Rake.application.rakefile unless Rake.application.rakefile.nil?
  end
end

#resolve_configurationObject



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/logical-construct/archive-tasks.rb', line 162

def resolve_configuration
  listfile.relative_path ||= "#{basename}.list"
  unless basename.nil?
    self.unpacked_dir.relative_path ||= basename
    self.archive.relative_path ||= [basename, extension].join(".")
  end

  resolve_paths

  self.source_files ||=
    begin
      pattern = File::join(unpacked_dir.absolute_path, source_pattern)
      list = FileList[pattern]
      exclude_patterns.each do |pattern|
        list.exclude(pattern)
      end
      list
    end

  super
end