tug 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0f04066550ec73a472a473a530e238eaa050fe1
4
- data.tar.gz: e8a6e5cdd34db844080fc4094ef3754dc26038e5
3
+ metadata.gz: 7ef802a29eb4279c1e6e9d21812d43a2e83013f0
4
+ data.tar.gz: 0978140b84a203282b7349981233499d802c10ba
5
5
  SHA512:
6
- metadata.gz: 4266e77f7d852065763213749cf9fdcfd87fe3103707eca527ff34db4e040a0008d16d1724a3fc192587abbe1276dd1ec93a550dfdaa38f3a5db97914cf2e9a1
7
- data.tar.gz: 3e8287720422c09cfb00fad2491f64a4ac5c33996aba50e1b31767cf29136d1875ac8cb215bb381c479185d90e5168d5ba1024ac0e080bc2d724431f853c4112
6
+ metadata.gz: 146d9fd46884fbcefd7029950802c81b89a337389a2a45a72d1086d3240421980391e4042b4c7827ae55227604855504dc111a0a40b2b883ae0f92e4f3cf2b80
7
+ data.tar.gz: 773f873d8f169831cd61d7c791e3d44927c9ed2ae68bd6d7c90bb7b63277f13c424dc4636381253768f21f0a553cb32617c921f6474c07a234bb2459de731e0e
data/README.md CHANGED
@@ -95,6 +95,37 @@ $ tug deploy testflight
95
95
  > * `TUG_TESTFLIGHT_API_KEY`
96
96
  > * `TUG_TESTFLIGHT_TEAM_KEY`
97
97
 
98
+ #### Hockeyapp
99
+
100
+ ```
101
+ $ tug ipa
102
+ $ tug deploy hockeyapp
103
+ ```
104
+
105
+ ###### Options
106
+
107
+ ```
108
+ -f, [--file] # path to an ipa to deploy (optional, searches current directory by default)
109
+ -a, [--api-token] # hockeyapp api key (optional, environmental variable by default)
110
+ -n, [--notify] # notify users of the new build (optional, defaults to 0)
111
+ -r, [--release-notes] # release notes for the build, can be plain text or a path to a file (optional)
112
+ -y, [--notes-type] # the format of the notes (optional, defaults to 1 for markdown)
113
+ -s, [--status] # the hockeyapp download status (optional)
114
+ -t, [--tags] # restrict the download to a list of hockeyapp tags (optional)
115
+ -e, [--teams] # restirct the download to a list of hockeyapp teams (optional)
116
+ -u, [--users] # restirct the download to a list of hockeyapp user ids (optional)
117
+ -m, [--mandatory] # set as a mandatory build (optional)
118
+ -l, [--release-type] # set the type of the release (optiona, defaults to 0 for beta)
119
+ -p, [--private] # set if the build is private (optional, defaults to false)
120
+ -h, [--commit-sha] # set the sha associated with this build (optional)
121
+ -u, [--build-server-url] # set the URL of the build that generated the ipa (optional)
122
+ -p, [--repository-url] # set the URL of the repo associated with the project (optional)
123
+ ```
124
+
125
+ >
126
+ > The following environment variable is used to set your hockeyapp API key
127
+ > * `TUG_HOCKEYAPP_API_KEY`
128
+
98
129
  ### Provision
99
130
 
100
131
  Tug can provision a new machine ready for signing ipas by installing the certificates and provisioning profile required for generating a signed ipa of your application, this is very useful for CI environments like Travis.
@@ -1,26 +1,17 @@
1
1
  module Tug
2
2
  class Deployer
3
3
 
4
- attr_reader :ipa
4
+ attr_reader :file
5
5
  attr_reader :api_token
6
- attr_reader :team_token
7
- attr_reader :lists
8
- attr_reader :notify
9
6
  attr_reader :notes
10
-
11
- class << self
12
- def deployer(options)
13
- Tug::Deployer.new(options)
14
- end
15
- end
7
+ attr_reader :notify
16
8
 
17
9
  def initialize(options)
