more refactoring
This commit is contained in:
parent
4f88e3977f
commit
cd072c1d4c
|
@ -1,3 +1,3 @@
|
||||||
Given /^I am on the "([^"]*)" platform$/ do |os|
|
Given /^I am on the "([^"]*)" platform$/ do |os|
|
||||||
Penchant::PenchantFile.any_instance.stubs(:current_os).returns(os.to_sym)
|
Penchant::FileProcessor.any_instance.stubs(:current_os).returns(os.to_sym)
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,6 @@ module Penchant
|
||||||
autoload :Hooks, 'penchant/hooks'
|
autoload :Hooks, 'penchant/hooks'
|
||||||
autoload :Env, 'penchant/env'
|
autoload :Env, 'penchant/env'
|
||||||
autoload :FileProcessor, 'penchant/file_processor'
|
autoload :FileProcessor, 'penchant/file_processor'
|
||||||
autoload :PenchantFile, 'penchant/penchant_file'
|
|
||||||
autoload :Defaults, 'penchant/defaults'
|
autoload :Defaults, 'penchant/defaults'
|
||||||
autoload :CustomProperty, 'penchant/custom_property'
|
autoload :CustomProperty, 'penchant/custom_property'
|
||||||
autoload :PropertyStack, 'penchant/property_stack'
|
autoload :PropertyStack, 'penchant/property_stack'
|
||||||
|
|
|
@ -160,6 +160,64 @@ module Penchant
|
||||||
host_os[%r{^[a-z]+}, 1].to_sym
|
host_os[%r{^[a-z]+}, 1].to_sym
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def handle_result(data)
|
||||||
|
instance_eval(data)
|
||||||
|
end
|
||||||
|
|
||||||
|
def gem(*args)
|
||||||
|
gem_name = [ args.shift ]
|
||||||
|
template = {}
|
||||||
|
|
||||||
|
if args.last.kind_of?(::Hash)
|
||||||
|
template = args.pop
|
||||||
|
end
|
||||||
|
|
||||||
|
version = args.first
|
||||||
|
|
||||||
|
options = @properties.create_stack_for(template, @_strip_pathing_options).process_for_gem(gem_name.first, @_current_env_defaults)
|
||||||
|
|
||||||
|
args = [ gem_name.first ]
|
||||||
|
args << version if version
|
||||||
|
|
||||||
|
if options[:git]
|
||||||
|
@defined_git_repos << Penchant::Repo.new(options[:git])
|
||||||
|
end
|
||||||
|
|
||||||
|
args << options if !options.empty?
|
||||||
|
|
||||||
|
self << %{gem #{args_to_string(args)}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def gemspec
|
||||||
|
@output << %{gemspec}
|
||||||
|
end
|
||||||
|
|
||||||
|
def gems(*args)
|
||||||
|
gems, template = split_args(args)
|
||||||
|
|
||||||
|
gems.flatten.each do |gem_name|
|
||||||
|
options = @properties.create_stack_for(template, @_strip_pathing_options).process_for_gem(gem_name)
|
||||||
|
|
||||||
|
args = [ gem_name ]
|
||||||
|
args << options if !options.empty?
|
||||||
|
|
||||||
|
gem *args
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def group(*args, &block)
|
||||||
|
self << ""
|
||||||
|
self << %{group #{args_to_string(args)} do}
|
||||||
|
|
||||||
|
call_and_indent_output(block)
|
||||||
|
|
||||||
|
self << %{end}
|
||||||
|
end
|
||||||
|
|
||||||
|
def source(*args)
|
||||||
|
self << %{source #{args_to_string(args)}}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ module Penchant
|
||||||
end
|
end
|
||||||
|
|
||||||
def builder
|
def builder
|
||||||
@builder ||= PenchantFile.new(template)
|
@builder ||= FileProcessor.new(template)
|
||||||
end
|
end
|
||||||
|
|
||||||
def template
|
def template
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
module Penchant
|
|
||||||
class PenchantFile < FileProcessor
|
|
||||||
def handle_result(data)
|
|
||||||
instance_eval(data)
|
|
||||||
end
|
|
||||||
|
|
||||||
def gem(*args)
|
|
||||||
gem_name = [ args.shift ]
|
|
||||||
template = {}
|
|
||||||
|
|
||||||
if args.last.kind_of?(::Hash)
|
|
||||||
template = args.pop
|
|
||||||
end
|
|
||||||
|
|
||||||
version = args.first
|
|
||||||
|
|
||||||
options = @properties.create_stack_for(template, @_strip_pathing_options).process_for_gem(gem_name.first, @_current_env_defaults)
|
|
||||||
|
|
||||||
args = [ gem_name.first ]
|
|
||||||
args << version if version
|
|
||||||
|
|
||||||
if options[:git]
|
|
||||||
@defined_git_repos << Penchant::Repo.new(options[:git])
|
|
||||||
end
|
|
||||||
|
|
||||||
args << options if !options.empty?
|
|
||||||
|
|
||||||
self << %{gem #{args_to_string(args)}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def gemspec
|
|
||||||
@output << %{gemspec}
|
|
||||||
end
|
|
||||||
|
|
||||||
def gems(*args)
|
|
||||||
gems, template = split_args(args)
|
|
||||||
|
|
||||||
gems.flatten.each do |gem_name|
|
|
||||||
options = @properties.create_stack_for(template, @_strip_pathing_options).process_for_gem(gem_name)
|
|
||||||
|
|
||||||
args = [ gem_name ]
|
|
||||||
args << options if !options.empty?
|
|
||||||
|
|
||||||
gem *args
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def group(*args, &block)
|
|
||||||
self << ""
|
|
||||||
self << %{group #{args_to_string(args)} do}
|
|
||||||
|
|
||||||
call_and_indent_output(block)
|
|
||||||
|
|
||||||
self << %{end}
|
|
||||||
end
|
|
||||||
|
|
||||||
def source(*args)
|
|
||||||
self << %{source #{args_to_string(args)}}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
Loading…
Reference in New Issue