Core build Thor command
 @return [void]
971439
def build
      root = ENV['MM_ROOT'] || Dir.pwd

      raise Thor::Error, 'Error: Could not find a Middleman project config, perhaps you are in the wrong folder?' unless File.exist?(File.join(root, 'config.rb'))

      require 'middleman-core'
      require 'middleman-core/logger'
      require 'middleman-core/builder'
      require 'fileutils'

      verbose = options['verbose'] ? 0 : 1
      instrument = options['instrument']

      builder = nil
      cli_options = options

      ::Middleman::Logger.singleton(verbose, instrument)

      ::Middleman::Util.instrument 'builder.setup' do
        missing_and_changed = !options['only_changed'] && options['missing_and_changed']
        should_track_dependencies = options['only_changed'] || missing_and_changed || options['track_dependencies']
        data_collection_depth = options['data_collection_depth']

        @app = ::Middleman::Application.new do
          config[:mode] = :build
          config[:show_exceptions] = false
          config[:cli_options] = cli_options.each_with_object({}) do |(k, v), sum|
            sum[k] = v
          end
          config[:track_data_access] = should_track_dependencies
          config[:data_collection_depth] = data_collection_depth
        end

        builder = Middleman::Builder.new(@app,
                                         glob: options['glob'],
                                         dry_run: options['dry_run'],
                                         clean: options['clean'],
                                         parallel: options['parallel'],
                                         only_changed: options['only_changed'],
                                         missing_and_changed: missing_and_changed,
                                         track_dependencies: should_track_dependencies,
                                         visualize_graph: options['visualize_graph'])
        builder.thor = self
        builder.on_build_event(&method(:on_event))
      end

      ::Middleman::Util.instrument 'builder.run' do
        if builder.run!
          clean_directories! if options['clean']
          puts 'Project built successfully.'
        else
          msg = 'There were errors during this build'
          msg << ', re-run with `middleman build --verbose` to see the full exception.' unless options['verbose']
          shell.say msg, :red

          exit(1)
        end
      end
    end
440188
def start
      puts "\n******************************************************************************************************************************************\n\n"
      puts "  JumpStarting....\n".purple
      check_setup
      execute_install_command
      run_scripts_from_yaml(:run_after_install_command)
      parse_template_dir
      create_dirs
      populate_files_from_whole_templates
      populate_files_from_append_templates
      populate_files_from_line_templates
      remove_unwanted_files
      run_scripts_from_yaml(:run_after_jumpstart)
      check_for_strings_to_replace
      run_scripts_from_yaml(:run_after_string_replace)
      check_local_nginx_configuration
      exit_with_success
    end
375525
def list_tasks
      load_tasks

      # set '$thor_runner' to true to display full namespace
      $thor_runner = true

      list = [] #Thor.printable_tasks(all = true, subcommand = true)
      Thor::Base.subclasses.each do |klass|
        list += klass.printable_tasks(false) unless klass == Thor
      end
      list.sort!{ |a,b| a[0] <=> b[0] }

      title = "repo_manager tasks"
      shell.say shell.set_color(title, :blue, bold=true)
      shell.say "-" * title.size
      shell.print_table(list, :ident => 2, :truncate => true)
    end
537802
def execute!
      exit_code = begin
        # Thor accesses these streams directly rather than letting them be
        # injected, so we replace them...
        $stderr = @stderr
        $stdin = @stdin
        $stdout = @stdout

        VcoWorkflows::CLI.start(@argv)

        # Thor::Base#start does not have a return value, assume success if no
        # exception is raised.
        0
      rescue StandardError => e
        # The ruby interpreter would pipe this to STDERR and exit 1 in the
        # case of an unhandled exception
        b = e.backtrace
        b.unshift("#{b.shift}: #{e.message} (#{e.class})")
        @stderr.puts(b.map { |s| "\tfrom #{s}" }.join("\n"))
        1
      ensure
        # put them back.
        $stderr = STDERR
        $stdin = STDIN
        $stdout = STDOUT
      end
      # Proxy exit code back to the injected kernel.
      @kernel.exit(exit_code)
    end
