Module: ReleaseMe::Adapter
- Included in:
- BumpVersion
- Defined in:
- lib/release_me/adapter.rb
Instance Method Summary collapse
-
#adapter_config(project_path = Dir.pwd) ⇒ Hash
-
adapter config.
-
- #adapter_list ⇒ Object
-
#local_config(path = Dir.pwd) ⇒ Hash
Adapter settings found in the project directory.
- #version_file(adapter, path) ⇒ Object
Instance Method Details
#adapter_config(project_path = Dir.pwd) ⇒ Hash
Returns - adapter config.
10 11 12 13 14 15 16 17 18 |
# File 'lib/release_me/adapter.rb', line 10 def adapter_config(project_path = Dir.pwd) path = project_path || Dir.pwd config = local_config(path) || detect_adapter_config(path) raise 'Cannot find config' if config.nil? adapter = OpenStruct.new(config) adapter[:version_file] = version_file(adapter, path) adapter[:current_version] = current_version(adapter, adapter[:version_file]) adapter end |
#adapter_list ⇒ Object
20 21 22 |
# File 'lib/release_me/adapter.rb', line 20 def adapter_list adapters.keys end |
#local_config(path = Dir.pwd) ⇒ Hash
Returns adapter settings found in the project directory.
26 27 28 29 30 31 32 |
# File 'lib/release_me/adapter.rb', line 26 def local_config(path = Dir.pwd) file = File.join(path, '.release_me.yaml') if File.exist?(file) data = load_adapter(file) data.fetch('adapter', nil) end end |
#version_file(adapter, path) ⇒ Object
34 35 36 |
# File 'lib/release_me/adapter.rb', line 34 def version_file(adapter, path) Dir.glob(File.join(path, adapter.version_file_relative_path)).first end |