Sha256: 5f39ff1b13c38ffbd12799d4c1dff300244af8db19e71ee67252e7844b25ce14
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
require 'erb' require 'blazing/cli_logging' require 'grit' class Blazing::Runner include Blazing::CLILogging def initialize(config = nil, target = nil) if config @config = config @target = @config.targets.find { |t| t.name == target.to_s } || @config.default_target end end def exec(command) command_method = "#{command.gsub(':', '_')}_command" raise "Unknown Command: #{command}" unless self.respond_to? command_method self.send command_method end def init_command info("Creating an example config file in #{Blazing::DEFAULT_CONFIG_LOCATION}") info("Customize it to your needs") Dir.mkdir 'config' unless File.exists? 'config' configuration_file = ERB.new(File.read("#{Blazing::TEMPLATE_ROOT}/config.erb")).result File.open(Blazing::DEFAULT_CONFIG_LOCATION,"wb") do |f| f.puts configuration_file end end def setup_local_command repository = Grit::Repo.new(Dir.pwd) @config.targets.each do |target| info("Adding new remote #{target.name} pointing to #{target.location}") repository.config["remote.#{target.name}.url"] = target.location end end def setup_remote_command @target.setup end def update_command @target.update end def recipes_run_command @config.recipes.each { |recipe| recipe.run } end def recipes_list_command Blazing::Recipe.list.each { |r| puts r.to_s.demodulize.underscore } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blazing-0.1.1 | lib/blazing/runner.rb |