Class: BuildTool::Commands::Build
- Inherits:
-
ModuleBasedCommand
- Object
- Base
- Standard
- ModuleBasedCommand
- BuildTool::Commands::Build
- Defined in:
- lib/build-tool/commands/build.rb
Overview
BuildCommand
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #applicable? ⇒ Boolean
-
#do_execute_module(mod) ⇒ Object
is_module_ready.
- #initialize_options ⇒ Object
- #is_module_ready?(mod) ⇒ Boolean
-
#log? ⇒ Boolean
Log this command if $noop is not active.
-
#teardown_command ⇒ Object
do_execute_module.
Methods inherited from ModuleBasedCommand
#clean, #clone, #configure, #do_execute, #fetch, #initialize, #install, #make, #rebase, #reconfigure, #summarize
Methods inherited from Standard
#complete_modules, #initialize, #log_directory, #while_logging_to
Methods inherited from Base
#<=>, #cleanup_after_vcs_access, #complete, #complete_arguments, #complete_readline_1_8, #complete_readline_1_9, #configuration, #do_complete_1_8, #do_complete_1_9, #do_execute, #each_option, #execute, #fullname, #initialize, #say, #setup_command, #show_help, #skip_command, #summarize, #usage
Methods included from HelpText
#cmdalias, #description, included, #long_description, #name
Constructor Details
This class inherits a constructor from BuildTool::Commands::ModuleBasedCommand
Instance Method Details
#applicable? ⇒ Boolean
60 61 62 |
# File 'lib/build-tool/commands/build.rb', line 60 def applicable? BuildTool::Application.instance.has_recipe? end |
#do_execute_module(mod) ⇒ Object
is_module_ready
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/build-tool/commands/build.rb', line 76 def do_execute_module( mod ) if @from_scratch or @clean clean( mod, @from_scratch ) end if @update if mod.checkedout? fetch( mod ) rebase( mod ) else clone( mod ) end end if $noop or mod.checkedout? if @configure or @reconfigure or !mod.configured? if @reconfigure reconfigure( mod ) else # See outer if. @configure or !mod.configured? configure( mod ) end end if @build make( mod ) end if @install install( mod, true ) end else logger.warn "Module is not checked out! Use -u to check it out." logger.warn "skipped!" end end |
#initialize_options ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/build-tool/commands/build.rb', line 20 def @options. = "Usage: #{Pathname.new($0).basename} #{self.fullname} [MODULES]..." @options.separator "Options:" @clean = false @configure = false @from_scratch = false @build = true @install = true @reconfigure = false @update = false .on( "--[no-]clean", "Make clean before building." ) { |t| @clean = t } .on( "--[no-]install", "Do not install" ) { |t| @install = t } .on( "--[no-]update", "Do not update from the repository" ) { |t| @update = t } .on( "-c", "--configure", "Run the configuration step again" ) { |t| @configure = true } .on( "--reconfigure", "Remove old configuration then run configuration again" ) { |t| @reconfigure = true } .on( nil, "--from-scratch", "Rebuild from scratch" ) { |t| @from_scratch = true } super end |
#is_module_ready?(mod) ⇒ Boolean
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/build-tool/commands/build.rb', line 64 def is_module_ready?( mod ) isready = true @update && isready &= mod.prepare_for_vcs_access if !@update and (@build or @install or @configure) if !mod.checkedout? logger.warn "#{mod.name}: is not checked out. Skipping (add -u for checkout)" end end @install && isready &= mod.prepare_for_installation return isready end |
#log? ⇒ Boolean
Log this command if $noop is not active
16 17 18 |
# File 'lib/build-tool/commands/build.rb', line 16 def log? ! $noop end |
#teardown_command ⇒ Object
do_execute_module
117 118 119 |
# File 'lib/build-tool/commands/build.rb', line 117 def teardown_command cleanup_after_vcs_access end |