class Bosh::Gen::Generators::PackageSourceGenerator
Public Instance Methods
add_filenames_to_spec()
click to toggle source
# File lib/bosh/gen/generators/package_source_generator.rb, line 24 def add_filenames_to_spec current_spec = YAML.load_file(package_dir("spec")) current_spec["files"] ||= [] file_paths.each do |path| current_spec["files"] << File.join(package_name, File.basename(path)) end create_file package_dir("spec"), YAML.dump(current_spec), :force => true end
check_package()
click to toggle source
# File lib/bosh/gen/generators/package_source_generator.rb, line 19 def check_package raise Thor::Error.new("'#{package_name}' package does not yet exist; either create or fix spelling") unless File.exist?(package_dir("")) raise Thor::Error.new("'packages/#{package_name}/spec' is missing") unless File.exist?(package_dir("spec")) end
check_root_is_release()
click to toggle source
# File lib/bosh/gen/generators/package_source_generator.rb, line 13 def check_root_is_release unless File.exist?("jobs") && File.exist?("packages") raise Thor::Error.new("run inside a BOSH release project") end end
copy_files()
click to toggle source
# File lib/bosh/gen/generators/package_source_generator.rb, line 33 def copy_files source_paths << File.dirname(file_paths.first) # file_paths all in same folder file_paths.each do |path| copy_file path, source_dir(File.basename(path)) end end
packaging()
click to toggle source
Add a guess about the packaging/compilation of the file
# File lib/bosh/gen/generators/package_source_generator.rb, line 41 def packaging packaging_for_files = "" file_paths.each do |path| filename = File.basename(path) if filename =~ /^(.*)(\.tar\.gz|\.tgz)$/ package_dir = $1 # assume its a standard installable source package packaging_for_files += " tar xfz #{package_name}/#{filename} ( cd #{package_dir} ./configure --prefix=$BOSH_INSTALL_TARGET make -j${CPUS} && make install ) ".gsub(/^\s{12}/, '') end end append_file "packages/#{package_name}/packaging", packaging_for_files end
readme()
click to toggle source
# File lib/bosh/gen/generators/package_source_generator.rb, line 62 def readme if flags[:blob] say_status "readme", "Upload blobs with 'bosh upload blobs'" end end
Private Instance Methods
package_dir(path)
click to toggle source
# File lib/bosh/gen/generators/package_source_generator.rb, line 69 def package_dir(path) File.join("packages", package_name, path) end
source_dir(path)
click to toggle source
# File lib/bosh/gen/generators/package_source_generator.rb, line 73 def source_dir(path) if flags[:blob] File.join("blobs", package_name, path) else File.join("src", package_name, path) end end