Class: BuildTool::Commands::Recipes::Incoming

Inherits:
Standard
  • Object
show all
Defined in:
lib/build-tool/commands/recipes/incoming.rb

Overview

BuildCommand

Instance Attribute Summary

Attributes inherited from Base

#cmd, #options, #parent

Instance Method Summary collapse

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, #each_option, #execute, #fullname, #initialize, #log?, #say, #setup_command, #show_help, #skip_command, #summarize, #teardown_command, #usage

Methods included from HelpText

#cmdalias, #description, included, #long_description, #name

Constructor Details

This class inherits a constructor from BuildTool::Commands::Standard

Instance Method Details

#applicable?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/build-tool/commands/recipes/incoming.rb', line 15

def applicable?
    BuildTool::Application.instance.has_recipe?
end

#do_execute(args) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/build-tool/commands/recipes/incoming.rb', line 34

def do_execute( args )
    if ( args.length != 0 )
        return usage("No arguments expected")
    end

    recipe = BuildTool::Application::instance.recipe
    repo = MJ::VCS::Git::Repository.new(recipe.global_path, $noop)

    if @fetch
        say "Fetching"
        repo.fetch("origin")
    end

    repo.log("HEAD..origin/master").each do |line|
        say line
    end

    if @rebase
        say "Rebasing"
        repo.rebase("master")
    end
    return 0
end

#initialize_optionsObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/build-tool/commands/recipes/incoming.rb', line 19

def initialize_options
    @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname}"

    @options.separator "Options:"
    @rebase = false
    @fetch = false
    options.on( "-f", "--[no-]fetch", "Fetch from origin." ) { |t|
        @fetch = t
        }
    options.on( "-r", "--[no-]rebase", "Rebase against master." ) { |t|
        @rebase = t
        }
    super
end