Class: Dandelion::Command::Init
- Inherits:
-
Base
- Object
- Base
- Dandelion::Command::Init
show all
- Defined in:
- lib/dandelion/command/init.rb
Instance Attribute Summary
Attributes inherited from Base
#config, #options, #workspace
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#adapter, command, commands, #initialize, #log, lookup
Class Method Details
.parser(options) ⇒ Object
6
7
8
9
10
|
# File 'lib/dandelion/command/init.rb', line 6
def self.parser(options)
OptionParser.new do |opts|
opts.banner = 'Usage: dandelion init <revision>'
end
end
|
Instance Method Details
#execute! ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/dandelion/command/init.rb', line 16
def execute!
raise RevisionError.new('must specify revision') if @revision.nil?
log.info("Connecting to #{adapter.to_s}")
workspace.remote_commit = workspace.lookup(@revision)
remote_commit = workspace.remote_commit
log.info("Remote revision: #{remote_commit ? remote_commit.oid : '---'}")
log.info("Local HEAD revision: #{workspace.local_commit.oid}")
end
|
#setup(args) ⇒ Object
12
13
14
|
# File 'lib/dandelion/command/init.rb', line 12
def setup(args)
@revision = args.shift
end
|