Class: ReapCommand
- Inherits:
-
Console::Command
- Object
- Console::Command
- ReapCommand
- Defined in:
- lib/reap/bin/reap.rb
Instance Method Summary collapse
-
#__debug ⇒ Object
(also: #_D)
debug mode (under construction).
-
#__force ⇒ Object
(also: #_f)
option to display help.
-
#__help ⇒ Object
(also: #_h)
option to display help.
- #__password(pass) ⇒ Object (also: #_p)
-
#__pretend ⇒ Object
(also: #_P)
pretend mode (under construction).
-
#__tasks ⇒ Object
(also: #_t)
option to display tasks.
-
#__verbose ⇒ Object
(also: #_V)
verbose mode.
-
#__version ⇒ Object
(also: #_v)
display reap version.
-
#_b ⇒ Object
option for build version (only for package task).
-
#default ⇒ Object
default action.
-
#help(*args) ⇒ Object
display help.
- #scaffold(name, type = nil) ⇒ Object
-
#tasks ⇒ Object
(also: #ls)
list available tasks.
-
#template ⇒ Object
copy the file from lib/data to the current dir.
-
#version ⇒ Object
display version.
Instance Method Details
#__debug ⇒ Object Also known as: _D
debug mode (under construction)
34 |
# File 'lib/reap/bin/reap.rb', line 34 def __debug; $DEBUG = true ; end |
#__force ⇒ Object Also known as: _f
option to display help
26 |
# File 'lib/reap/bin/reap.rb', line 26 def __force ; $FORCE = true ; end |
#__help ⇒ Object Also known as: _h
option to display help
45 |
# File 'lib/reap/bin/reap.rb', line 45 def __help ; help ; end |
#__password(pass) ⇒ Object Also known as: _p
37 |
# File 'lib/reap/bin/reap.rb', line 37 def __password( pass ); $PASSWORD = pass ; end |
#__pretend ⇒ Object Also known as: _P
pretend mode (under construction)
30 |
# File 'lib/reap/bin/reap.rb', line 30 def __pretend; $PRETEND = true ; end |
#__tasks ⇒ Object Also known as: _t
option to display tasks
49 |
# File 'lib/reap/bin/reap.rb', line 49 def __tasks; tasks ; end |
#__verbose ⇒ Object Also known as: _V
verbose mode
22 |
# File 'lib/reap/bin/reap.rb', line 22 def __verbose ; $VERBOSE = true ; end |
#__version ⇒ Object Also known as: _v
display reap version
41 |
# File 'lib/reap/bin/reap.rb', line 41 def __version ; version ; end |
#_b ⇒ Object
option for build version (only for package task)
53 |
# File 'lib/reap/bin/reap.rb', line 53 def _b ; $BUILD_VERSION = true ; end |
#default ⇒ Object
default action
62 63 64 |
# File 'lib/reap/bin/reap.rb', line 62 def default tasks end |
#help(*args) ⇒ Object
display help
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/reap/bin/reap.rb', line 75 def help(*args) unless args.empty? t = Reap.tasks[args[0]] s = "\n" s << "#{args[0]}: " s << t.task_desc.sub(/^\n+/, '').rstrip s << "\n\n" if thelp = t.task_help s << thelp.sub(/^\n+/, '').rstrip end s << "\n\n" puts s else puts HELP end exit 0 end |
#scaffold(name, type = nil) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/reap/bin/reap.rb', line 131 def scaffold( name, type=nil ) if File.directory?(name) and not $FORCE puts "Directory already exists. Use -f option to force scaffoling." exit -1 end case type when 'std', 'standard', nil type = 'standard' when 'svn', 'subversion' type = 'subversion' else puts "Unrecognized project type." exit -1 end # need to add gems workaround dir = File.join( ::Config::CONFIG['datadir'], 'reap', 'scaffold', type ) #FileUtils.mkdir_p( name ) FileUtils.cp_r( dir, name ) puts "Project #{name} created. Good luck with your new project!" exit 0 end |
#tasks ⇒ Object Also known as: ls
list available tasks
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/reap/bin/reap.rb', line 95 def tasks if Reap.projectfile? puts sorted_names = Reap.tasks.keys.sort margin = sorted_names.collect{ |n| n.size }.max + 6 sorted_names.each do |name| task_class = Reap.tasks[name] puts " #{name}".ljust(margin) + "#{task_class.task_desc}" end puts else puts "No project information file found." end exit 0 end |
#template ⇒ Object
copy the file from lib/data to the current dir.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/reap/bin/reap.rb', line 114 def template f = nil if ::ProjectInfo::INFO_FILES.any?{ |f| File.exists?(f) } puts "Project file '#{f}' already exists." exit 0 end filename = 'ProjectInfo' # need to add gems workaround dir = File.join( ::Config::CONFIG['datadir'], 'reap', 'scaffold', 'standard' ) f = File.join( dir, filename ) raise "ProjectInfo template file #{f} is missing." unless File.file?( f ) # copy FileUtils.install( f, '.' ) puts "#{filename} created. You'll need to fill it out." exit 0 end |