frontkick 0.4.1 → 0.4.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: 9bc4c44cc031f5977ca8d93417ae56abbd2e6d36
4
- data.tar.gz: eb941fc286e02a0fe3abf28fe0bc975e5e4da86a
3
+ metadata.gz: 76908ad1f2119ccfa083d8dbd15be010496cf91d
4
+ data.tar.gz: 9e5031c41191c66d415f28ae1af4069329b4e6b8
5
5
  SHA512:
6
- metadata.gz: a02886dbdc4ac359d9ab8b263ea8a34c0902a7c24a7690c00a2ff65db23b0924c1cd8fe22e31083878a7090640cf44697ae785536edf2a8c125430a872d661bd
7
- data.tar.gz: 93ef0cc02ea29058914f4fc828b42b672c749f4833187fdb5cf79b3b381f8d75ef024d1cf7f54bf113c08257652c4260f6f8ca5d0e09f00b4ac896d16b4874e9
6
+ metadata.gz: 85987e9d36b393dc83d97efeab975cfc5d9ad5270774d82fbb1f679346268d3f784f5e0691b6e2069c288be00cf855e9b06400cd2fb3b0a652dafdf3a79eb8b5
7
+ data.tar.gz: 02d23645982af8d4c77d798fc58a823b9772942b9249a42f672698974c6fcc821cc27f3fd49ebb72575e5cf43896a54645d03a2f42e1b5fa942379770c21553d
@@ -1,3 +1,13 @@
1
+ # 0.4.3 (2015/09/11)
2
+
3
+ Enhancements:
4
+
5
+ - Add :dry_run option
6
+
7
+ # 0.4.2 (2015/09/11)
8
+
9
+ yanked
10
+
1
11
  # 0.4.1 (2015/08/15)
2
12
 
3
13
  Changes:
data/README.md CHANGED
@@ -31,6 +31,11 @@ With frontkick, you can easily get the exit code, STDOUT, and STDERR.
31
31
 
32
32
  result = Frontkick.exec(["echo", "*"]) #=> echo the asterisk character
33
33
 
34
+ ### Dry Run Option
35
+
36
+ result = Frontkick.exec(["echo", "*"], :dry_run => 1)
37
+ puts result.stdout #=> echo \*
38
+
34
39
  ### Timeout Option
35
40
 
36
41
  Frontkick.exec("sleep 2 && ls /hoge", :timeout => 1) # raises Frontkick::Timeout
@@ -0,0 +1,4 @@
1
+ require 'frontkick'
2
+
3
+ result = Frontkick.exec(['echo', '*'], :dry_run => 1)
4
+ puts result.stdout
@@ -1,5 +1,6 @@
1
1
  require 'benchmark'
2
2
  require 'open3'
3
+ require 'shellwords'
3
4
 
4
5
  module Frontkick
5
6
  class Command
@@ -10,7 +11,12 @@ module Frontkick
10
11
  stdin, out, err, wait_thr, pid = nil
11
12
 
12
13
  cmd_array = cmd.kind_of?(Array) ? cmd : [cmd]
13
- command = cmd_array.join(' ')
14
+ command = "#{cmd_array.first} #{Shellwords.shelljoin(cmd_array[1..-2])}"
15
+
16
+ if opts[:dry_run]
17
+ return Result.new(:stdout => command, :stderr => '', :exit_code => 0, :duration => 0)
18
+ end
19
+
14
20
  lock_fd = file_lock(opts[:exclusive], opts[:exclusive_blocking]) if opts[:exclusive]
15
21
  begin
16
22
  timeout(opts[:timeout], Frontkick::TimeoutLocal) do # nil is for no timeout
@@ -1,3 +1,3 @@
1
1
  module Frontkick
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frontkick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-14 00:00:00.000000000 Z
11
+ date: 2015-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -67,6 +67,7 @@ files:
67
67
  - LICENSE
68
68
  - README.md
69
69
  - Rakefile
70
+ - example/dry_run.rb
70
71
  - frontkick.gemspec
71
72
  - lib/frontkick.rb
72
73
  - lib/frontkick/command.rb
@@ -93,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
94
  version: '0'
94
95
  requirements: []
95
96
  rubyforge_project:
96
- rubygems_version: 2.2.2
97
+ rubygems_version: 2.4.5
97
98
  signing_key:
98
99
  specification_version: 4
99
100
  summary: Execute a command simply!