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
prepare_module.
- #initialize_options ⇒ Object
- #is_module_ready?(mod) ⇒ Boolean
-
#log? ⇒ Boolean
Log this command if $noop is not active.
-
#prepare_module(mod) ⇒ Object
is_module_ready.
-
#teardown_command ⇒ Object
do_execute_module.
Methods inherited from ModuleBasedCommand
#clean, #clone, #configure, #do_execute, #fetch, #initialize, #install, #make, #rebase, #reconfigure, #remove_build_directory, #remove_source_directory, #summarize
Methods inherited from Standard
#complete_module, #complete_modules, #initialize, #log_directory, #while_logging_to
Methods inherited from Base
#<=>, #cleanup_after_vcs_access, #complete_arguments, #complete_readline, #configuration, #debug, #debug2, #do_complete, #do_execute, #each_option, #error, #execute, #fullname, #info, #initialize, #quiet, #setup_command, #setup_options, #show_help, #skip_command, #summarize, #trace, #usage, #verbose, #warn
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
67 68 69 |
# File 'lib/build-tool/commands/build.rb', line 67 def applicable? BuildTool::Application.instance.has_recipe? end |
#do_execute_module(mod) ⇒ Object
prepare_module
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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/build-tool/commands/build.rb', line 91 def do_execute_module( mod ) if not ( $noop or mod.checkedout? or @update ) # If the module is not checked out or $noop is active skip the module warn( "Module is not checked out! Use -u to check it out." ) warn( "skipped!" ) return 0 end # fetch/rebase if @update if mod.checkedout? fetch( mod, @verbose_rebase ) rebase( mod, @verbose_rebase ) else clone( mod ) end end # clean/from-scratch if @from_scratch remove_build_directory( mod ) elsif @clean clean( mod ) end # configure if @configure or @reconfigure or !mod.configured? if @reconfigure reconfigure( mod ) else # See outer if. @configure or !mod.configured? configure( mod ) end end # build if @build make( mod ) end # install if @install install( mod, true ) end end |
#initialize_options ⇒ Object
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 59 60 61 62 63 64 65 |
# File 'lib/build-tool/commands/build.rb', line 22 def . = "Usage: #{fullname} [OPTIONS]... MODULE..." .separator( "" ) .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 } @verbose_rebase = false .on( nil, "--[no-]verbose-rebase", "Show the changes applied by rebase." ) { |t| @verbose_rebase = t } super end |
#is_module_ready?(mod) ⇒ Boolean
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/build-tool/commands/build.rb', line 71 def is_module_ready?( mod ) isready = true @update && isready &= mod.ready_for_fetch @update && isready &= mod.ready_for_rebase if !@update and (@build or @install or @configure) if !mod.checkedout? 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
18 19 20 |
# File 'lib/build-tool/commands/build.rb', line 18 def log? ! $noop end |
#prepare_module(mod) ⇒ Object
is_module_ready
84 85 86 87 88 89 |
# File 'lib/build-tool/commands/build.rb', line 84 def prepare_module( mod ) isready = true @update && isready &= mod.prepare_for_fetch @update && isready &= mod.prepare_for_rebase return isready end |
#teardown_command ⇒ Object
do_execute_module
139 140 141 |
# File 'lib/build-tool/commands/build.rb', line 139 def teardown_command cleanup_after_vcs_access end |