WTBuildHelpers 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/WTBuildHelpers/version.rb +1 -1
- data/lib/teamcity_git_range_fetch.rb +34 -28
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 519d193004401b8d48552f7cc559d8131fa50cda
|
4
|
+
data.tar.gz: c9b7f36e48cf80bebf5d6054aac6b789c6af83f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d81872eda9376b67314cfba5d5d8d922e2df9e9a933c0be760cdbae455a23472d109043d1a25d11236dada6c27ebb2f62377cb4b6ce054dd0691104f3c5af719
|
7
|
+
data.tar.gz: aae17905af803370f9dd4d6f569afd85b51810ae0bb8f89248a7bdf4a463e5e4ca9e5f21a6b2fe4812258bc20ab73cc8639deee1352cd8bb21b50d615f51d3ce
|
@@ -6,35 +6,41 @@ require 'rest_client'
|
|
6
6
|
require 'pp'
|
7
7
|
|
8
8
|
module WTBuildHelpers
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
9
|
+
module TeamCity
|
10
|
+
def self.fetch_commit_range(teamcity_url, build_type_id, username, password)
|
11
|
+
|
12
|
+
auth = "#{username}:#{password}"
|
13
|
+
auth_token = Base64.strict_encode64(auth)
|
14
|
+
|
15
|
+
headers = { "Authorization" => "Basic #{auth_token}",
|
16
|
+
"Accept" => "application/json"
|
17
|
+
}
|
18
|
+
full_url = "#{teamcity_url}/app/rest/buildTypes/id:#{build_type_id}/builds/status:SUCCESS"
|
19
|
+
|
20
|
+
begin
|
21
|
+
response = RestClient.get(full_url, headers=headers)
|
22
|
+
json_response = JSON.parse(response.body)
|
23
|
+
rescue RestClient::Exception => e
|
24
|
+
pp e
|
25
|
+
exit
|
26
|
+
end
|
27
|
+
|
28
|
+
start_revision = ENV["BUILD_VCS_NUMBER"]
|
29
|
+
end_revision = json_response["revisions"]["revision"][0]["version"]
|
30
|
+
|
31
|
+
puts "##teamcity[setParameter name='env.TEAMCITY_COMMIT_RANGE' value='#{start_revision}..#{end_revision}']"
|
32
|
+
end
|
33
|
+
end
|
28
34
|
end
|
29
35
|
|
30
36
|
if __FILE__ == $0
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
if ARGV.length < 4
|
38
|
+
puts "Usage: teamcity_git_range_fetch.rb [TeamCity Url] [TeamCity Build Type Id] [TeamCity User Name] [TeamCity Password]"
|
39
|
+
puts "These parameters can be passed from TeamCity with the following line: "
|
40
|
+
puts " teamcity_git_range_fetch.rb \"%teamcity.serverUrl%\" \"%system.teamcity.buildType.id%\" \"%system.teamcity.auth.userId%\" \"%system.teamcity.auth.password%\""
|
41
|
+
|
42
|
+
exit
|
43
|
+
end
|
44
|
+
|
45
|
+
WTBuildHelpers::TeamCity.fetch_commit_range(ARGV[0], ARGV[1], ARGV[2], ARGV[3])
|
40
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: WTBuildHelpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WillowTreeApps
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: OptionParser
|