Class: Shard::CLI::Fork

Inherits:
Object
  • Object
show all
Defined in:
lib/shard/cli/fork.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shard_line) ⇒ Fork

# Constructor #

#


19
20
21
# File 'lib/shard/cli/fork.rb', line 19

def initialize(shard_line)
  @ref = Shard::Ref(shard_line)
end

Instance Attribute Details

#refObject (readonly)

# Declarations #

#


11
12
13
# File 'lib/shard/cli/fork.rb', line 11

def ref
  @ref
end

Class Method Details

.run(shard_line) ⇒ Object

# Class Methods #

#


29
30
31
# File 'lib/shard/cli/fork.rb', line 29

def self.run(shard_line)
  new(shard_line).run
end

Instance Method Details

#runObject

# Instance Methods #

#


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/shard/cli/fork.rb', line 39

def run
  if ref.nil?
    puts "That is not a valid shard reference."
    return
  end

  if Shard::Credentials.saved? && Shard::Credentials.valid?
    fork_shard
  else
    puts "You are not currently logged into Github."
    Shard::CLI::Config.run

    if Shard::Credentials.saved?
      run
    end
  end
end