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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae2e50c64156a238d44cea8d8dd2f75d065a67181c83c4c8393b977185a780dc
4
- data.tar.gz: 030376142fdf94609f35462eeaf57c6aeae1c3613c2cacaaa3a0b32090a54fea
3
+ metadata.gz: 0f1c859844b58137c350ba12bd63c3be0cbb31cb47bb3355081c41e0ffb28f53
4
+ data.tar.gz: 5fd4d79c8f89e8945c75d1d16676f5cadf0e2cc5c236d326f95d71f92e7c43f5
5
5
  SHA512:
6
- metadata.gz: a04dada57e421b6c9b832dbed4c8f096448dcc89a61afb0da3f0086f2f865816b90e4d6b1f4be9be1d506a47fcf629a64a6bdd1c194407440476c1e145e7b622
7
- data.tar.gz: f106b7156d6a8188e58ee7b802b411fc7a297e9dcf52dabcc562234d6710d5e3d91b95e6be45d702051ea2e3ee2e1d559d4d9eb7a6d25b5e95a1054e53c94285
6
+ metadata.gz: 30482d95de07171e55bc1f58c1c397c93203f9c1f907ee12c44f97548df0851f3907715b0302e627151883c67b3ba60858f126fcd3e8c2c7bbff675a71b780fc
7
+ data.tar.gz: b5636c209077500c3945e6e6e6b13c2857a516f91b9eed1d25ebf1b2ad307df1523321d5a071eb4469cc20cc290086fa46087511b762a8a526ac2da68f78d58c
data/CHANGELOG.md CHANGED
@@ -1,12 +1,10 @@
1
- ### [0.1.0] 2018-08-07
1
+ ### [0.2.1] 2018-08-27
2
2
 
3
- First release!
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
- ### Added
6
- - Ability to run local shell commands on Travis CI build.
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 = true)
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
- Log.fatal('Command failed with a non 0 exit status.') if !result[:result] && fail_non_success
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 = true)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Levi Bostian