18
- @ipa = options[:file]
19
- @lists = options[:lists]
20
- @notify = options[:notify]
10
+ @file = options[:file]
21
11
  @api_token = options[:api_token]
22
- @team_token = options[:team_token]
23
- self.notes = options[:release_notes]
12
+ @notify = options[:notify]
13
+
14
+ self.notes = options[:release_notes]
24
15
  end
25
16
 
26
17
  def deploy
@@ -37,16 +28,12 @@ module Tug
37
28
  private
38
29
 
39
30
  def url
40
- "http://testflightapp.com/api/builds.json"
31
+ ""
41
32
  end
42
33
 
43
34
  def params
44
- params = "-F file=@#{ipa} "
45
- params += "-F api_token='#{api_token}' "
46
- params += "-F team_token='#{team_token}' "
47
- params += "-F notes='#{notes}' "
48
- params += "-F distribution_lists='#{lists}' "
49
- params += "-F notify=#{notify}"
35
+ params = "-F notes='#{notes}' "
36
+ params += "-F notify=#{notify} "
50
37
  end
51
38
  end
52
39
  end
@@ -0,0 +1,55 @@
1
+ module Tug
2
+ class Hockeyapp < Deployer
3
+
4
+ attr_reader :notes_type
5
+ attr_reader :status
6
+ attr_reader :tags
7
+ attr_reader :teams
8
+ attr_reader :users
9
+ attr_reader :mandatory
10
+ attr_reader :release_type
11
+ attr_reader :private
12
+ attr_reader :commit_sha
13
+ attr_reader :build_server_url
14
+ attr_reader :repository_url
15
+
16
+ def initialize(options)
17
+ super
18
+
19
+ @notes_type = options[:notes_type]
20
+ @status = options[:status]
21
+ @tags = options[:tags]
22
+ @teams = options[:teams]
23
+ @users = options[:users]
24
+ @mandatory = options[:mandatory]
25
+ @release_type = options[:release_type]
26
+ @private = options[:private]
27
+ @commit_sha = options[:commit_sha]
28
+ @build_server_url = options[:build_server_url]
29
+ @repository_url = options[:repository_url]
30
+ end
31
+
32
+ private
33
+
34
+ def url
35
+ "https://rink.hockeyapp.net/api/2/apps/upload"
36
+ end
37
+
38
+ def params
39
+ params = super
40
+ params += "-F \"ipa=@#{file}\" "
41
+ params += "-F \"teams=#{teams}\" "
42
+ params += "-F \"users=#{users}\" "
43
+ params += "-F \"mandatory=#{mandatory}\" "
44
+ params += "-F \"release_type=#{release_type}\" "
45
+ params += "-F \"private=#{private}\" "
46
+ params += "-F \"commit_sha=#{commit_sha}\" "
47
+ params += "-F \"build_server_url=#{build_server_url}\" "
48
+ params += "-F \"repository_url=#{repository_url}\" "
49
+ params += "-F \"tags=#{tags}\" "
50
+ params += "-F \"status=#{status}\" "
51
+ params += "-F \"notes_type=#{notes_type}\" "
52
+ params += "-H \"X-HockeyAppToken: #{api_token}\" "
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,28 @@
1
+ module Tug
2
+ class Testflight < Deployer
3
+
4
+ attr_reader :team_token
5
+ attr_reader :lists
6
+
7
+ def initialize(options)
8
+ super
9
+
10
+ @lists = options[:lists]
11
+ @team_token = options[:team_token]
12
+ end
13
+
14
+ private
15
+
16
+ def url
17
+ "http://testflightapp.com/api/builds.json"
18
+ end
19
+
20
+ def params
21
+ params = super
22
+ params += "-F file=@#{file} "
23
+ params += "-F api_token='#{api_token}' "
24
+ params += "-F team_token='#{team_token}' "
25
+ params += "-F distribution_lists='#{lists}' "
26
+ end
27
+ end
28
+ end
@@ -3,14 +3,68 @@ module Tug
3
3
  class Deploy < Thor
