Class: BetaBuilder::Tasks::Configuration

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

Instance Method Summary collapse

Instance Method Details

#app_file_nameObject

Raises:

  • (ArgumentError)


63
64
65
66
67
68
69
70
# File 'lib/beta_builder.rb', line 63

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

#archive_nameObject



59
60
61
# File 'lib/beta_builder.rb', line 59

def archive_name
  app_name || target
end

#build_argumentsObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/beta_builder.rb', line 44

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

  args << " -arch \"#{arch}\"" unless arch.nil?

  args
end

#built_app_dsym_pathObject



102
103
104
# File 'lib/beta_builder.rb', line 102

def built_app_dsym_path
  "#{built_app_path}.dSYM"
end

#built_app_pathObject



80
81
82
83
84
85
86
# File 'lib/beta_builder.rb', line 80

def built_app_path
  if build_dir == :derived
    "#{derived_build_dir_from_build_output}/#{configuration}-iphoneos/#{app_file_name}"
  else
    "#{build_dir}/#{configuration}-iphoneos/#{app_file_name}"
  end
end

#deploy_using(strategy_name, &block) ⇒ Object



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

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_dir_from_build_outputObject



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/beta_builder.rb', line 88

def derived_build_dir_from_build_output
  output = File.read("build.output")
  
  # yes, this is truly horrible, but unless somebody else can find a better way...
  found = output.split("\n").grep(/^Validate(.*)\/Xcode\/DerivedData\/(.*)-(.*)/).first
  if found && found =~ /Validate \"(.*)\"/
      reference = $1 
  else 
      raise "Cannot parse build_dir from build output."
  end        
  derived_data_directory = reference.split("/Build/Products/").first
  "#{derived_data_directory}/Build/Products/"
end

#dist_pathObject



106
107
108
# File 'lib/beta_builder.rb', line 106

def dist_path
  File.join("pkg/dist")
end

#ipa_nameObject



72
73
74
75
76
77
78
# File 'lib/beta_builder.rb', line 72

def ipa_name
  if app_name
    "#{app_name}.ipa"
  else
    "#{target}.ipa"
  end
end

#ipa_pathObject



110
111
112
# File 'lib/beta_builder.rb', line 110

def ipa_path
  File.join(dist_path, ipa_name)
end

#release_notes_textObject



39
40
41
42
# File 'lib/beta_builder.rb', line 39

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