Sha256: 61bd59e8c39c092f717cc762b6a0f4f455769de2f289d6743e747421dcc6e4cc

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

command :init do |c|
  c.workflow :all
  
  c.desc "Initializes a new repository in the current directory."
  c.opt :type, "Which type of repository (git, hg)", :short => '-t', :type => :string, :default => 'hg'
  
  c.on_run do |options, args|
    path = args.first ? args.first : '.'
    
    case options[:type]
    when 'hg'
      Amp::Repositories::Mercurial::LocalRepository.new(path, true, options[:global_config])
    when 'git'
      Amp::Repositories::Git::LocalRepository.new(path, true, options[:global_config])
    else
      raise "Unknown repostiory type #{options[:type].inspect}"
    end
    
    
    puts "New #{options[:type]} repository initialized."
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amp-0.5.3 lib/amp/commands/commands/init.rb