Class: Bucket::CLI
- Inherits:
-
Thor
- Object
- Thor
- Bucket::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/bucket/cli.rb
Constant Summary collapse
- CONFIG_FILE_PATH =
"#{Dir.home}/.bucket"
Instance Method Summary collapse
- #clone(name) ⇒ Object
- #init(directory) ⇒ Object
-
#initialize(*args) ⇒ CLI
constructor
A new instance of CLI.
- #repos ⇒ Object
- #setup ⇒ Object
Constructor Details
Instance Method Details
#clone(name) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/bucket/cli.rb', line 34 def clone(name) begin repository = Git::Base.clone(@client.repo_url(name), name) say("Repository cloned to #{repository.dir}") rescue Git::GitExecuteError => e say("Could not clone repository") say(e.) end end |
#init(directory) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/bucket/cli.rb', line 48 def init(directory) = File.(directory) repository = Git::Base.init() # Create the BitBucket repository and add it to the local remotes remote_repository = @client.create_repo([:name] || File.basename(), ) remote_url = @client.repo_url("#{remote_repository[:owner]}/#{remote_repository[:slug]}") repository.add_remote("BitBucket", remote_url) say("Repository #{@client.repo_full_name(remote_repository)} with remote #{remote_url} created.") end |
#repos ⇒ Object
27 28 29 30 31 |
# File 'lib/bucket/cli.rb', line 27 def repos @client.repos_list.each do |repo| say(@client.repo_full_name(repo)) end end |
#setup ⇒ Object
20 21 22 23 24 |
# File 'lib/bucket/cli.rb', line 20 def setup generate_config say("Configuration saved to ~/.bucket") end |