Class: Wox::BuildEnvironment
- Inherits:
-
Object
- Object
- Wox::BuildEnvironment
- Defined in:
- lib/wox/build_environment.rb
Instance Attribute Summary collapse
-
#build_dir ⇒ Object
readonly
Returns the value of attribute build_dir.
-
#default_sdk ⇒ Object
readonly
Returns the value of attribute default_sdk.
-
#info_plist ⇒ Object
readonly
Returns the value of attribute info_plist.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #apply(options) {|BuildEnvironment.new @options.merge(options)| ... } ⇒ Object
- #configuration_sym ⇒ Object
- #configurations ⇒ Object
- #full_name ⇒ Object
-
#initialize(options) ⇒ BuildEnvironment
constructor
A new instance of BuildEnvironment.
- #ipa_file ⇒ Object
- #project_name ⇒ Object
- #sdks ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(options) ⇒ BuildEnvironment
Returns a new instance of BuildEnvironment.
14 15 16 17 18 19 20 21 |
# File 'lib/wox/build_environment.rb', line 14 def initialize [:info_plist] ||= 'Resources/Info.plist' [:version] ||= Plist::parse_xml([:info_plist])['CFBundleVersion'] [:build_dir] ||= 'build' [:sdk] ||= 'iphoneos' [:configuration] ||= 'Release' @options = end |
Instance Attribute Details
#build_dir ⇒ Object (readonly)
Returns the value of attribute build_dir.
12 13 14 |
# File 'lib/wox/build_environment.rb', line 12 def build_dir @build_dir end |
#default_sdk ⇒ Object (readonly)
Returns the value of attribute default_sdk.
12 13 14 |
# File 'lib/wox/build_environment.rb', line 12 def default_sdk @default_sdk end |
#info_plist ⇒ Object (readonly)
Returns the value of attribute info_plist.
12 13 14 |
# File 'lib/wox/build_environment.rb', line 12 def info_plist @info_plist end |
Instance Method Details
#[](name) ⇒ Object
51 52 53 54 |
# File 'lib/wox/build_environment.rb', line 51 def [](name) fail "You need to specify :#{name} in Rakefile" unless @options[name] @options[name] end |
#apply(options) {|BuildEnvironment.new @options.merge(options)| ... } ⇒ Object
23 24 25 |
# File 'lib/wox/build_environment.rb', line 23 def apply , &block yield BuildEnvironment.new @options.merge() end |
#configuration_sym ⇒ Object
56 57 58 |
# File 'lib/wox/build_environment.rb', line 56 def configuration_sym self[:configuration].gsub(' ', '_').downcase end |
#configurations ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/wox/build_environment.rb', line 43 def configurations @configurations ||= begin start_line = xcodebuild_list.find_index{ |l| l =~ /configurations/i } + 1 end_line = xcodebuild_list.find_index{ |l| l =~ /if no/i } - 1 xcodebuild_list.slice start_line...end_line end end |
#full_name ⇒ Object
35 36 37 |
# File 'lib/wox/build_environment.rb', line 35 def full_name "#{project_name} #{version}" end |
#ipa_file ⇒ Object
60 61 62 |
# File 'lib/wox/build_environment.rb', line 60 def ipa_file File.join self[:build_dir], "#{project_name}-#{version}-#{configuration_sym}-#{self[:ipa_name]}.ipa" end |
#project_name ⇒ Object
27 28 29 |
# File 'lib/wox/build_environment.rb', line 27 def project_name @project_name ||= xcodebuild_list.first.scan(/project\s\"([^\"]+)/i).flatten.first end |
#sdks ⇒ Object
39 40 41 |
# File 'lib/wox/build_environment.rb', line 39 def sdks @sdks ||= `xcodebuild -showsdks`.scan(/-sdk (.*?$)/m).flatten end |
#version ⇒ Object
31 32 33 |
# File 'lib/wox/build_environment.rb', line 31 def version self[:version] end |