Class: Reap::Project
- Defined in:
- lib/reap/project.rb,
lib/reap/metadata.rb,
lib/reap/settings.rb
Overview
Project
The Project class is the main class of Reap. It provides the tools for working with a project. The CLI Application class delegates to this class, for instance.
Defined Under Namespace
Constant Summary
Constants inherited from Manager
Instance Attribute Summary
Attributes included from Utilities::OptionUtils
#dryrun, #force, #trace, #verbose
Instance Method Summary collapse
-
#chdir_to_project(&block) ⇒ Object
Change directory to project’s root location, and execute block if given.
- #debug=(x) ⇒ Object
- #debug? ⇒ Boolean
-
#display_location ⇒ Object
Display the project’s root location.
- #dryrun=(x) ⇒ Object (also: #noharm=)
- #dryrun? ⇒ Boolean (also: #noharm?)
- #force=(x) ⇒ Object
- #force? ⇒ Boolean
-
#initialize(options = nil) ⇒ Project
constructor
New Project.
-
#introspect(options) ⇒ Object
Query infromation about reap settings and/or the current project.
-
#invoke(command, *args) ⇒ Object
Invoke a tool.
-
#location ⇒ Object
Location of project.
-
#metadata ⇒ Object
Project metadata.
-
#options ⇒ Object
Common options.
-
#settings ⇒ Object
(also: #configuration)
Configuration data.
- #trace=(x) ⇒ Object
- #trace? ⇒ Boolean
- #verbose=(x) ⇒ Object
- #verbose? ⇒ Boolean
Methods inherited from Manager
#announce, #announce_message, #check_load, #check_syntax, #clean, #clobber, #clobber_packages, #clobber_rdoc, #clobber_ridoc, #compiles?, #extension_directories, #extension_scripts, #extensions, #gem_clobber, #gem_install, #gem_package, #gem_uninstall, #html, #log, #log_changes, #log_notes, #make, #make_clean, #make_distclean, #make_extconf, #make_static, #package, #package_docs, #package_gem, #package_tgz, #package_zip, #prepare, #publish, #rdoc, #release, #ridoc, #rubyforge_release, #scaffold, #scaffold_rakefile, #scaffold_setup_rb, #scaffold_skeleton, #scaffold_task, #scaffold_tasks, #scm_branch, #scm_log, #scm_tag, #site_install, #site_uninstall, #spec, #spec_doc, #stamp, #stats, #svn_branch, #svn_log, #svn_tag, #test_cross, #test_load, #test_solo, #test_unit, #unfold_paragraphs
Methods included from Utilities::NetUtils
Methods included from Utilities::FileUtils
#bin?, #cd, #command_paths, #dir!, #dir?, directory!, directory?, exist!, exist?, #exists!, #exists?, #file!, #file?, #file_read, #file_write, #fileutils, #glob, #multiglob, #multiglob_r, #out_of_date?, path!, path?, #rm_r, #safe?, #stage, #stage_manifest, #tar_bzip, #tgz, #zip, #ziputils
Methods included from Utilities::ShellUtils
Constructor Details
#initialize(options = nil) ⇒ Project
New Project.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/reap/project.rb', line 16 def initialize(=nil) @options = || {} begin @location = locate raise LoadError, "no .reap configuration file" unless @location @metadata = Metadata.read(location) @settings = Settings.read(location, @metadata) rescue LoadError => e abort e..capitalize + '.' end end |
Instance Method Details
#chdir_to_project(&block) ⇒ Object
Change directory to project’s root location, and execute block if given. If a block is provided, the current directory will revert back to what it was prior to this call, otherwise it will remain changed.
91 92 93 94 95 96 97 |
# File 'lib/reap/project.rb', line 91 def chdir_to_project(&block) if block Dir.chdir(location, &block) else Dir.chdir(location) end end |
#debug=(x) ⇒ Object
59 |
# File 'lib/reap/project.rb', line 59 def debug=(x) ; ['debug'] = x ; end |
#debug? ⇒ Boolean
53 |
# File 'lib/reap/project.rb', line 53 def debug? ; ['debug'] ; end |
#display_location ⇒ Object
Display the project’s root location.
81 82 83 |
# File 'lib/reap/project.rb', line 81 def display_location puts "[#{location}]" end |
#dryrun=(x) ⇒ Object Also known as: noharm=
55 |
# File 'lib/reap/project.rb', line 55 def dryrun=(x) ; ['dryrun'] = x ; end |
#dryrun? ⇒ Boolean Also known as: noharm?
49 |
# File 'lib/reap/project.rb', line 49 def dryrun? ; ['dryrun'] ; end |
#force=(x) ⇒ Object
57 |
# File 'lib/reap/project.rb', line 57 def force=(x) ; ['force'] = x ; end |
#force? ⇒ Boolean
51 |
# File 'lib/reap/project.rb', line 51 def force? ; ['force'] ; end |
#introspect(options) ⇒ Object
Query infromation about reap settings and/or the current project.
NOTE: This would dhave been naed #inspect but for the built-in method.
110 111 112 113 114 115 116 117 118 119 |
# File 'lib/reap/project.rb', line 110 def introspect() args = ['arguments'] if args args.each do |field| puts .send(field) end else y self end end |
#invoke(command, *args) ⇒ Object
Invoke a tool.
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/reap/project.rb', line 66 def invoke(command, *args) #display_location meth = method(command) chdir_to_project do case meth.arity when 0 meth.call else meth.call(*args) end end end |
#location ⇒ Object
Location of project.
31 |
# File 'lib/reap/project.rb', line 31 def location ; @location ; end |
#metadata ⇒ Object
Project metadata.
35 |
# File 'lib/reap/project.rb', line 35 def ; @metadata ; end |
#options ⇒ Object
Common options.
47 |
# File 'lib/reap/project.rb', line 47 def ; @options ; end |
#settings ⇒ Object Also known as: configuration
Configuration data.
39 |
# File 'lib/reap/project.rb', line 39 def settings ; @settings ; end |
#trace=(x) ⇒ Object
56 |
# File 'lib/reap/project.rb', line 56 def trace=(x) ; ['trace'] = x ; end |
#trace? ⇒ Boolean
50 |
# File 'lib/reap/project.rb', line 50 def trace? ; ['trace'] ; end |
#verbose=(x) ⇒ Object
58 |
# File 'lib/reap/project.rb', line 58 def verbose=(x) ; ['verbose'] = x ; end |
#verbose? ⇒ Boolean
52 |
# File 'lib/reap/project.rb', line 52 def verbose? ; ['verbose'] ; end |