Sha256: ed488a3fe61ccf6d9f0ef664724f4add6343f5466abbf31d57e66eafc3f25d6c

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

require 'build-tool/commands'
require 'build-tool/recipe'
require 'mj/vcs/git'

module BuildTool; module Commands; module Recipes

    #
    # BuildCommand
    #
    class Fetch < Standard

        name        "incoming"
        description "Show the incoming changes to the recipe from the repository."

        def applicable?
            BuildTool::Application.instance.name != "build-tool"
        end

        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

        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()
            end

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

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

    end # class

end; end # module Commands::Recipes

end; # module BuildTool




Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
build-tool-0.3 lib/build-tool/commands/recipes/incoming.rb