Class: PGit::Project::Add

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pgit/project/add.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Add

Returns a new instance of Add.

Raises:



10
11
12
13
14
15
# File 'lib/pgit/project/add.rb', line 10

def initialize(app)
  @app = app
  raise PGit::Error::User, 'Project path already exists. See `pgit proj update --help.`' if app.exists?

  @reuse_adder = PGit::Project::ReuseApiTokenAdder.new(app.project, app.projects)
end

Instance Attribute Details

#adderObject (readonly)

Returns the value of attribute adder.



9
10
11
# File 'lib/pgit/project/add.rb', line 9

def adder
  @adder
end

Instance Method Details

#execute!Object



17
18
19
20
21
22
23
24
25
# File 'lib/pgit/project/add.rb', line 17

def execute!
  @reuse_adder.execute!
  @adder = PGit::Project::InteractiveAdder.new(@reuse_adder.project)

  adder.execute!
  adder.save!

  puts "Successfully added the project!"
end