Class: Fastlane::Configuration
- Inherits:
-
Object
- Object
- Fastlane::Configuration
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb,
lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb
Defined Under Namespace
Classes: FileReference
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#file_dependencies ⇒ Object
Returns the value of attribute file_dependencies.
-
#files_to_copy ⇒ Object
Returns the value of attribute files_to_copy.
-
#pinned_hash ⇒ Object
Returns the value of attribute pinned_hash.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
Class Method Summary collapse
Instance Method Summary collapse
- #add_file_to_copy(source, destination, encrypt: false) ⇒ Object
-
#initialize(params = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #save_to_file(path) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 12 13 14 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 8 def initialize(params = {}) self.project_name = params[:project_name] || Fastlane::Helper::FilesystemHelper.project_path.basename.to_s self.branch = params[:branch] || '' self.pinned_hash = params[:pinned_hash] || '' self.files_to_copy = (params[:files_to_copy] || []).map { |f| FileReference.new(f) } self.file_dependencies = params[:file_dependencies] || [] end |
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch.
6 7 8 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 6 def branch @branch end |
#file_dependencies ⇒ Object
Returns the value of attribute file_dependencies.
6 7 8 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 6 def file_dependencies @file_dependencies end |
#files_to_copy ⇒ Object
Returns the value of attribute files_to_copy.
6 7 8 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 6 def files_to_copy @files_to_copy end |
#pinned_hash ⇒ Object
Returns the value of attribute pinned_hash.
6 7 8 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 6 def pinned_hash @pinned_hash end |
#project_name ⇒ Object
Returns the value of attribute project_name.
6 7 8 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 6 def project_name @project_name end |
Class Method Details
.from_file(path) ⇒ Object
16 17 18 19 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 16 def self.from_file(path) json = JSON.parse(File.read(path), symbolize_names: true) new(json) end |
Instance Method Details
#add_file_to_copy(source, destination, encrypt: false) ⇒ Object
25 26 27 28 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 25 def add_file_to_copy(source, destination, encrypt: false) file = FileReference.new(file: source, destination: destination, encrypt: encrypt) files_to_copy << file end |
#save_to_file(path) ⇒ Object
21 22 23 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 21 def save_to_file(path) File.write(path, JSON.pretty_generate(to_hash)) end |
#to_hash ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 30 def to_hash { project_name: project_name, branch: branch, pinned_hash: pinned_hash, files_to_copy: files_to_copy.map(&:to_hash), file_dependencies: file_dependencies } end |