Class: BetaBuilder::Tasks::Configuration

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/beta_builder.rb

Instance Method Summary collapse

Instance Method Details

#app_bundle_pathObject



178
179
180
# File 'lib/beta_builder.rb', line 178

def app_bundle_path
  "#{ipa_destination_path}/#{app_name}.app"
end

#app_file_nameObject

Raises:

  • (ArgumentError)


83
84
85
86
87
88
89
90
# File 'lib/beta_builder.rb', line 83

def app_file_name
  raise ArgumentError, "app_name or target must be set in the BetaBuilder configuration block" if app_name.nil? && target.nil?
  if app_name
    "#{app_name}.app"
  else
    "#{target}.app"
  end
end

#app_info_plist_pathObject



92
93
94
95
96
97
98
# File 'lib/beta_builder.rb', line 92

def app_info_plist_path
  if app_info_plist != nil then 
    File.expand_path app_info_plist
  else 
    nil
  end
end

#build_argumentsObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/beta_builder.rb', line 59

def build_arguments
  args = []
  if workspace_path
    raise "A scheme is required if building from a workspace" unless scheme
    args << "-workspace '#{workspace_path}'"
    args << "-scheme '#{scheme}'"
  else
    args << "-target '#{target}'"
    args << "-project '#{project_file_path}'" if project_file_path
  end

  args << "-sdk #{sdk}"
  
  args << "-configuration '#{configuration}'"
  args << "-arch '#{arch}'" unless arch.nil?
  
  if xcodeargs
      args.concat xcodeargs if xcodeargs.is_a? Array
      args << "#{xcodeargs}" if xcodears.is_a? String
  end
  
  args
end

#build_numberObject



100
101
102
103
104
105
106
107
108
109
110
# File 'lib/beta_builder.rb', line 100

def build_number
  # no plist is found, return a nil version
  if (app_info_plist_path == nil)  || (!File.exists? app_info_plist_path) then
    return nil
  end

  # read the plist and extract data
  plist = CFPropertyList::List.new(:file => app_info_plist_path)
  data = CFPropertyList.native_types(plist.value)
  data["CFBundleVersion"]
end

#built_app_long_version_suffixObject



125
126
127
128
129
130
131
# File 'lib/beta_builder.rb', line 125

def built_app_long_version_suffix
  if build_number == nil then
    ""
  else 
    "-#{build_number}"
  end
end

#built_app_pathObject



138
139
140
141
142
143
144
# File 'lib/beta_builder.rb', line 138

def built_app_path
  if build_dir == :derived
    File.join("#{derived_build_dir}", "#{configuration}-#{sdk}", "#{app_file_name}")
  else
    File.join("#{build_dir}", "#{configuration}-#{sdk}", "#{app_file_name}")
  end
end

#built_dsym_pathObject



146
147
148
# File 'lib/beta_builder.rb', line 146

def built_dsym_path
  "#{built_app_path}.dSYM"
end

#deploy_using(strategy_name, &block) ⇒ Object



182
183
184
185
186
187
188
189
# File 'lib/beta_builder.rb', line 182

def deploy_using(strategy_name, &block)
  if DeploymentStrategies.valid_strategy?(strategy_name.to_sym)
    self.deployment_strategy = DeploymentStrategies.build(strategy_name, self)
    self.deployment_strategy.configure(&block)
  else
    raise "Unknown deployment strategy '#{strategy_name}'."
  end
end

#derived_build_dirObject



150
151
152
153
154
# File 'lib/beta_builder.rb', line 150

def derived_build_dir 
  for dir in Dir[File.join(File.expand_path("~/Library/Developer/Xcode/DerivedData"), "#{workspace_name}-*")]
    return "#{dir}/Build/Products" if File.read( File.join(dir, "info.plist") ).match workspace_path
  end
end

#derived_build_dir_from_build_outputObject



157
158
159
160
# File 'lib/beta_builder.rb', line 157

def derived_build_dir_from_build_output
  output = BuildOutputParser.new(File.read("build.output"))
  output.build_output_dir  
end

#dsym_nameObject



170
171
172
# File 'lib/beta_builder.rb', line 170

def dsym_name
  "#{app_name}#{built_app_long_version_suffix}.dSYM.zip"
end

#dsym_pathObject



174
175
176
# File 'lib/beta_builder.rb', line 174

def dsym_path
  File.join(File.expand_path(ipa_destination_path), dsym_name)
end

#ipa_nameObject



133
134
135
136
# File 'lib/beta_builder.rb', line 133

def ipa_name
  prefix = app_name == nil ? target : app_name
  "#{prefix}#{built_app_long_version_suffix}.ipa"
end

#ipa_pathObject



166
167
168
# File 'lib/beta_builder.rb', line 166

def ipa_path
  File.join(File.expand_path(ipa_destination_path), ipa_name)
end

#next_build_numberObject



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/beta_builder.rb', line 112

def next_build_number
  # if we don't have a current version, we don't have a next version :)
  if build_number == nil then
    return nil
  end

  # get a hold on the build number and increment it
  version_components = build_number.split(".")
  new_build_number = version_components.pop.to_i + 1
  version_components.push new_build_number.to_s
  version_components.join "."
end

#release_notes_textObject



54
55
56
57
# File 'lib/beta_builder.rb', line 54

def release_notes_text
  return release_notes.call if release_notes.is_a? Proc
  release_notes
end

#release_using(strategy_name, &block) ⇒ Object



191
192
193
194
195
196
197
198
199
# File 'lib/beta_builder.rb', line 191

def release_using(strategy_name, &block)
  if ReleaseStrategies.valid_strategy?(strategy_name.to_sym)
    self.release_strategy = ReleaseStrategies.build(strategy_name, self)
    self.release_strategy.configure(&block)
    self.release_strategy.prepare
  else
    raise "Unknown release strategy '#{strategy_name}'."
  end
end

#zipped_package_nameObject



162
163
164
# File 'lib/beta_builder.rb', line 162

def zipped_package_name
  "#{app_name}#{built_app_long_version_suffix}.zip"
end