seagull 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b8088508eb222e6dbd12ea9d61609d79374c629
4
- data.tar.gz: 29105cddf546db9ebf3f78960a378a60dcefd956
3
+ metadata.gz: 765e55b8c55b7e787bd317c7a1a862c5726d9b3a
4
+ data.tar.gz: 8cbbacd70f1a4d927610e134a764cb272a2fdbbd
5
5
  SHA512:
6
- metadata.gz: e723faa16b6e1fd0ccbfae25db8afc265d447e0cbb4dfc467df81708e749ee67498557823165372afe8b73ebffcd1ed8363377c6ef96114027cdc755faf4b406
7
- data.tar.gz: 431b6099e09a506c5b7343490ea9f96c37b87b61d7cbfc14e68074d8a0c5e4cf1438f07778cc3a233d95f04c4ad8fcf9f48e7ee4feef035f4554adf875b53663
6
+ metadata.gz: 52911a38e114fc731da3be7f4441f1cd5018c98b67b163184fe7a5ee44774b935fce9eb6004e3153daf615d2738a8d4d85fb5c406493e97cdad684062248f4fe
7
+ data.tar.gz: 4e2bac6e110ea0c1638cda9e3df83eb49c46292718234536c2609c7b01696406c219adc156164876a1ba6bbb50fde8fa6fd8b4382e397515903c5a7fba41e070
@@ -12,9 +12,9 @@ module Seagull
12
12
  :build_dir => 'build',
13
13
  :auto_archive => true,
14
14
  :changelog_file => File.expand_path('CHANGELOG.md'),
15
- :archive_path => File.expand_path("~/Library/Developer/Xcode/Archives"),
16
- :ipa_path => File.expand_path("~/Library/Developer/Xcode/Archives"),
17
- :dsym_path => File.expand_path("~/Library/Developer/Xcode/Archives"),
15
+ :archive_path => File.expand_path("~/Library/Developer/Xcode/Archives/#{Time.now.strftime('%Y-%m-%d')}"),
16
+ :ipa_path => nil,
17
+ :dsym_path => nil,
18
18
  :xcpretty => true,
19
19
  :xctool_path => "xctool",
20
20
  :xcodebuild_path => "xcodebuild",
@@ -25,18 +25,18 @@ module Seagull
25
25
  :skip_clean => false,
26
26
  :verbose => false,
27
27
  :dry_run => false,
28
-
28
+
29
29
  :deploy => {
30
30
  :release_notes_items => 5,
31
31
  },
32
32
  :release_type => :beta,
33
33
  :deployment_strategies => {},
34
34
  })
35
-
35
+
36
36
  self.load('.seagull.yml') if File.exists?(".seagull.yml")
37
37
  self.from_hash(defaults)
38
38
  end
39
-
39
+
40
40
  # Configuration
41
41
  def deployment(release_type, strategy_name, &block)
42
42
  if DeploymentStrategies.valid_strategy?(strategy_name.to_sym)
@@ -53,40 +53,40 @@ module Seagull
53
53
  self.active_release_type = type
54
54
  self.deployment_strategies.send(type)
55
55
  end
56
-
56
+
57
57
  # Accessors
58
58
  def archive_name
59
59
  app_name || target || scheme
60
60
  end
61
-
61
+
62
62
  def archive_file_name(override = {})
63
63
  "#{archive_name}-#{full_version}_#{configuration.send(override.fetch(:release_type, release_type))}.xcarchive"
64
64
  end
65
-
65
+
66
66
  def archive_full_path(type)
67
67
  File.join(archive_path, archive_file_name(release_type: type))
68
68
  end
69
-
69
+
70
70
  def ipa_name
71
71
  app_name || target || scheme
72
72
  end
73
-
73
+
74
74
  def ipa_file_name(override = {})
75
75
  "#{archive_name}-#{full_version}_#{configuration.send(override.fetch(:release_type, release_type))}.ipa"
76
76
  end
77
-
77
+
78
78
  def ipa_full_path(type)
79
- File.join(ipa_path, ipa_file_name(release_type: type))
79
+ File.join(ipa_path, ipa_file_name(release_type: type)) if ipa_path
80
80
  end
81
-
81
+
82
82
  def dsym_file_name(override = {})
83
83
  "#{archive_name}-#{full_version}_#{configuration.send(override.fetch(:release_type, release_type))}.dSYM.zip"
84
84
  end
85
-
85
+
86
86
  def dsym_full_path(type)
