lib/fig/repository.rb in fig-0.1.16 vs lib/fig/repository.rb in fig-0.1.17
- old
+ new
@@ -40,11 +40,11 @@
def list_remote_packages
@os.download_list(@remote_repository_url)
end
- def publish_package(package_statements, package_name, version_name)
+ def publish_package(package_statements, package_name, version_name, local_only)
temp_dir = temp_dir_for_package(package_name, version_name)
@os.clear_directory(temp_dir)
fig_file = File.join(temp_dir, ".fig")
content = bundle_resources(package_statements).map do |statement|
if statement.is_a?(Publish)
@@ -61,18 +61,22 @@
archive_local = File.join(temp_dir, archive_name)
@os.download(statement.url, archive_local)
else
archive_local = statement.url
end
- @os.upload(archive_local, archive_remote, @remote_repository_user)
+ @os.upload(archive_local, archive_remote, @remote_repository_user) unless local_only
+ @os.copy(archive_local, local_dir_for_package(package_name, version_name) + "/" + archive_name)
+ if statement.is_a?(Archive)
+ @os.unpack_archive(local_dir_for_package(package_name, version_name), archive_name)
+ end
statement.class.new(archive_name).unparse('')
else
statement.unparse('')
end
end.select {|s|not s.nil?}
@os.write(fig_file, content.join("\n").strip)
- @os.upload(fig_file, remote_fig_file_for_package(package_name, version_name), @remote_repository_user)
-# update_package(package_name, version_name)
+ @os.upload(fig_file, remote_fig_file_for_package(package_name, version_name), @remote_repository_user) unless local_only
+ @os.copy(fig_file, local_fig_file_for_package(package_name, version_name))
end
def bundle_resources(package_statements)
resources = []
new_package_statements = package_statements.reject do |statement|