Bones::App::Create

Public Class Methods

in_output_directory( *args ) click to toggle source
    # File lib/bones/app/create.rb, line 23
23:   def self.in_output_directory( *args )
24:     @in_output_directory ||= []
25:     @in_output_directory.concat(args.map {|str| str.to_sym})
26:     @in_output_directory
27:   end
initialize_create() click to toggle source
    # File lib/bones/app/create.rb, line 5
 5:   def self.initialize_create
 6:     synopsis 'bones create [options] <project_name>'
 7: 
 8:     summary 'create a new project from a skeleton'
 9: 
10:     description Create a new project from a Mr Bones project skeleton. The skeleton canbe the default project skeleton from the Mr Bones gem or one of the namedskeletons found in the '~/.mrbones/' folder. A git or svn repository canbe used as the skeleton if the '--repository' flag is given.
11: 
12:     option(standard_options[:directory])
13:     option(standard_options[:skeleton])
14:     option(standard_options[:repository])
15:     option(standard_options[:verbose])
16:   end

Public Instance Methods

announce() click to toggle source
    # File lib/bones/app/create.rb, line 78
78:   def announce
79:     msg = "Created '#{name}'"
80:     msg << " in directory '#{output_dir}'" if name != output_dir
81:     stdout.puts msg
82:   end
copy_files() click to toggle source
    # File lib/bones/app/create.rb, line 53
53:   def copy_files
54:     fm = FileManager.new(
55:       :source => repository || skeleton_dir,
56:       :destination => output_dir,
57:       :stdout => stdout,
58:       :stderr => stderr,
59:       :verbose => verbose?
60:     )
61: 
62:     fm.copy
63:     fm.finalize name
64:   rescue Bones::App::FileManager::Error => err
65:     FileUtils.rm_rf output_dir
66:     msg = "Could not create '#{name}'"
67:     msg << " in directory '#{output_dir}'" if name != output_dir
68:     msg << "\n\t#{err.message}"
69:     raise Error, msg
70:   rescue Exception => err
71:     FileUtils.rm_rf output_dir
72:     msg = "Could not create '#{name}'"
73:     msg << " in directory '#{output_dir}'" if name != output_dir
74:     msg << "\n\t#{err.inspect}"
75:     raise Error, msg
76:   end
fixme() click to toggle source
    # File lib/bones/app/create.rb, line 84
84:   def fixme
85:     return unless test ff, 'Rakefile'
86:     stdout.puts 'Now you need to fix these files'
87:     system "#{::Bones::RUBY} -S rake notes"
88:   end
parse( args ) click to toggle source
    # File lib/bones/app/create.rb, line 41
41:   def parse( args )
42:     opts = super args
43: 
44:     config[:name] = args.empty? ? nil : args.join('_')
45:     config[:output_dir] = name if output_dir.nil?
46: 
47:     if name.nil?
48:       stdout.puts opts
49:       exit 1
50:     end
51:   end
run() click to toggle source
    # File lib/bones/app/create.rb, line 29
29:   def run
30:     raise Error, "Output directory #{output_dir.inspect} already exists." if test ee, output_dir
31: 
32:     copy_files
33:     announce
34: 
35:     in_directory(output_dir) {
36:       self.class.in_output_directory.each {|cmd| self.send cmd}
37:       fixme
38:     }
39:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.