Class: ConfigKit::Data::GitLoader
- Defined in:
- lib/config_kit/data/loaders/git_loader.rb
Defined Under Namespace
Classes: GitLoaderError
Instance Attribute Summary collapse
-
#clone_path ⇒ Object
readonly
Returns the value of attribute clone_path.
Attributes inherited from Loader
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(uri_kls, env, codename, app, version) ⇒ GitLoader
constructor
A new instance of GitLoader.
- #run(&block) ⇒ Object
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_path ⇒ Object (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
.loader ⇒ Object
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 |