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.
10 11 12 13 14 15 16 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 10 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.
8 9 10 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 8 def branch @branch end |
#file_dependencies ⇒ Object
Returns the value of attribute file_dependencies.
8 9 10 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 8 def file_dependencies @file_dependencies end |
#files_to_copy ⇒ Object
Returns the value of attribute files_to_copy.
8 9 10 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 8 def files_to_copy @files_to_copy end |
#pinned_hash ⇒ Object
Returns the value of attribute pinned_hash.
8 9 10 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 8 def pinned_hash @pinned_hash end |
#project_name ⇒ Object
Returns the value of attribute project_name.
8 9 10 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 8 def project_name @project_name end |
Class Method Details
.from_file(path) ⇒ Object
18 19 20 21 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 18 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
27 28 29 30 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 27 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
23 24 25 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 23 def save_to_file(path) File.write(path, JSON.pretty_generate(to_hash)) end |
#to_hash ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb', line 32 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 |