class Corundum::CLI::Skelfiles
Constants
- SkelfileScope
Attributes
args[R]
Public Class Methods
new(args)
click to toggle source
# File lib/corundum/cli/skelfiles.rb, line 37 def initialize(args) @args = args end
Public Instance Methods
default_project_name()
click to toggle source
# File lib/corundum/cli/skelfiles.rb, line 63 def default_project_name File.basename(Dir.pwd) end
go()
click to toggle source
# File lib/corundum/cli/skelfiles.rb, line 85 def go parse_args skelfiles.each do |skelfile| skelfile.create!(scope) puts skelfile.message end end
options()
click to toggle source
# File lib/corundum/cli/skelfiles.rb, line 44 def options @options ||= OptionParser.new do |opti| opti.banner = "Spits out skeleton files to start a gem with.\nUsage: #$0 [options]" opti.on("-h", "--help", "This help message") do puts opti puts "Will emit these files:" puts skelfiles.map{|desc| desc.target}.join(", ") puts puts "Files are copied from the skel-files directory out of this search path:" puts Corundum.configuration_store.valise exit 0 end opti.on("-p", "--project NAME", "Sets the name of the project (defaults to dirname, i.e. '#{default_project_name}')") do |name| #ok scope.project_name = name end end end
parse_args()
click to toggle source
# File lib/corundum/cli/skelfiles.rb, line 81 def parse_args options.parse(args) end
scope()
click to toggle source
# File lib/corundum/cli/skelfiles.rb, line 67 def scope @scope ||= SkelfileScope.new(default_project_name) end
skelfiles()
click to toggle source
# File lib/corundum/cli/skelfiles.rb, line 71 def skelfiles @skelfiles ||= [ Skelfile.new( 'rakefile', 'Rakefile', Rake::Application::DEFAULT_RAKEFILES), Skelfile.new( 'simplecov', '.simplecov', %w[.simplecov] ), Skelfile.new( 'travis', '.travis.yml', %w[.travis.yml] ), Skelfile.new( 'gemspec', "#{scope.project_name}.gemspec", %w{gemspec.rb *.gemspec} ), Skelfile.new( 'gemfile', 'Gemfile', %w[Gemfile] ) ] end