Class: ConfigKit::Data::GitLoader

Inherits:
Loader
  • Object
show all
Defined in:
lib/config_kit/data/loaders/git_loader.rb

Defined Under Namespace

Classes: GitLoaderError

Instance Attribute Summary collapse

Attributes inherited from Loader

#batch_size, #cursor, #files

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Loader

err, #file_count, #finish?, info, inherited, load, #next_batch, #next_cursor, #retrieve_files

Constructor Details

#initialize(uri_kls, env, codename, app, version) ⇒ GitLoader

Returns a new instance of GitLoader.



7
8
9
10
11
12
13
# File 'lib/config_kit/data/loaders/git_loader.rb', line 7

def initialize(uri_kls, env, codename, app, version)
  @uri_kls, @env, @codename, @app, @version = uri_kls, env, codename, app, version
  @clone_path = Dir.mktmpdir
  @file_path = "file://#{@clone_path}"
  @file_kls = URI.parse(@file_path)
  clone
end

Instance Attribute Details

#clone_pathObject (readonly)

Returns the value of attribute clone_path.



6
7
8
# File 'lib/config_kit/data/loaders/git_loader.rb', line 6

def clone_path
  @clone_path
end

Class Method Details

.loaderObject



5
# File 'lib/config_kit/data/loaders/git_loader.rb', line 5

def self.loader; "git"; end

Instance Method Details

#run(&block) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/config_kit/data/loaders/git_loader.rb', line 15

def run(&block)
  ConfigKit.logger.debug "Git is loading env(#{@env}) #{@app} from #{@uri_kls.to_s}"
  begin
    FileLoader.new(@file_kls, @env, @codename, @app, @version).run(&block)
  ensure
    FileUtils.rm_rf @clone_path
  end
end