855002
def build_parser():
    
    parser = argparse.ArgumentParser(
        description='dockerstache templating util'
    )
    parser.add_argument(
        '--output', '-o',
        help='Working directory to render dockerfile and templates',
        dest='output',
        default=None
        )
    parser.add_argument(
        '--input', '-i',
        help='Working directory containing dockerfile and script mustache templates',
        dest='input',
        default=os.getcwd()
        )
    parser.add_argument(
        '--context', '-c',
        help='JSON file containing context dictionary to render templates',
        dest='context',
        default=None
    )
    parser.add_argument(
        '--defaults', '-d',
        help='JSON file containing default context dictionary to render templates',
        dest='defaults',
        default=None
    )
    parser.add_argument(
        '--inclusive',
        help='include non .mustache files from template',
        default=False,
        action='store_true'
    )
    parser.add_argument(
        '--exclude', '-e',
        help='exclude files from template in this list',
        default=[],
        nargs='+'
    )
    opts = parser.parse_args()
    return vars(opts)
510613
def post_build_app
      command = BuildCommandGenerator.post_build

      return if command.empty?

      print_command(command, "Generated Post-Build Command") if FastlaneCore::Globals.verbose?
      FastlaneCore::CommandExecutor.execute(command: command,
                                          print_all: true,
                                      print_command: !Gym.config[:silent],
                                              error: proc do |output|
                                                ErrorHandler.handle_build_error(output)
                                              end)
    end
1178124
def _build(verbose=False):
    

    if verbose:
        print(
            _format("Building LEX/YACC modules for MOF compiler in: {0}",
                    _tabdir))

    _yacc(verbose)
    _lex(verbose)
475887
protected function buildCommand()
    {

        // Log
        $this->log('Command building started ', $this->loglevel);

        // Building the executable
        $this->realCommand = (string) $this->commandline;

        $this->additionalCmds = '';

        // Adding the source filename at the end of command, validating the existing
        // sourcefile position explicit mentioning
        if ($this->addsourcefile === true) {
            $this->realCommand .= ' ' . self::SOURCEFILE_ID;
        }

        // Setting command output redirection with content appending
        if ($this->output !== null) {
            $this->additionalCmds .= sprintf(
                ' 1>%s %s',
                $this->appendoutput ? '>' : '',
                escapeshellarg($this->output->getPath())
            );
        } elseif ($this->spawn) { // Validating the 'spawn' configuration, and redirecting the output to 'null'
            $this->additionalCmds .= sprintf(' %s', 'WIN' === $this->osvariant ? '> NUL' : '1>/dev/null');

            $this->log("For process spawning, setting Output nullification ", $this->loglevel);
        }

        // Setting command error redirection with content appending
        if ($this->error !== null) {
            $this->additionalCmds .= sprintf(
                ' 2>%s %s',
                $this->appendoutput ? '>' : '',
                escapeshellarg($this->error->getPath())
            );
        }

        // Setting the execution as a background process
        if ($this->spawn) {
            // Validating the O.S. variant
            if ('WIN' === $this->osvariant) {
                $this->additionalCmds = 'start /b ' . $this->additionalCmds; // MS Windows background process forking
            } else {
                $this->additionalCmds .= ' &'; // GNU/Linux background process forking
            }
        }

        $this->additionalCmds = rtrim($this->additionalCmds);

        // Log
        $this->log('Command built : ' . $this->realCommand . $this->additionalCmds, $this->loglevel);

        // Log
        $this->log('Command building completed ', $this->loglevel);
    }
366990
def build_commands(strategy_name, type, action_name)
      action = Arsenal.actions[action_name]

      if action
        options = action.options

        case type
        when :prerequisite
          commands = action.prerequisite_call config 
          Trooper.logger.action "Prerequisite: #{action.description}"
        else
          commands = action.call config
          Trooper.logger.action action.description
        end
        
        [commands, options]
      else
        raise MissingActionError, "Cant find action: #{action_name}"
      end
    end