4
4
 
5
5
  desc "testflight", "deploy an ipa to testflight"
6
- option :file, :aliases => "-f", :default => Dir.glob("*.ipa").first
7
- option :api_token, :aliases => "-a", :default => ENV['TUG_TESTFLIGHT_API_TOKEN']
8
- option :team_token, :aliases => "-t", :default => ENV['TUG_TESTFLIGHT_TEAM_TOKEN']
9
- option :lists, :aliases => "-l"
10
- option :notify, :aliases => "-n", :default => false
11
- option :release_notes, :aliases => "-r", :default => "This build was uploaded via Tug"
6
+ option :file,
7
+ :aliases => "-f",
8
+ :default => Dir.glob("*.ipa").first
9
+ option :api_token,
10
+ :aliases => "-a",
11
+ :default => ENV['TUG_TESTFLIGHT_API_TOKEN']
12
+ option :team_token,
13
+ :aliases => "-t",
14
+ :default => ENV['TUG_TESTFLIGHT_TEAM_TOKEN']
15
+ option :lists,
16
+ :aliases => "-l"
17
+ option :notify,
18
+ :aliases => "-n",
19
+ :default => false
20
+ option :release_notes,
21
+ :aliases => "-r",
22
+ :default => "This build was uploaded via Tug"
12
23
  def testflight
13
- deployer = Tug::Deployer.deployer(options)
24
+ deployer = Tug::Testflight.new(options)
25
+ deployer.deploy
26
+ end
27
+
28
+ desc "hockeyapp", "deploy an ipa to hockeyapp"
29
+ option :file,
30
+ :aliases => "-f",
31
+ :default => Dir.glob("*.ipa").first
32
+ option :api_token,
33
+ :aliases => "-a",
34
+ :default => ENV['TUG_HOCKEYAPP_API_TOKEN']
35
+ option :notify,
36
+ :aliases => "-n",
37
+ :default => 0
38
+ option :release_notes,
39
+ :aliases => "-r",
40
+ :default => "This build was uploaded via Tug"
41
+ option :notes_type,
42
+ :aliases => "-y",
43
+ :default => 1
44
+ option :status,
45
+ :aliases => "-s"
46
+ option :tags,
47
+ :aliases => "-t"
48
+ option :teams,
49
+ :aliases => "-e"
50
+ option :users,
51
+ :aliases => "-u"
52
+ option :mandatory,
53
+ :aliases => "-m"
54
+ option :release_type,
55
+ :aliases => "-l",
56
+ :default => 0
57
+ option :private,
58
+ :aliases => "-p",
59
+ :default => false
60
+ option :commit_sha,
61
+ :aliases => "-h"
62
+ option :build_server_url,
63
+ :aliases => "-u"
64
+ option :repository_url,
65
+ :aliases => "-p"
66
+ def hockeyapp
67
+ deployer = Tug::Hockeyapp.new(options)
14
68
  deployer.deploy
15
69
  end
16
70
 
@@ -25,16 +79,24 @@ module Tug
25
79
  class Interface < Thor
26
80
 
27
81
  desc "build", "build a project"
28
- option :config, :default => "#{Dir.pwd}/.tug.yml", :aliases => "-c"
82
+ option :config,
83
+ :default => "#{Dir.pwd}/.tug.yml",
84
+ :aliases => "-c"
29
85
  def build
30
86
  config_file = Tug::ConfigFile.config_file(options[:config])
31
87
  execute(__method__.to_s, config_file)
32
88
  end
33
89
 
34
90
  desc "ipa", "generate an ipa"
35
- option :config, :default => "#{Dir.pwd}/.tug.yml", :aliases => "-c"
36
- option :export, :default => "#{Dir.pwd}", :aliases => "-e"
37
- option :build_config, :default => "Release", :aliases => "-b"
91
+ option :config,
92
+ :default => "#{Dir.pwd}/.tug.yml",
93
+ :aliases => "-c"
94
+ option :export,
95
+ :default => "#{Dir.pwd}",
96
+ :aliases => "-e"
97
+ option :build_config,
98
+ :default => "Release",
99
+ :aliases => "-b"
38
100
  def ipa
