Class: Bucket::CLI
- Inherits:
-
Thor
- Object
- Thor
- Bucket::CLI
- Defined in:
- lib/bucket/cli.rb
Instance Method Summary collapse
- #clone(user, name) ⇒ Object
- #init(directory) ⇒ Object
-
#initialize(*args) ⇒ CLI
constructor
A new instance of CLI.
- #repos ⇒ Object
- #setup ⇒ Object
Constructor Details
#initialize(*args) ⇒ CLI
Returns a new instance of CLI.
8 9 10 11 12 |
# File 'lib/bucket/cli.rb', line 8 def initialize(*args) super @client = Bucket::Client.new load_config end |
Instance Method Details
#clone(user, name) ⇒ Object
29 30 31 |
# File 'lib/bucket/cli.rb', line 29 def clone(user, name) `git clone #{@client.repo_url(user, name)}` end |
#init(directory) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/bucket/cli.rb', line 37 def init(directory) = File.(directory) `git init #{expanded_dir}` repo = @client.create_repo([:name] || File.basename(), ) `git remote add origin #{@client.repo_url(repo[:owner], repo[:slug])}` say("Repository #{@client.repo_full_name(repo)} created.") end |
#repos ⇒ Object
22 23 24 25 26 |
# File 'lib/bucket/cli.rb', line 22 def repos @client.repos_list.each do |repo| say(@client.repo_full_name(repo)) end end |
#setup ⇒ Object
15 16 17 18 19 |
# File 'lib/bucket/cli.rb', line 15 def setup generate_config say("Configuration saved to ~/.bucket") end |