Class: FrameworkGenerate::Platform
- Inherits:
-
Object
- Object
- FrameworkGenerate::Platform
- Defined in:
- lib/framework-generate/platform.rb
Instance Attribute Summary collapse
-
#minimum_version ⇒ Object
Returns the value of attribute minimum_version.
-
#search_paths ⇒ Object
Returns the value of attribute search_paths.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
- .deployment_target(platform) ⇒ Object
- .find_platform(platforms, type) ⇒ Object
- .search_paths(platform) ⇒ Object
- .supported_platforms(platforms, is_test_target = false) ⇒ Object
Instance Method Summary collapse
- #default_search_paths ⇒ Object
-
#initialize(type = nil, minimum_version = nil, search_paths = nil) {|_self| ... } ⇒ Platform
constructor
A new instance of Platform.
- #raw_values ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(type = nil, minimum_version = nil, search_paths = nil) {|_self| ... } ⇒ Platform
Returns a new instance of Platform.
5 6 7 8 9 10 11 |
# File 'lib/framework-generate/platform.rb', line 5 def initialize(type = nil, minimum_version = nil, search_paths = nil) @type = type @minimum_version = minimum_version @search_paths = search_paths.nil? ? default_search_paths : search_paths yield(self) if block_given? end |
Instance Attribute Details
#minimum_version ⇒ Object
Returns the value of attribute minimum_version.
3 4 5 |
# File 'lib/framework-generate/platform.rb', line 3 def minimum_version @minimum_version end |
#search_paths ⇒ Object
Returns the value of attribute search_paths.
3 4 5 |
# File 'lib/framework-generate/platform.rb', line 3 def search_paths @search_paths end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/framework-generate/platform.rb', line 3 def type @type end |
Class Method Details
.deployment_target(platform) ⇒ Object
28 29 30 |
# File 'lib/framework-generate/platform.rb', line 28 def self.deployment_target(platform) platform.minimum_version end |
.find_platform(platforms, type) ⇒ Object
24 25 26 |
# File 'lib/framework-generate/platform.rb', line 24 def self.find_platform(platforms, type) platforms.find { |platform| platform.type == type } end |
.search_paths(platform) ⇒ Object
32 33 34 |
# File 'lib/framework-generate/platform.rb', line 32 def self.search_paths(platform) platform.search_paths end |
.supported_platforms(platforms, is_test_target = false) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/framework-generate/platform.rb', line 17 def self.supported_platforms(platforms, is_test_target = false) platforms .reject { |platform| is_test_target && platform.type == :watchos } .map(&:raw_values) .join(' ') end |
Instance Method Details
#default_search_paths ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/framework-generate/platform.rb', line 51 def default_search_paths case @type when :macos '$(SRCROOT)/Carthage/Build/Mac/ $(inherited)' when :ios '$(SRCROOT)/Carthage/Build/iOS/ $(inherited)' when :tvos '$(SRCROOT)/Carthage/Build/tvOS/ $(inherited)' when :watchos '$(SRCROOT)/Carthage/Build/watchOS/ $(inherited)' else abort 'platform not supported!' end end |
#raw_values ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/framework-generate/platform.rb', line 36 def raw_values case @type when :macos 'macosx' when :ios 'iphoneos iphonesimulator' when :tvos 'appletvos appletvsimulator' when :watchos 'watchos watchsimulator' else abort 'platform not supported!' end end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/framework-generate/platform.rb', line 13 def to_s "Platform<#{type}, #{minimum_version}, #{search_paths}>" end |