39
101
  config_file = Tug::ConfigFile.config_file(options[:config])
40
102
  config_file.project.ipa_export_path = options[:export]
@@ -43,9 +105,15 @@ module Tug
43
105
  end
44
106
 
45
107
  desc "provision", "provision system distrubution certificates and provisioning profile"
46
- option :config, :default => "#{Dir.pwd}/.tug.yml", :aliases => "-c"
47
- option :keychain, :default => "tug", :aliases => "-k"
48
- option :password, :aliases => "-p", :default => ENV['TUG_P12_PASSWORD']
108
+ option :config,
109
+ :default => "#{Dir.pwd}/.tug.yml",
110
+ :aliases => "-c"
111
+ option :keychain,
112
+ :default => "tug",
113
+ :aliases => "-k"
114
+ option :password,
115
+ :aliases => "-p",
116
+ :default => ENV['TUG_P12_PASSWORD']
49
117
  def provision
50
118
  config_file = Tug::ConfigFile.config_file(options[:config])
51
119
  config_file.keychain.name = options[:keychain]
data/lib/tug/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tug
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
data/lib/tug.rb CHANGED
@@ -24,5 +24,7 @@ require "tug/tool/xctool_archive"
24
24
  require "tug/keychain/keychain"
25
25
 
26
26
  require "tug/deployment/deployer"
27
+ require "tug/deployment/testflight"
28
+ require "tug/deployment/hockeyapp"
27
29
  require "tug/deployment/notes_parser"
28
30
  require "tug/deployment/notes_file_parser"
@@ -5,55 +5,23 @@ describe Tug::Deployer do
5
5
  before(:each) do
6
6
  @options = {
7
7
  :api_token => "api_token",
8
- :team_token => "team_token",
9
8
  :file => "test.ipa",
10
- :notify => true,
11
- :release_notes => "Notes"
9
+ :release_notes => "Notes",
10
+ :notify => 1
12
11
  }
13
12
 
14
- @deployer = Tug::Deployer.deployer(@options)
15
- end
16
-
17
- describe "when returning a deployer" do
18
- it "should return a default deployer" do
19
- expect(Tug::Deployer.deployer(@options)).to be_kind_of(Tug::Deployer)
20
- end
13
+ @deployer = Tug::Deployer.new(@options)
21
14
  end
22
15
 
23
16
  describe "when deploying" do
24
17
 
25
- it "should send to testflight by default" do
26
- expect(IO).to receive(:popen).with(/http:\/\/testflightapp.com\/api\/builds.json/)
27
- @deployer.deploy
28
- end
29
-
30
- it "should send the ipa as a param" do
31
- expect(IO).to receive(:popen).with(/-F file=@test.ipa/)
32
- @deployer.deploy
33
- end
34
-
35
- it "should send the team token as a param" do
36
- expect(IO).to receive(:popen).with(/-F team_token='team_token'/)
37
- @deployer.deploy
38
- end
39
-
40
- it "should send the api token as a param" do
41
- expect(IO).to receive(:popen).with(/-F api_token='api_token'/)
42
- @deployer.deploy
43
- end
44
-
45
18
  it "should have some release notes" do
46
19
  expect(IO).to receive(:popen).with(/-F notes='Notes'/)
47
20
  @deployer.deploy
48
21
  end
49
22
 
50
- it "should have lists" do
51
- expect(IO).to receive(:popen).with(/-F distribution_lists=''/)
52
- @deployer.deploy
53
- end
54
-
55
23
  it "should notify" do
56
- expect(IO).to receive(:popen).with(/-F notify=true/)
24
+ expect(IO).to receive(:popen).with(/-F notify=1/)
57
25
  @deployer.deploy
58
26
  end
59
27
  end
