bin/gitauth in brownbeagle-gitauth-0.0.4.1 vs bin/gitauth in brownbeagle-gitauth-0.0.4.2
- old
+ new
@@ -67,11 +67,16 @@
:shell_executable => File.expand_path(gitauth_shell_path)
})
end
if options[:admin]
-
+ key_contents = File.read(options[:admin]).strip
+ if GitAuth::User.create("admin", true, key_contents)
+ puts "Default admin user added with key '#{options[:admin]}'"
+ else
+ die! "Error adding default admin user with key at '#{options[:admin]}'"
+ end
end
end
a.controller!(:web_app, "Starts the gitauth frontend using the default sintra runner", :skip_path => true)
@@ -113,15 +118,20 @@
else
die! "There was an unknown error attempting to add a user called '#{name}'"
end
end
+ a.option(:make_empty, "Initializes the repository to be empty / have an initial blank commit")
a.add("add-repo NAME [PATH=NAME]", "Creates a named repository, with an optional path on the file system") do |name, *args|
GitAuth.prepare
options = args.extract_options!
path = (args.shift || name)
- if GitAuth::Repo.create(name, path)
+ if (repo = GitAuth::Repo.create(name, path))
puts "Successfully created repository '#{name}' located at '#{path}'"
+ if options[:make_empty]
+ puts "Attempting to make empty repository"
+ repo.make_empty!
+ end
else
die! "Unable to create repository '#{name}' in location '#{path}'"
end
end
\ No newline at end of file