356238
def run(args)
      # Ensure Omnibus related binaries are in the PATH
      ENV["PATH"] = [File.join(base_path, "bin"),
                     File.join(base_path, "embedded","bin"),
                     ENV['PATH']].join(":")

      command_to_run = args[0]

      ## when --help is run as the command itself, we need to strip off the
      ## `--` to ensure the command maps correctly.
      if command_to_run == "--help"
        command_to_run = "help"
      end

      # This piece of code checks if the argument is an option. If it is,
      # then it sets service to nil and adds the argument into the options
      # argument. This is ugly. A better solution is having a proper parser.
      # But if we are going to implement a proper parser, we might as well
      # port this to Thor rather than reinventing Thor. For now, this preserves
      # the behavior to complain and exit with an error if one attempts to invoke
      # a pcc command that does not accept an argument. Like "help".
      options = args[2..-1] || []
      if is_option?(args[1])
        options.unshift(args[1])
        service = nil
      else
        service = args[1]
      end

      # returns either hash content of command or nil
      command = retrieve_command(command_to_run)
      if command.nil?
        log "I don't know that command."
        if args.length == 2
          log "Did you mean: #{exe_name} #{service} #{command_to_run}?"
        end
        help
        Kernel.exit 1
      end

      if args.length > 1 && command[:arity] != 2
        log "The command #{command_to_run} does not accept any arguments"
        Kernel.exit 2
      end

      parse_options options
      @force_exit = false
      exit_code = 0

      run_global_pre_hooks

      # Filter args to just command and service. If you are loading
      # custom commands and need access to the command line argument,
      # use ARGV directly.
      actual_args = [command_to_run, service].reject(&:nil?)
      if command_pre_hook(*actual_args)
        method_to_call = to_method_name(command_to_run)
        begin
          ret = send(method_to_call, *actual_args)
        rescue SystemExit => e
          @force_exit = true
          ret = e.status
        end
        command_post_hook(*actual_args)
        exit_code = ret unless ret.nil?
      else
        exit_code = 8
        @force_exit = true
      end

      if @force_exit
        Kernel.exit exit_code
      else
        exit_code
      end
    end
1146462
def _build_one(self, req, output_dir, python_tag=None):
        
        # Install build deps into temporary directory (PEP 518)
        with req.build_env:
            return self._build_one_inside_env(req, output_dir,
                                              python_tag=python_tag)
441471
def build(options = {})
      @stack.reverse.inject(nil) do |backend, (klass, opts)|
        klass.new backend, @options.merge(opts).merge(options)
      end
    end
601666
def std_build_command(repo='.'):
    
    import utool as ut
    print('+**** stdbuild *******')
    print('repo = %r' % (repo,))
    if sys.platform.startswith('win32'):
        # vtool --rebuild-sver didnt work with this line
        #scriptname = './mingw_build.bat'
        scriptname = 'mingw_build.bat'
    else:
        scriptname = './unix_build.sh'
    if repo == '':
        # default to cwd
        repo = '.'
    else:
        os.chdir(repo)
    ut.assert_exists(scriptname)
    normbuild_flag = '--no-rmbuild'
    if ut.get_argflag(normbuild_flag):
        scriptname += ' ' + normbuild_flag
    # Execute build
    ut.cmd(scriptname)
    #os.system(scriptname)
    print('L**** stdbuild *******')
270816
def autobuild_arm_program(elfname, test_dir=os.path.join('firmware', 'test'), patch=True):
    

    try:
        #Build for all targets
        family = utilities.get_family('module_settings.json')
        family.for_all_targets(family.tile.short_name, lambda x: arm.build_program(family.tile, elfname, x, patch=patch))

        #Build all unit tests
        unit_test.build_units(os.path.join('firmware','test'), family.targets(family.tile.short_name))

        Alias('release', os.path.join('build', 'output'))
        Alias('test', os.path.join('build', 'test', 'output'))
        Default(['release', 'test'])

        autobuild_release(family)

        if os.path.exists('doc'):
            autobuild_documentation(family.tile)

    except IOTileException as e:
        print(e.format())
        sys.exit(1)
450493
def parse_options(options)
      options = Shellwords.split(options) unless options.is_a?(Array)
      parser = Thor::Options.new(self.class.class_options)
      parser.parse(options)
    end
833043
def build(
    c,
    clean=False,
    browse=False,
    nitpick=False,
    opts=None,
    source=None,
    target=None,
):
    
    if clean:
        _clean(c)
    if opts is None:
        opts = ""
    if nitpick:
        opts += " -n -W -T"
    cmd = "sphinx-build{0} {1} {2}".format(
        (" " + opts) if opts else "",
        source or c.sphinx.source,
        target or c.sphinx.target,
    )
    c.run(cmd, pty=True)
    if browse:
        _browse(c)
1242288
protected function __build()
    {
        $this->__generateHead();
        $this->Html->appendChild($this->Head);
        $this->Html->appendChild($this->Body);
    }