@@ -0,0 +1,104 @@
1
+ require 'spec_helper'
2
+
3
+ describe Tug::Hockeyapp do
4
+
5
+ before(:each) do
6
+ @options = {
7
+ :api_token => "api_token",
8
+ :file => "test.ipa",
9
+ :release_notes => "Notes",
10
+ :notify => 1,
11
+ :notes_type => 1,
12
+ :status => 1,
13
+ :tags => "hello, world",
14
+ :teams => "team",
15
+ :users => "users",
16
+ :mandatory => 0,
17
+ :release_type => 0,
18
+ :private => true,
19
+ :commit_sha => "123",
20
+ :build_server_url => "hello.com",
21
+ :repository_url => "world.com"
22
+ }
23
+
24
+ @deployer = Tug::Hockeyapp.new(@options)
25
+ end
26
+
27
+ describe "when deploying" do
28
+
29
+ it "should send to hockeyapp" do
30
+ expect(IO).to receive(:popen).with(/https:\/\/rink.hockeyapp.net\/api\/2\/apps\/upload/)
31
+ @deployer.deploy
32
+ end
33
+
34
+ it "should send the ipa as a param" do
35
+ expect(IO).to receive(:popen).with(/-F "ipa=@test.ipa"/)
36
+ @deployer.deploy
37
+ end
38
+
39
+ it "should have some release notes" do
40
+ expect(IO).to receive(:popen).with(/-F notes='Notes'/)
41
+ @deployer.deploy
42
+ end
43
+
44
+ it "should have some a notes type" do
45
+ expect(IO).to receive(:popen).with(/-F "notes_type=1"/)
46
+ @deployer.deploy
47
+ end
48
+
49
+ it "should have some a status" do
50
+ expect(IO).to receive(:popen).with(/-F "status=1"/)
51
+ @deployer.deploy
52
+ end
53
+
54
+ it "should have tags" do
55
+ expect(IO).to receive(:popen).with(/-F "tags=hello, world"/)
56
+ @deployer.deploy
57
+ end
58
+
59
+ it "should send the api token as a param" do
60
+ expect(IO).to receive(:popen).with(/-H "X-HockeyAppToken: api_token"/)
61
+ @deployer.deploy
62
+ end
63
+
64
+ it "should have teams" do
65
+ expect(IO).to receive(:popen).with(/-F "teams=team"/)
66
+ @deployer.deploy
67
+ end
68
+
69
+ it "should have users" do
70
+ expect(IO).to receive(:popen).with(/-F "users=users"/)
71
+ @deployer.deploy
72
+ end
73
+
74
+ it "should have a mandatory key" do
75
+ expect(IO).to receive(:popen).with(/-F "mandatory=0"/)
76
+ @deployer.deploy
77
+ end
78
+
79
+ it "should have a release_type" do
80
+ expect(IO).to receive(:popen).with(/-F "release_type=0"/)
81
+ @deployer.deploy
82
+ end
83
+
84
+ it "should have a private key" do
85
+ expect(IO).to receive(:popen).with(/-F "private=true"/)
86
+ @deployer.deploy
87
+ end
88
+
89
+ it "should have a commit_sha" do
90
+ expect(IO).to receive(:popen).with(/-F "commit_sha=123"/)
91
+ @deployer.deploy
92
+ end
93
+
94
+ it "should have a build_server_url" do
95
+ expect(IO).to receive(:popen).with(/-F "build_server_url=hello.com"/)
96
+ @deployer.deploy
97
+ end
98
+
99
+ it "should have a repository_url" do
100
+ expect(IO).to receive(:popen).with(/-F "repository_url=world.com"/)
101
+ @deployer.deploy
102
+ end
103
+ end
104
+ end
@@ -10,8 +10,8 @@ describe Tug::IpaCommand do
10
10
  allow(FileUtils).to receive(:mv)
11
11
 
12
12
  yaml = project_yaml
13
- yaml["project"]["ipa_config"] = "InHouse"
14
13
  @project = Tug::Project.new(yaml)
14
+ @project.ipa_config = "InHouse"
15
15
 