87
- File.join(dsym_path, dsym_file_name(release_type: type))
87
+ File.join(dsym_path, dsym_file_name(release_type: type)) if dsym_path
88
88
  end
89
-
89
+
90
90
  def version_data
91
91
  @version_data ||= begin
92
92
  vers = %x{agvtool vers -terse|tail -1}.strip
@@ -94,27 +94,27 @@ module Seagull
94
94
  {marketing: mvers, version: vers}
95
95
  end
96
96
  end
97
-
97
+
98
98
  def reload_version!
99
99
  @version_data = nil; version_data
100
100
  end
101
-
101
+
102
102
  def marketing_version
103
103
  version_data[:marketing]
104
104
  end
105
-
105
+
106
106
  def version
107
107
  version_data[:version]
108
108
  end
109
-
109
+
110
110
  def full_version
111
111
  "#{marketing_version}-#{version}"
112
112
  end
113
-
113
+
114
114
  def version_tag
115
115
  "v#{full_version}"
116
116
  end
117
-
117
+
118
118
  def build_arguments(override = {})
119
119
  args = {}
120
120
  if workspace
@@ -127,19 +127,19 @@ module Seagull
127
127
 
128
128
  args[:configuration] = configuration.send(release_type)
129
129
  args[:arch] = arch unless arch.nil?
130
-
130
+
131
131
  args.merge!(override)
132
-
132
+
133
133
  args.collect{|k,v| "-#{k} #{Shellwords.escape(v)}"}
134
134
  end
135
-
135
+
136
136
  def environment_for(release_type)
137
137
  env = []
138
138
  if release_type == 'release'
139
139
  env << 'CODE_SIGN_IDENTITY=""'
140
140
  env << 'CODE_SIGNING_REQUIRED=NO'
141
141
  end
142
-
142
+
143
143
  env
144
144
  end
145
145
  end
@@ -21,28 +21,28 @@ module Seagull
21
21
 
22
22
  def configure(&block)
23
23
  @configuration.deploy.from_hash(defaults)
24
-
24
+
25
25
  yield @configuration.deploy
26
26
  end
27
-
27
+
28
28
  def defaults
29
29
  {}
30
30
  end
31
-
31
+
32
32
  def prepare
33
33
  puts "Nothing to prepare!"
34
34
  end
35
-
35
+
36
36
  def deploy
37
37
  raise "NOT IMPLEMENTED"
38
38
  end
39
-
39
+
40
40
  def release_notes
41
41
  changelog = ::File.exists?(@configuration.changelog_file) ? ::File.read(@configuration.changelog_file) : ""
42
42
 
43
43
  parser = Vandamme::Parser.new(changelog: changelog, version_header_exp: '^\*\*?([\w\d\.-]+\.[\w\d\.-]+[a-zA-Z0-9])( \/ (\d{4}-\d{2}-\d{2}|\w+))?\*\*\n?[=-]*', format: 'markdown')
44
44
  changes = parser.parse
45
-
45
+
46
46
  changes.first(@configuration.deploy.release_notes_items).collect{|v, c| "**#{v}**\n\n#{c}" }.join("\n\n")
47
47
  end
48
48
  end
@@ -50,11 +50,11 @@ module Seagull
50
50
  private
51
51
 
52
52
  def self.strategies
53
- {:file => File, :hockeyapp => HockeyApp}
53
+ {:file => File, :hockeyapp => HockeyApp, :crashlytics => Crashlytics}
54
54
  end
55
55
  end
56
56
  end
57
57
 
58
58
  require 'seagull/deployment_strategies/file'
59
59
  require 'seagull/deployment_strategies/hockey_app'
60
-
60
+ require 'seagull/deployment_strategies/crashlytics'
@@ -0,0 +1,33 @@
1
+ require 'tempfile'
2
+ require 'json'
3
+ require 'launchy'
4
+
5
+ module Seagull
6
+ module DeploymentStrategies
7
+ class Crashlytics < DeploymentStrategy
8
+
9
+ # Nothing to prepare
10
+ def prepare
11
+ unless @configuration.deploy.crashlytics_location
12
+ if dir = ['./', 'Pods/CrashlyticsFramework'].find{|d| ::File.directory?("#{d}/Crashlytics.framework")}
13
+ @configuration.deploy.crashlytics_location = "#{dir}/Crashlytics.framework"
14
+ end
15
+ end
16
+ raise "Please provide Crashlytics location" unless ::File.directory?(@configuration.deploy.crashlytics_location)
17
+ end
18
+
19
+ def deploy
20
+ cmd = []
21
+ cmd <<"#{@configuration.deploy.crashlytics_location}/submit"
22
+ cmd << @configuration.deploy.api_key
23
+ cmd << @configuration.deploy.build_secret
24
+ cmd << "-ipaPath #{Shellwords.escape(@configuration.ipa_full_path(@configuration.active_release_type))}"
25
+
26
+ require 'pry';binding.pry
27
+ system(cmd.join(' '))
28
+ end
29
+
30
+ private
31
+ end
32
+ end
33
+ end
@@ -18,7 +18,7 @@ module Seagull
18
18
  puts "Creating #{@configuration.deploy.path}"
