frontkick 0.2.1 → 0.3.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
  SHA1:
3
- metadata.gz: 31bf4f0ff734c3d2ac8271d060c6d5b255a1470b
4
- data.tar.gz: 1089020ba94f6695eb54b560cd97036f8044e6c6
3
+ metadata.gz: 2703d236dbe02b6835724780a85a7760e5771988
4
+ data.tar.gz: 3e649cb4c5805b5cf1c46acbe571f343eae52bb1
5
5
  SHA512:
6
- metadata.gz: 0b21c4060f641fdf47cf9c0f7f9517baa086b65b484a7c4d0a525aee09fae7980a8eb4d9d9ce22fddcfe21dbba6eaaf0da8bc5377b8cd55fffc30e44a5e0e316
7
- data.tar.gz: 92738f33989470d52d74bfe3041ff757aeb3be3b6f48c7a3fa7f72d3948a8183ce11ee0b8d4ca80a902dd8c483026b93c7e8189df9044da998db60df35d4fac3
6
+ metadata.gz: bb378e4fbb3f54e16dd19a1dc5f302a9c1fd2d2591fe7885db3d0cb0b3ad2446bab88a7ee551265cd03922d1114541a0b2ef81749807f6dd8fc5ab7265d3b2be
7
+ data.tar.gz: 1536fd3ce09cdea8926986e83f374650febef704c71cade14c463c55b2382ee4dd54861ea46dede86f9e1e6317b84a6cee49f5f185672809d377ae3d4202349a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 0.3.1 (2014/05/25)
2
+
3
+ Enhancements:
4
+
5
+ - Alias `exit_code` to `status`
6
+ - Alias `Frontkick::Command.exec` to `Frontkick.exec`
7
+
1
8
  # 0.2.1 (2013/09/13)
2
9
 
3
10
  Changes:
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  testing ruby: 1.9.2, 1.9.3, 2.0.0;
4
4
 
5
- Frontkick is a gem to execute a command and obtain status code, stdout, stderr simply, wheres, `system` does not provide it.
5
+ Frontkick is a gem to execute a command and obtain exit\_code, stdout, stderr simply, wheres, `system` does not provide all of them.
6
6
 
7
7
  ## USAGE
8
8
 
@@ -10,26 +10,27 @@ Frontkick is a gem to execute a command and obtain status code, stdout, stderr s
10
10
 
11
11
  ### Basic Usage
12
12
 
13
- result = Frontkick::Command.exec("echo *")
13
+ result = Frontkick.exec("echo *")
14
14
  puts result.successful? #=> true if exit_code is 0
15
15
  puts result.stdout #=> stdout output of the command
16
16
  puts result.stderr #=> stderr output of the command
17
17
  puts result.exit_code #=> exit_code of the command
18
18
  puts result.duration #=> the time used to execute the command
19
+ puts result.status #=> alias to exit_code
19
20
 
20
21
  ### Escape Command
21
22
 
22
- result = Frontkick::Command.exec(["echo", "*"]) #=> echo the asterisk character
23
+ result = Frontkick.exec(["echo", "*"]) #=> echo the asterisk character
23
24
 
24
25
  ### Timeout Option
25
26
 
26
- Frontkick::Command.exec("sleep 2 && ls /hoge", :timeout => 1)
27
+ Frontkick.exec("sleep 2 && ls /hoge", :timeout => 1)
27
28
 
28
29
  ### Exclusive Option
29
30
 
30
31
  Prohibit another process to run a command concurrently
31
32
 
32
- Frontkick::Command.exec("sleep 2 && ls /hoge", :exclusive => "/tmp/frontkick.lock") # raises Fontkick::Locked if locked
33
+ Frontkick.exec("sleep 2 && ls /hoge", :exclusive => "/tmp/frontkick.lock") # raises Fontkick::Locked if locked
33
34
 
34
35
  ## Contributing
35
36
 
@@ -1,11 +1,6 @@
1
1
  require 'benchmark'
2
2
  require 'open3'
3
3
 
4
- module Frontkick
5
- class Locked < StandardError
6
- end
7
- end
8
-
9
4
  module Frontkick
10
5
  class Command
11
6
  def self.exec(cmd, opts = {})
@@ -1,6 +1,8 @@
1
1
  module Frontkick
2
2
  class CommandResult
3
3
  attr_accessor :stdout, :stderr, :exit_code, :duration
4
+ alias :status :exit_code
5
+ alias :status= :exit_code=
4
6
 
5
7
  def initialize(params)
6
8
  @stdout = params[:stdout] || ""
@@ -0,0 +1,3 @@
1
+ module Frontkick
2
+ class Locked < StandardError; end
3
+ end
@@ -1,3 +1,3 @@
1
1
  module Frontkick
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.1"
3
3
  end
data/lib/frontkick.rb CHANGED
@@ -1,3 +1,9 @@
1
1
  require 'rubygems'
2
2
  require 'frontkick/command'
3
3
  require 'frontkick/command_result'
4
+
5
+ module Frontkick
6
+ def self.exec(cmd, opts = {})
7
+ ::Frontkick::Command.exec(cmd, opts)
8
+ end
9
+ end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frontkick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-13 00:00:00.000000000 Z
11
+ date: 2014-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: Execute a command simply!
@@ -59,9 +59,9 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
63
- - .rspec
64
- - .travis.yml
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
65
  - CHANGELOG.md
66
66
  - Gemfile
67
67
  - LICENSE
@@ -71,6 +71,7 @@ files:
71
71
  - lib/frontkick.rb
72
72
  - lib/frontkick/command.rb
73
73
  - lib/frontkick/command_result.rb
74
+ - lib/frontkick/error.rb
74
75
  - lib/frontkick/version.rb
75
76
  - spec/spec_helper.rb
76
77
  homepage: https://github.com/sonots/frontkick
@@ -82,17 +83,17 @@ require_paths:
82
83
  - lib
83
84
  required_ruby_version: !ruby/object:Gem::Requirement
84
85
  requirements:
85
- - - '>='
86
+ - - ">="
86
87
  - !ruby/object:Gem::Version
87
88
  version: '0'
88
89
  required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  requirements:
90
- - - '>='
91
+ - - ">="
91
92
  - !ruby/object:Gem::Version
92
93
  version: '0'
93
94
  requirements: []
94
95
  rubyforge_project:
95
- rubygems_version: 2.0.2
96
+ rubygems_version: 2.2.2
96
97
  signing_key:
97
98
  specification_version: 4
98
99
  summary: Execute a command simply!