16
16
  @config = double(Tug::ConfigFile)
17
17
  allow(@config).to receive(:project).and_return(@project)
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+
3
+ describe Tug::Testflight do
4
+
5
+ before(:each) do
6
+ @options = {
7
+ :api_token => "api_token",
8
+ :team_token => "team_token",
9
+ :file => "test.ipa",
10
+ :notify => true,
11
+ :release_notes => "Notes"
12
+ }
13
+
14
+ @deployer = Tug::Testflight.new(@options)
15
+ end
16
+
17
+ describe "when deploying" do
18
+
19
+ it "should send to testflight by default" do
20
+ expect(IO).to receive(:popen).with(/http:\/\/testflightapp.com\/api\/builds.json/)
21
+ @deployer.deploy
22
+ end
23
+
24
+ it "should send the ipa as a param" do
25
+ expect(IO).to receive(:popen).with(/-F file=@test.ipa/)
26
+ @deployer.deploy
27
+ end
28
+
29
+ it "should send the team token as a param" do
30
+ expect(IO).to receive(:popen).with(/-F team_token='team_token'/)
31
+ @deployer.deploy
32
+ end
33
+
34
+ it "should send the api token as a param" do
35
+ expect(IO).to receive(:popen).with(/-F api_token='api_token'/)
36
+ @deployer.deploy
37
+ end
38
+
39
+ it "should have some release notes" do
40
+ expect(IO).to receive(:popen).with(/-F notes='Notes'/)
41
+ @deployer.deploy
42
+ end
43
+
44
+ it "should have lists" do
45
+ expect(IO).to receive(:popen).with(/-F distribution_lists=''/)
46
+ @deployer.deploy
47
+ end
48
+
49
+ it "should notify" do
50
+ expect(IO).to receive(:popen).with(/-F notify=true/)
51
+ @deployer.deploy
52
+ end
53
+ end
54
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Fish
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-02 00:00:00.000000000 Z
11
+ date: 2014-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -107,8 +107,10 @@ files:
107
107
  - lib/tug/config/config_file.rb
108
108
  - lib/tug/config/missing_config_file.rb
109
109
  - lib/tug/deployment/deployer.rb
110
+ - lib/tug/deployment/hockeyapp.rb
110
111
  - lib/tug/deployment/notes_file_parser.rb
111
112
  - lib/tug/deployment/notes_parser.rb
113
+ - lib/tug/deployment/testflight.rb
112
114
  - lib/tug/interface/interface.rb
113
115
  - lib/tug/keychain/keychain.rb
114
116
  - lib/tug/project/project.rb
@@ -121,6 +123,7 @@ files:
121
123
  - spec/command_spec.rb
122
124
  - spec/config_file_spec.rb
123
125
  - spec/deployer_spec.rb
126
+ - spec/hockapp_spec.rb
124
127
  - spec/ipa_command_spec.rb
125
128
  - spec/keychain_spec.rb
126
129
  - spec/notes_file_parser_spec.rb
@@ -129,6 +132,7 @@ files:
129
132
  - spec/release_notes_spec.rb
130
133
  - spec/spec_helper.rb
131
134
  - spec/test_notes.txt
135
+ - spec/testflight_spec.rb
132
136
  - spec/xctool_spec.rb
133
137
  - tug.gemspec
134
138
  homepage: https://github.com/alexfish/tug
@@ -160,6 +164,7 @@ test_files:
160
164
  - spec/command_spec.rb
161
165
  - spec/config_file_spec.rb
162
166
  - spec/deployer_spec.rb
167
+ - spec/hockapp_spec.rb
163
168
  - spec/ipa_command_spec.rb
164
169
  - spec/keychain_spec.rb
165
170
  - spec/notes_file_parser_spec.rb
@@ -168,4 +173,5 @@ test_files:
168
173
  - spec/release_notes_spec.rb
169
174
  - spec/spec_helper.rb
170
175
  - spec/test_notes.txt
176
+ - spec/testflight_spec.rb
171
177
  - spec/xctool_spec.rb