trent 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -8
- data/lib/github/github.rb +5 -0
- data/lib/trent.rb +16 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f1c859844b58137c350ba12bd63c3be0cbb31cb47bb3355081c41e0ffb28f53
|
4
|
+
data.tar.gz: 5fd4d79c8f89e8945c75d1d16676f5cadf0e2cc5c236d326f95d71f92e7c43f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30482d95de07171e55bc1f58c1c397c93203f9c1f907ee12c44f97548df0851f3907715b0302e627151883c67b3ba60858f126fcd3e8c2c7bbff675a71b780fc
|
7
|
+
data.tar.gz: b5636c209077500c3945e6e6e6b13c2857a516f91b9eed1d25ebf1b2ad307df1523321d5a071eb4469cc20cc290086fa46087511b762a8a526ac2da68f78d58c
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
### [0.1
|
1
|
+
### [0.2.1] 2018-08-27
|
2
2
|
|
3
|
-
|
3
|
+
### Fixed
|
4
|
+
- `sh()` and `ssh()` did not actually use the `fail_non_success` parameter. There was a bug in the code that ended up ignoring the parameter.
|
4
5
|
|
5
|
-
###
|
6
|
-
-
|
7
|
-
- Ability to run remote ssh commands on Travis CI builds.
|
8
|
-
- Ability to send a comment on the GitHub pull request for the Travis CI build.
|
9
|
-
- Trent only works with Travis-CI at this time.
|
6
|
+
### Changed
|
7
|
+
- When attempting to comment on a GitHub pull request and you're not on a pull request, Trent will log a warning to the console with the comment message.
|
10
8
|
|
11
9
|
### [0.2.0] 2018-08-08
|
12
10
|
|
@@ -16,4 +14,14 @@ Add `path` function to Trent to perform string replacing in your commands for yo
|
|
16
14
|
- Add `path` function to Trent to perform string replacing in your commands for you.
|
17
15
|
|
18
16
|
### Changed
|
19
|
-
- Each time you run `sh()` or `ssh()` commands, your command will perform a string replace with all commands you add to `path()`.
|
17
|
+
- Each time you run `sh()` or `ssh()` commands, your command will perform a string replace with all commands you add to `path()`.
|
18
|
+
|
19
|
+
### [0.1.0] 2018-08-07
|
20
|
+
|
21
|
+
First release!
|
22
|
+
|
23
|
+
### Added
|
24
|
+
- Ability to run local shell commands on Travis CI build.
|
25
|
+
- Ability to run remote ssh commands on Travis CI builds.
|
26
|
+
- Ability to send a comment on the GitHub pull request for the Travis CI build.
|
27
|
+
- Trent only works with Travis-CI at this time.
|
data/lib/github/github.rb
CHANGED
@@ -12,6 +12,11 @@ class GitHub
|
|
12
12
|
|
13
13
|
# Comment on Pull Request
|
14
14
|
def comment(message)
|
15
|
+
unless ENV['TRAVIS_PULL_REQUEST']
|
16
|
+
Log.warning("Not in pull request, skipping GitHub comment. Message: #{message}")
|
17
|
+
return
|
18
|
+
end
|
19
|
+
|
15
20
|
result = comment_on_pull_request(message)
|
16
21
|
|
17
22
|
if !result[:successful]
|
data/lib/trent.rb
CHANGED
@@ -38,32 +38,25 @@ class Trent
|
|
38
38
|
end
|
39
39
|
|
40
40
|
## Run ssh command
|
41
|
-
def ssh(command, fail_non_success
|
41
|
+
def ssh(command, fail_non_success: true)
|
42
42
|
command = Command.path_replace(command, @paths)
|
43
43
|
Log.fatal('You did not configure SSH yet.') unless @ssh
|
44
44
|
|
45
45
|
puts command.colorize(@color)
|
46
46
|
result = @ssh.run(command)
|
47
47
|
|
48
|
-
|
48
|
+
process_shell_result(result, fail_non_success)
|
49
49
|
|
50
50
|
result
|
51
51
|
end
|
52
52
|
|
53
53
|
# Run local bash command
|
54
|
-
def sh(command, fail_non_success
|
54
|
+
def sh(command, fail_non_success: true)
|
55
55
|
command = Command.path_replace(command, @paths)
|
56
56
|
puts command.colorize(@color)
|
57
57
|
|
58
58
|
result = @sh.run(command)
|
59
|
-
|
60
|
-
unless result[:result]
|
61
|
-
if fail_non_success
|
62
|
-
Log.fatal('Command failed with a non 0 exit status.')
|
63
|
-
else
|
64
|
-
Log.warning('Command failed with a non 0 exit status.')
|
65
|
-
end
|
66
|
-
end
|
59
|
+
process_shell_result(result, fail_non_success)
|
67
60
|
|
68
61
|
result
|
69
62
|
end
|
@@ -73,4 +66,16 @@ class Trent
|
|
73
66
|
Log.fatal('You did not configure GitHub yet.') unless @github
|
74
67
|
@github
|
75
68
|
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def process_shell_result(result, fail_non_success)
|
73
|
+
return if result[:result]
|
74
|
+
|
75
|
+
if fail_non_success
|
76
|
+
Log.fatal('Command failed with a non 0 exit status.')
|
77
|
+
else
|
78
|
+
Log.warning('Command failed with a non 0 exit status.')
|
79
|
+
end
|
80
|
+
end
|
76
81
|
end
|