Sha256: 7677513df57b4175d84d9e432d75e80cd33f1d81b152323e955e12428e73b72a

Contents?: true

Size: 951 Bytes

Versions: 7

Compression:

Stored size: 951 Bytes

Contents

module GitBundle
  class CLI
    include GitBundle::Console

    def initialize
      @errors = []
      load_repositories
    end

    def invoke(args)
      case args[0]
        when nil, '--help', 'help'
          puts `git #{args.join(' ')}`.gsub('git', 'gitb')
        when 'push'
          GitBundle::Commands::Push.new(@repositories, args[1..-1]).invoke
        else
          GitBundle::Commands::Generic.new(@repositories, args).invoke
      end
    end

    private
    def load_repositories
      @repositories = []
      if Bundler.locked_gems
        Bundler.settings.local_overrides.each do |name, path|
          spec = Bundler.locked_gems.specs.find { |s| s.name == name }
          @repositories << GitBundle::Repository.new_dependant(spec.name, path, spec.source.branch, spec.source.revision) if spec
        end
      end

      @repositories << GitBundle::Repository.new_main(File.basename(Dir.getwd), Dir.getwd)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
git-bundle-1.0.8 lib/git_bundle/cli.rb
git-bundle-1.0.7 lib/git_bundle/cli.rb
git-bundle-1.0.6 lib/git_bundle/cli.rb
git-bundle-1.0.5 lib/git_bundle/cli.rb
git-bundle-1.0.4 lib/git_bundle/cli.rb
git-bundle-1.0.3 lib/git_bundle/cli.rb
git-bundle-1.0.2 lib/git_bundle/cli.rb