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, #summarize
Methods inherited from Standard
#complete_module, #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
prepare_module
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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/build-tool/commands/build.rb', line 87 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 logger.warn "Module is not checked out! Use -u to check it out." logger.warn "skipped!" return 0 end # fetch/rebase if @update if mod.checkedout? fetch( mod ) rebase( mod ) 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
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 75 76 77 78 |
# File 'lib/build-tool/commands/build.rb', line 64 def is_module_ready?( mod ) isready = true if @from_scratch and not mod.build_system_required.out_of_source logger.warn "#{mod.name}: is compiled in source. Skipping --from-scratch!" end @update && isready &= mod.ready_for_fetch @update && isready &= mod.ready_for_rebase 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 |
#prepare_module(mod) ⇒ Object
is_module_ready
80 81 82 83 84 85 |
# File 'lib/build-tool/commands/build.rb', line 80 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
135 136 137 |
# File 'lib/build-tool/commands/build.rb', line 135 def teardown_command cleanup_after_vcs_access end |