19
19
  FileUtils.mkpath(@configuration.deploy.path)
20
20
  end
21
-
21
+
22
22
  # Copy xcarchive
23
23
  Dir.chdir(@configuration.archive_path) do
24
24
  deploy_path = ::File.join(@configuration.deploy.path, @configuration.archive_file_name(release_type: @configuration.active_release_type) + ".zip")
@@ -26,7 +26,7 @@ module Seagull
26
26
  puts "Creating XCArchive for deployment..."
27
27
  system("/usr/bin/zip --quiet --symlinks --recurse-paths #{Shellwords.escape(deploy_path)} #{Shellwords.escape(@configuration.archive_file_name(release_type: @configuration.active_release_type))}")
28
28
  end
29
-
29
+
30
30
  [
31
31
  @configuration.ipa_full_path(@configuration.active_release_type),
32
32
  @configuration.dsym_full_path(@configuration.active_release_type),
@@ -34,10 +34,10 @@ module Seagull
34
34
  puts "Copying #{::File.basename(f)} for deployment..."
35
35
  FileUtils.cp_r f, @configuration.deploy.path
36
36
  end
37
-
37
+
38
38
  puts "Deployed to #{@configuration.deploy.path}/#{@configuration.archive_file_name(release_type: @configuration.active_release_type)}"
39
39
  end
40
-
40
+
41
41
  private
42
42
  end
43
43
  end
@@ -5,7 +5,7 @@ require 'launchy'
5
5
  module Seagull
6
6
  module DeploymentStrategies
7
7
  class HockeyApp < DeploymentStrategy
8
-
8
+
9
9
  def defaults
10
10
  {
11
11
  :allow_download => true,
@@ -14,11 +14,11 @@ module Seagull
14
14
  :tags => '',
15
15
  }
16
16
  end
17
-
17
+
18
18
  # Nothing to prepare
19
19
  def prepare
20
20
  end
21
-
21
+
22
22
  def deploy
23
23
  # Create response file
24
24
  response_file = Tempfile.new('seagull_deploy_hockey')
@@ -35,7 +35,7 @@ module Seagull
35
35
  repository_url: %x{git remote -v|grep fetch|awk '{print $2;}'}.strip,
36
36
  }
37
37
  opts = payload.collect{|k,v| "-F #{k}=#{Shellwords.escape(v)}"}.join(" ")
38
-
38
+
39
39
  puts "Uploading to Hockeyapp... Please wait..."
40
40
  system("curl #{opts} -o #{response_file.path} -H 'X-HockeyAppToken: #{@configuration.deploy.token}' https://rink.hockeyapp.net/api/2/apps/#{@configuration.deploy.appid}/app_versions/upload")
41
41
 
@@ -54,7 +54,7 @@ module Seagull
54
54
  ensure
55
55
  response_file.unlink
56
56
  end
57
-
57
+
58
58
  private
59
59
  end
60
60
  end
@@ -10,9 +10,9 @@ module Seagull
10
10
  def initialize(namespace = '', &block)
11
11
  @configuration = Configuration.new
12
12
  @namespace = namespace
13
-
13
+
14
14
  yield @configuration if block_given?
15
-
15
+
16
16
  # Check we can find our xctool
