Sha256: e30073619d844c957e1e4f0b97619779a7b3cf892e7a8d660ee996a1ee33cc5f

Contents?: true

Size: 1.7 KB

Versions: 5

Compression:

Stored size: 1.7 KB

Contents

# -*- coding: UTF-8 -*-

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

module BuildTool; module Commands; module Recipes

    #
    # BuildCommand
    #
    class Incoming < Standard

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

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

        def initialize_options
            options.banner = "Usage: #{self.fullname} [OPTIONS]..."
            options.separator( "" )
            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)
            branch = 'build-tool-%s' % BuildTool::VERSION.recipe_version()

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

            repo.log('HEAD..%s' % branch ).each do |line|
                info( line )
            end

            if @rebase
                info( "Rebasing" )
                repo.rebase( branch, 'origin' )
            end
            return 0
        end

    end # class

end; end # module Commands::Recipes

end; # module BuildTool




Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
build-tool-0.6.2 lib/build-tool/commands/recipes/incoming.rb
build-tool-0.6.1 lib/build-tool/commands/recipes/incoming.rb
build-tool-0.6.0 lib/build-tool/commands/recipes/incoming.rb
build-tool-0.6.0.rc2 lib/build-tool/commands/recipes/incoming.rb
build-tool-0.6.0.rc1 lib/build-tool/commands/recipes/incoming.rb