lib/gisha/cli.rb in gisha-0.0.3 vs lib/gisha/cli.rb in gisha-0.0.4

- old
+ new

@@ -37,27 +37,43 @@ class CreateRepositoryCommand < Clamp::Command parameter 'PATH', 'path to create repository' def execute Rugged::Repository.init_at(path, :bare) + FileUtils.cp("#{root_path}/hooks/update", "#{path}/hooks") end + + def root_path + @root_path ||= File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) + end end class DeleteRepositoryCommand < Clamp::Command parameter 'PATH', 'path to delete repository' def execute - puts "delete repository #{path}" + FileUtils.rm_rf(path) end end + class UpdateCommand < Clamp::Command + parameter 'KEY_ID', 'id to identify the key' + parameter 'PATH', 'repository path' + parameter 'REVISION', 'repository path' + + def execute + Commands::Update.new(key_id, path, revision).exec + end + end + class CLI < Clamp::Command subcommand 'keys:add', 'add new key', AddKeyCommand subcommand 'keys:del', 'delete key', DeleleteKeyCommand subcommand 'repositories:create', 'create repository', CreateRepositoryCommand subcommand 'repositories:delete', 'delete repository', DeleteRepositoryCommand subcommand 'receive', 'receive what is pushed into the repository', ReceiveCommand + subcommand 'update', 'update repository to last version', UpdateCommand end end