class Devinstall::Package
Public Class Methods
new(pkg, type, env)
click to toggle source
# File lib/devinstall/package.rb, line 20 def initialize(pkg, type, env) @package, @type, @env = pkg, type, env load_package_plugin(type) end
Public Instance Methods
build(pkg=@package, type=@type, env=@env)
click to toggle source
# File lib/devinstall/package.rb, line 37 def build(pkg=@package, type=@type, env=@env) puts "Building package #{pkg} type #{type}" info = get_info(pkg, type, env) builder = Provider.new(pkg, type, env, :build) builder.copy_sources builder.do_action info[:files].each do |target, file| puts "Receiving target #{target.to_s} for #{file.to_s}" builder.get_file(file) end rescue KeyNotDefinedError => e puts e.message raise "Error building #{pkg}" end
install(pkg=@package, type=@type, env=@env)
click to toggle source
# File lib/devinstall/package.rb, line 52 def install(pkg=@package, type=@type, env=@env) puts "Installing #{pkg} in #{env} environment." installer = Provider.new(pkg, type, env, :install) info = get_info(pkg, type, env) info[:to_install].each do |target| # upload each file to all targets installer.put_file(info[:files][target]) installer.do_action(info[:files][target]) end rescue KeyNotDefinedError => e puts e.message raise "Error installing #{pkg}" end
load_package_plugin(type)
click to toggle source
# File lib/devinstall/package.rb, line 15 def load_package_plugin(type) require "devinstall/package/pkg_#{type.to_s}" self.singleton_class.send(:include, Kernel.const_get('Pkg').const_get("#{type.to_s.capitalize}")) end
run_tests(pkg=@package, type=@type, env=@env)
click to toggle source
# File lib/devinstall/package.rb, line 65 def run_tests(pkg=@package, type=@type, env=@env) config=Settings.instance # check if we have the test section in the configuration file unless config.respond_to? :tests puts 'No test section in the config file.' puts 'Skipping tests' return end puts 'Running all tests' puts 'This will take some time and you have no output' tester = Provider.new(pkg, type, env, :tests) tester.copy_sources tester.do_action rescue KeyNotDefinedError => e puts e.message raise "Error testing #{pkg}" end
upload(pkg=@package, type=@type, env=@env)
click to toggle source
# File lib/devinstall/package.rb, line 25 def upload(pkg=@package, type=@type, env=@env) uploader = Provider.new(pkg, type, env, :repos) info = get_info(pkg, type, env) info[:to_upload].each do |target| puts "Uploading #{target.to_s}" uploader.put_file(info[:files][target].to_s) end rescue KeyNotDefinedError => e puts e.message raise "Error uploading #{pkg}" end