17
17
  unless File.executable?(%x{which #{@configuration.xctool_path}}.strip)
18
18
  raise "xctool is required. Please install using Homebrew: brew install xctool."
@@ -21,10 +21,10 @@ module Seagull
21
21
  unless File.executable?(%x{which #{@configuration.xcodebuild_path}}.strip)
22
22
  raise "xcodebuild is required. Please install XCode."
23
23
  end
24
-
24
+
25
25
  define
26
26
  end
27
-
27
+
28
28
  private
29
29
  def define
30
30
  if @namespace and !@namespace.empty?
@@ -35,7 +35,7 @@ module Seagull
35
35
  define_tasks
36
36
  end
37
37
  end
38
-
38
+
39
39
  def define_tasks
40
40
  task :clean do
41
41
  unless @configuration.skip_clean
@@ -47,17 +47,17 @@ module Seagull
47
47
  task test: [] do
48
48
  xctool @configuration.build_arguments(configuration: @configuration.configuration.debug, arch: 'i386', sdk: 'iphonesimulator'), "clean", "test", "-freshInstall", "-freshSimulator"
49
49
  end
50
-
50
+
51
51
  # File dependencies
52
52
  @configuration.configuration.to_hash.each do |type, conf|
53
53
  file @configuration.archive_full_path(type) do
54
54
  xcodebuild @configuration.build_arguments(configuration: conf), "archive", "-archivePath", Shellwords.escape(@configuration.archive_full_path(type)), @configuration.environment_for(type)
55
55
  end
56
-
56
+
57
57
  file @configuration.ipa_full_path(type) => @configuration.archive_full_path(type) do
58
58
  xcodebuild "-exportArchive", "-exportFormat", "ipa", "-archivePath", Shellwords.escape(@configuration.archive_full_path(type)), "-exportPath", Shellwords.escape(@configuration.ipa_full_path(type))
59
59
  end
60
-
60
+
61
61
  file @configuration.dsym_full_path(type) => @configuration.archive_full_path(type) do
62
62
  dsym_path = File.expand_path(Dir["#{@configuration.archive_full_path(type)}/dSYMS/*"].first)
63
63
  Dir.chdir dsym_path do
@@ -65,67 +65,77 @@ module Seagull
65
65
  end
66
66
  end
67
67
  end
68
-
68
+
69
69
  ['beta', 'release'].each do |type|
70
70
  namespace(type) do
71
71
  desc "Archive the #{type} version as an XCArchive file"
72
72
  task archive: [@configuration.archive_full_path(type)]
73
-
73
+
74
74
  desc "Package the #{type} version as an IPA file"
75
75
  task package: [@configuration.ipa_full_path(type), @configuration.dsym_full_path(type)]
76
-
76
+
77
77
  if @configuration.deployment_strategies
78
+ prepare_reqs = []
79
+ prepare_reqs << (type == 'beta' ? 'git:verify:dirty' : 'git:verify')
80
+ prepare_reqs << :package unless @configuration.ipa_path.nil? and @configuration.dsym_path.nil?
81
+
78
82
  desc "Prepare your app for deployment"
79
- task prepare: ['git:verify', :package] do
80
- @configuration.deployment_strategy(type).prepare
83
+ task prepare: prepare_reqs do
84
+ if @configuration.deployment_strategy(type)
85
+ @configuration.deployment_strategy(type).prepare
86
+ end
81
87
  end
82
-
88
+
83
89
  desc "Deploy the beta using your chosen deployment strategy"
84
90
  task deploy: [:prepare] do
85
- @configuration.deployment_strategy(type).deploy
91
+ if @configuration.deployment_strategy(type)
92
+ @configuration.deployment_strategy(type).deploy
93
+ end
86
94
  end
87
-
95
+
88
96
  desc "Deploy the last build"
89
- task redeploy: [:prepre, :deploy]
97
+ task redeploy: [:prepare, :deploy]
90
98
  end
91
-
99
+
92
100
  end
93
-
101
+
94
102
  desc "Build, package and deploy beta build"
95
- task type => ["#{type}:deploy"] do
103
+ task type do
104
+ Rake::Task["version:bump"].invoke(type)
105
+ Rake::Task["#{type}:deploy"].invoke
96
106
  end
97
107
  end
98
-
108
+
99
109
  # Version control
100
110
  namespace(:version) do
101
111
  desc "Bumps build number"
102
- task bump: ['git:verify:dirty'] do
112
+ task :bump, [:type] => ['git:verify:dirty'] do |t, args|
103
113
  sh("agvtool bump -all")
104
114
  @configuration.reload_version!
105
-
115
+
106
116
  # Edit changelog
107
117
  Rake::Task["changelog:edit"].invoke
108
118
  Rake::Task["version:commit"].invoke
109
- Rake::Task["version:tag"].invoke
119
+ Rake::Task["version:tag"].invoke if args[:type] == 'release' or args[:type].nil?
110
120
  end
111
-
121
+
112
122
  task :tag do
113
123
  current_tag = %x{git describe --exact-match `git rev-parse HEAD` 2>/dev/null}.strip
114
124
  unless current_tag == @configuration.version_tag
115
125
  sh("git tag -m 'Released version #{@configuration.full_version}' -s '#{@configuration.version_tag}'")
116
126
  end
117
127
  end
118
-
128
+
119
129
  task :commit do
120
130
  ver_files = %x{git status --porcelain}.split("\n").collect{|a| Shellwords.escape(a.gsub(/[ AM\?]+ (.*)/, '\1'))}
121
-
131
+
122
132
  Dir.chdir(git_directory) do
123
133
  sh("git add #{ver_files.join(' ')}")
124
134
  sh("git commit -m 'Bumped version to #{@configuration.full_version}' #{ver_files.join(' ')}")
125
135
  end
126
136
  end
127
137
  end
128
-
138
+
129
139
  namespace(:changelog) do
130
140
  desc "Edit changelog for current version"
131
141
  task :edit do
@@ -137,11 +147,11 @@ module Seagull
137
147
 
138
148
  tag = %x{git describe --exact-match `git rev-parse HEAD` 2>/dev/null}.strip
139
149
  tag_date = Date.parse(%x{git log -1 --format=%ai #{tag}})
140
-
150
+
141
151
  # Parse current changelog
142
152
  parser = Vandamme::Parser.new(changelog: changelog, version_header_exp: '^\*\*?([\w\d\.-]+\.[\w\d\.-]+[a-zA-Z0-9])( \/ (\d{4}-\d{2}-\d{2}|\w+))?\*\*\n?[=-]*', format: 'markdown')
143
153
  changes = parser.parse
144
-
154
+
145
155
  # Write entry to changelog
146
156
  File.open('CHANGELOG.md', 'w') do |io|
147
157
  unless changes.keys.include?(@configuration.full_version)
@@ -157,7 +167,7 @@ module Seagull
157
167
  sh("#{ENV['EDITOR']} CHANGELOG.md")
158
168
  end
159
169
  end
160
-
170
+
161
171
  namespace(:git) do
162
172
  namespace(:verify) do
163
173
  # Verify GIT tag
@@ -172,7 +182,7 @@ module Seagull
172
182
  fail unless ENV['IGNORE_GIT_TAG']
173
183
  end
174
184
  end
175
-
185
+
176
186
  # Verify dirty
177
187
  task :dirty do
178
188
  unless %x{git status -s --ignore-submodules=dirty 2> /dev/null}.empty?
@@ -180,12 +190,12 @@ module Seagull
180
190
  puts Term::ANSIColor.red("!!! Current GIT tree is dirty. Please commit changes before building release.")
181
191
  puts "Or specify IGNORE_GIT_DIRTY=1 environmental variable to skip this check."
182
192
  puts ""
183
-
193
+
184
194
  fail unless ENV['IGNORE_GIT_DIRTY']
185
195
  end
186
196
  end
187
197
  end
188
-
198
+
189
199
  task verify: ['verify:tag', 'verify:dirty']
190
200
  end
191
201
  end
@@ -197,7 +207,7 @@ module Seagull
197
207
  def xcodebuild(*args)
198
208
  sh("#{@configuration.xcodebuild_path} #{args.join(" ")} | xcpretty -c; exit ${PIPESTATUS[0]}")
199
209
  end
200
-
210
+
201
211
  def git_directory
202
212
  original_cwd = Dir.pwd
203
213
 
@@ -208,9 +218,9 @@ module Seagull
208
218
  end
209
219
 
210
220
  Dir.chdir(original_cwd) and return if Pathname.new(Dir.pwd).root?
211
-
221
+
212
222
  Dir.chdir('..')
213
223
  end
214
224
  end
215
225
  end
216
- end
226
+ end
@@ -2,7 +2,7 @@ module Seagull
2
2
  class Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seagull
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikko Kokkonen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-31 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -165,6 +165,7 @@ files:
165
165
  - lib/seagull.rb
166
166
  - lib/seagull/configuration.rb
167
167
  - lib/seagull/deployment_strategies.rb
168
+ - lib/seagull/deployment_strategies/crashlytics.rb
168
169
  - lib/seagull/deployment_strategies/file.rb
169
170
  - lib/seagull/deployment_strategies/hockey_app.rb
170
171
  - lib/seagull/tasks.rb
@@ -190,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
191
  version: '0'
191
192
  requirements: []
192
193
  rubyforge_project:
193
- rubygems_version: 2.2.0
194
+ rubygems_version: 2.2.2
194
195
  signing_key:
195
196
  specification_version: 4
196
197
  summary: Manage Xcode projects with total control