Class: Just::CLI::Add
- Inherits:
-
Object
- Object
- Just::CLI::Add
- Includes:
- Dry::Transaction
- Defined in:
- lib/just/cli/add.rb
Instance Method Summary collapse
- #clone_repository(username_and_repo) ⇒ Object
- #ensure_destination_empty(username_and_repo) ⇒ Object
- #ensure_just_directory_exists(username_and_repo) ⇒ Object
Instance Method Details
#clone_repository(username_and_repo) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/just/cli/add.rb', line 28 def clone_repository(username_and_repo) destination = Just.path(username_and_repo) Git.clone(Just.git(username_and_repo), destination) Success(username_and_repo) end |
#ensure_destination_empty(username_and_repo) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/just/cli/add.rb', line 18 def ensure_destination_empty(username_and_repo) destination = Just.path(username_and_repo) if File.exist?(destination) && !Dir.empty?(destination) Failure("Destination already exists") else Success(username_and_repo) end end |