Class: Disloku::Commands::Generate

Inherits:
BaseCommand show all
Defined in:
lib/disloku/commands/Generate.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#config, #options, #repository

Instance Method Summary collapse

Methods inherited from BaseCommand

#processGlobalOptions

Constructor Details

#initialize(cliOptions) ⇒ Generate

Returns a new instance of Generate.



8
9
10
11
12
# File 'lib/disloku/commands/Generate.rb', line 8

def initialize(cliOptions)
	super(cliOptions)

	@repository = @scmImplementation.new(cliOptions[:dir])
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
# File 'lib/disloku/commands/Generate.rb', line 14

def execute()
	repoConfig = File.join(@repository.root, 'disloku.config')
	if (File.exists?(repoConfig))
		raise DislokuError.new("disloku.config already exists in this repository")
	else
		sampleConfig = File.expand_path(File.join(File.dirname(__FILE__), "../../../config/sample.config"))
		FileUtils.cp(sampleConfig, repoConfig)
	end
end