Class: Seagull::Configuration
- Inherits:
-
AppConf
- Object
- AppConf
- Seagull::Configuration
- Defined in:
- lib/seagull/configuration.rb
Instance Method Summary collapse
- #archive_file_name(override = {}) ⇒ Object
- #archive_full_path(type) ⇒ Object
-
#archive_name ⇒ Object
Accessors.
- #build_arguments(override = {}) ⇒ Object
-
#deployment(release_type, strategy_name, &block) ⇒ Object
Configuration.
- #deployment_strategy(type) ⇒ Object
- #dsym_file_name(override = {}) ⇒ Object
- #dsym_full_path(type) ⇒ Object
- #environment_for(release_type) ⇒ Object
- #full_version ⇒ Object
-
#initialize(defaults = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #ipa_file_name(override = {}) ⇒ Object
- #ipa_full_path(type) ⇒ Object
- #ipa_name ⇒ Object
- #marketing_version ⇒ Object
- #reload_version! ⇒ Object
- #version ⇒ Object
- #version_data ⇒ Object
- #version_tag ⇒ Object
Constructor Details
#initialize(defaults = {}) ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/seagull/configuration.rb', line 6 def initialize(defaults = {}) super() # Set defaults from_hash({ :configuration => {:debug => 'Debug', :beta => 'AdHoc', :release => 'Release'}, :build_dir => 'build', :auto_archive => true, :changelog_file => File.('CHANGELOG.md'), :archive_path => File.("~/Library/Developer/Xcode/Archives/#{Time.now.strftime('%Y-%m-%d')}"), :ipa_path => nil, :dsym_path => nil, :xcpretty => true, :xctool_path => "xctool", :xcodebuild_path => "xcodebuild", :workspace_path => nil, :scheme => nil, :app_name => nil, :arch => nil, :skip_clean => false, :verbose => false, :dry_run => false, :deploy => { :release_notes_items => 5, }, :release_type => :beta, :deployment_strategies => {}, }) self.load('.seagull.yml') if File.exists?(".seagull.yml") self.from_hash(defaults) end |
Instance Method Details
#archive_file_name(override = {}) ⇒ Object
62 63 64 |
# File 'lib/seagull/configuration.rb', line 62 def archive_file_name(override = {}) "#{archive_name}-#{full_version}_#{configuration.send(override.fetch(:release_type, release_type))}.xcarchive" end |
#archive_full_path(type) ⇒ Object
66 67 68 |
# File 'lib/seagull/configuration.rb', line 66 def archive_full_path(type) File.join(archive_path, archive_file_name(release_type: type)) end |
#archive_name ⇒ Object
Accessors
58 59 60 |
# File 'lib/seagull/configuration.rb', line 58 def archive_name app_name || target || scheme end |
#build_arguments(override = {}) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/seagull/configuration.rb', line 118 def build_arguments(override = {}) args = {} if workspace args[:workspace] = "#{workspace}.xcworkspace" args[:scheme] = scheme else args[:target] = target args[:project] = project_file_path if project_file_path end args[:configuration] = configuration.send(release_type) args[:arch] = arch unless arch.nil? args.merge!(override) args.collect{|k,v| "-#{k} #{Shellwords.escape(v)}"} end |
#deployment(release_type, strategy_name, &block) ⇒ Object
Configuration
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/seagull/configuration.rb', line 41 def deployment(release_type, strategy_name, &block) if DeploymentStrategies.valid_strategy?(strategy_name.to_sym) deployment_strategy = DeploymentStrategies.build(strategy_name, self) self.deployment_strategies.send("#{release_type}=", deployment_strategy) self.deployment_strategies.send("#{release_type}").configure(&block) else raise "Unknown deployment strategy '#{strategy_name}'." end end |
#deployment_strategy(type) ⇒ Object
52 53 54 55 |
# File 'lib/seagull/configuration.rb', line 52 def deployment_strategy(type) self.active_release_type = type self.deployment_strategies.send(type) end |
#dsym_file_name(override = {}) ⇒ Object
82 83 84 |
# File 'lib/seagull/configuration.rb', line 82 def dsym_file_name(override = {}) "#{archive_name}-#{full_version}_#{configuration.send(override.fetch(:release_type, release_type))}.dSYM.zip" end |
#dsym_full_path(type) ⇒ Object
86 87 88 |
# File 'lib/seagull/configuration.rb', line 86 def dsym_full_path(type) File.join(dsym_path, dsym_file_name(release_type: type)) if dsym_path end |
#environment_for(release_type) ⇒ Object
136 137 138 139 140 141 142 143 144 |
# File 'lib/seagull/configuration.rb', line 136 def environment_for(release_type) env = [] if release_type == 'release' env << 'CODE_SIGN_IDENTITY=""' env << 'CODE_SIGNING_REQUIRED=NO' end env end |
#full_version ⇒ Object
110 111 112 |
# File 'lib/seagull/configuration.rb', line 110 def full_version "#{marketing_version}-#{version}" end |
#ipa_file_name(override = {}) ⇒ Object
74 75 76 |
# File 'lib/seagull/configuration.rb', line 74 def ipa_file_name(override = {}) "#{archive_name}-#{full_version}_#{configuration.send(override.fetch(:release_type, release_type))}.ipa" end |
#ipa_full_path(type) ⇒ Object
78 79 80 |
# File 'lib/seagull/configuration.rb', line 78 def ipa_full_path(type) File.join(ipa_path, ipa_file_name(release_type: type)) if ipa_path end |
#ipa_name ⇒ Object
70 71 72 |
# File 'lib/seagull/configuration.rb', line 70 def ipa_name app_name || target || scheme end |
#marketing_version ⇒ Object
102 103 104 |
# File 'lib/seagull/configuration.rb', line 102 def marketing_version version_data[:marketing] end |
#reload_version! ⇒ Object
98 99 100 |
# File 'lib/seagull/configuration.rb', line 98 def reload_version! @version_data = nil; version_data end |
#version ⇒ Object
106 107 108 |
# File 'lib/seagull/configuration.rb', line 106 def version version_data[:version] end |
#version_data ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/seagull/configuration.rb', line 90 def version_data @version_data ||= begin vers = %x{agvtool vers -terse|tail -1}.strip mvers = %x{agvtool mvers -terse1|tail -1}.strip {marketing: mvers, version: vers} end end |
#version_tag ⇒ Object
114 115 116 |
# File 'lib/seagull/configuration.rb', line 114 def version_tag "v#{full_version}" end |