Class: Configuration
- Inherits:
-
Object
- Object
- Configuration
- Defined in:
- lib/configuration.rb
Defined Under Namespace
Classes: UserConfig
Constant Summary collapse
- @@user_config =
UserConfig.new
Instance Attribute Summary collapse
-
#carthage_resolved_dependencies ⇒ Object
readonly
Returns the value of attribute carthage_resolved_dependencies.
-
#server_uri ⇒ Object
readonly
Returns the value of attribute server_uri.
Class Method Summary collapse
Instance Method Summary collapse
- #all_framework_names ⇒ Object
-
#ensure_shell_commands ⇒ Object
Ensure, that these lazy properties are loaded before kicking off async code.
-
#initialize(shell) ⇒ Configuration
constructor
A new instance of Configuration.
- #swift_version ⇒ Object
- #to_s ⇒ Object
- #xcodebuild_version ⇒ Object
Constructor Details
#initialize(shell) ⇒ Configuration
Returns a new instance of Configuration.
20 21 22 23 24 |
# File 'lib/configuration.rb', line 20 def initialize(shell) @shell = shell initialize_cartfile_resolved initialize_cartrcfile end |
Instance Attribute Details
#carthage_resolved_dependencies ⇒ Object (readonly)
Returns the value of attribute carthage_resolved_dependencies.
14 15 16 |
# File 'lib/configuration.rb', line 14 def carthage_resolved_dependencies @carthage_resolved_dependencies end |
#server_uri ⇒ Object (readonly)
Returns the value of attribute server_uri.
14 15 16 |
# File 'lib/configuration.rb', line 14 def server_uri @server_uri end |
Class Method Details
.new_with_defaults ⇒ Object
16 17 18 |
# File 'lib/configuration.rb', line 16 def self.new_with_defaults Configuration.new(ShellWrapper.new) end |
.setup {|@@user_config| ... } ⇒ Object
10 11 12 |
# File 'lib/configuration.rb', line 10 def self.setup yield(@@user_config) end |
Instance Method Details
#all_framework_names ⇒ Object
26 27 28 |
# File 'lib/configuration.rb', line 26 def all_framework_names version_files.flat_map { |vf| vf.framework_names }.uniq.sort end |
#ensure_shell_commands ⇒ Object
Ensure, that these lazy properties are loaded before kicking off async code.
31 32 33 34 |
# File 'lib/configuration.rb', line 31 def ensure_shell_commands xcodebuild_version swift_version end |
#swift_version ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/configuration.rb', line 45 def swift_version if @swift_version.nil? swift_raw_version = @shell.swift_version @swift_version = swift_raw_version[/Apple Swift version (.*) \(/, 1] raise AppError.new, "Could not parse swift version from '#{raw_swift_version}'" if @swift_version.nil? end @swift_version end |
#to_s ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/configuration.rb', line 54 def to_s <<~EOS Xcodebuild: #{xcodebuild_version} --- Swift: #{swift_version} --- Server: #{@server_uri.to_s} --- Cartfile.resolved: #{@carthage_resolved_dependencies.join("\n")} --- Local Build Frameworks: #{framework_names_with_platforms.join("\n")} EOS end |
#xcodebuild_version ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/configuration.rb', line 36 def xcodebuild_version if @xcodebuild_version.nil? xcodebuild_raw_version = @shell.xcodebuild_version @xcodebuild_version = xcodebuild_raw_version[/Build version (.*)$/, 1] raise AppError.new, "Could not parse build version from '#{xcodebuild_raw_version}'" if @xcodebuild_version.nil? end @xcodebuild_version end |