Class: OsCtl::Image::Operations::Repository::Create

Inherits:
Base
  • Object
show all
Defined in:
lib/osctl/image/operations/repository/create.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

run

Constructor Details

#initialize(repo_dir) ⇒ Create

Returns a new instance of Create.

Parameters:

  • repo_dir (String)


11
12
13
# File 'lib/osctl/image/operations/repository/create.rb', line 11

def initialize(repo_dir)
  @repo_dir = repo_dir
end

Instance Attribute Details

#repo_dirString (readonly)

Returns:

  • (String)


8
9
10
# File 'lib/osctl/image/operations/repository/create.rb', line 8

def repo_dir
  @repo_dir
end

Instance Method Details

#executeObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/osctl/image/operations/repository/create.rb', line 15

def execute
  repo = OsCtl::Repo::Local::Repository.new(repo_dir)

  unless repo.exist?
    FileUtils.mkpath(repo_dir)
    repo.create
  end

  true
end