cmds 0.0.4 → 0.0.5

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: 327a49d0895e5e91d1d35c9ab352357a4a577f65
4
- data.tar.gz: f2f7bd60a0b9bcdfca5a7e50a28ac386f329d33a
3
+ metadata.gz: 49d2979f3b8330647a63142158c793edabe0016d
4
+ data.tar.gz: b1e6d69cd6324cea64ae349dae9f6613ec41ef26
5
5
  SHA512:
6
- metadata.gz: c22d98773434a8c16df0420d599222e00df2f5fcca68e448f889f16671d35db3ab441faa8d6194419c690f435b60e28b1992cc2cbddb0614c79f26fa378e5033
7
- data.tar.gz: ca4371971382c85c6438bafac00c40f637a9e7dbeb2e232838ea9ae2e11ffdc7de5f6989ccd76560f2d09cac452d7da5438e291a29b1baa24dc64e93e8abbacb
6
+ metadata.gz: 0bf4ce786dedf1ff4eb19768bc6985bba4a45e26669745797f023e4b7046467a4fd748519e766e3c5cbc44159ac5ef10917cf4ca2dfbc5cc1f45d206da0b6915
7
+ data.tar.gz: d2b7eebf773c8c3c6f5f04f26441e8d24823f36ae8549ee6cd8f72222d61775aefc5249a02e3f34e61d8c6fe42a84c6bd0fe7c92b139353e5fc38f5a3230ad97
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --markup=markdown
data/ansible/hosts CHANGED
@@ -1,6 +1 @@
1
1
  localhost ansible_connection=local
2
-
3
- alamo.beiarea.com ansible_connection=ssh ansible_ssh_user=root
4
-
5
- [production]
6
- alamo.beiarea.com
data/cmds.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["neil@ztkae.com"]
11
11
  spec.summary = %q{helps read, write and remember commands.}
12
12
  # spec.description = %q{TODO: Write a longer description. Optional.}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/nrser/cmds"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -25,4 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "rake"
26
26
  spec.add_development_dependency "rspec"
27
27
  spec.add_development_dependency "pastel"
28
+ spec.add_development_dependency "yard"
29
+ spec.add_development_dependency "redcarpet"
28
30
  end
data/lib/cmds/result.rb CHANGED
@@ -1,24 +1,55 @@
1
1
  class Cmds
2
+ # a {Result} is a simple data structure returned from calling {Cmds#capture}
3
+ # on a {Cmds} instance.
4
+ #
5
+ # it contains the exit status code, standard output and standard error,
6
+ # as well as the actual string command issued (after all substitutions).
7
+ #
8
+ # instances also have a few convenience methods.
9
+ #
10
+ # @!attribute [r] cmd
11
+ # @return [String] the command string that was executed.
12
+ #
13
+ # @!attribute [r] status
14
+ # @return [Fixnum] the command process' exit status code.
15
+ #
16
+ # @!attribute [r] out
17
+ # @return [String] the command process' standard output.
18
+ #
19
+ # @!attribute [r] err
20
+ # @return [String] the command process' standard error.
21
+ #
2
22
  class Result
3
23
  attr_reader :cmd, :status, :out, :err
4
-
24
+
25
+ # @param cmd [String] {#cmd} attribute.
26
+ # @param status [Fixnum] {#status} attribute.
27
+ # @param out [String] {#out} attribute.
28
+ # @param err [String] {#err} attribute.
5
29
  def initialize cmd, status, out, err
6
30
  @cmd = cmd
7
31
  @status = status
8
32
  @out = out
9
33
  @err = err
10
34
  end
11
-
35
+
36
+ # @return [Boolean] true if {#status} is `0`.
12
37
  def ok?
13
38
  @status == 0
14
39
  end
15
-
40
+
41
+ # @return [Boolean] true if {#status} is not `0`.
16
42
  def error?
17
43
  ! ok?
18
44
  end
19
-
20
- # raises an error if there was one
21
- # returns the Result so that it can be chained
45
+
46
+ # raises an error if the command failed (exited with a {#status} other
47
+ # than `0`).
48
+ #
49
+ # @return [Result] it's self (so that it can be chained).
50
+ #
51
+ # @raise [SystemCallError] if the command failed.
52
+ #
22
53
  def assert
23
54
  if error?
24
55
  msg = NRSER.squish <<-BLOCK
@@ -31,4 +62,4 @@ class Cmds
31
62
  self
32
63
  end # raise_error
33
64
  end
34
- end # class Cmds
65
+ end # class Cmds
data/lib/cmds/sugar.rb CHANGED
@@ -23,6 +23,7 @@ class Cmds
23
23
  # =============
24
24
 
25
25
  # create a new Cmd from template and subs and call it
26
+ # @return [Result]
26
27
  def self.capture template, *subs, &input_block
27
28
  new(template, options(subs, input_block)).capture
28
29
  end
data/lib/cmds/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Cmds
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: yard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: redcarpet
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  description:
98
126
  email:
99
127
  - neil@ztkae.com
@@ -103,6 +131,7 @@ extra_rdoc_files: []
103
131
  files:
104
132
  - ".gitignore"
105
133
  - ".rspec"
134
+ - ".yardopts"
106
135
  - Gemfile
107
136
  - LICENSE.txt
108
137
  - README.md
@@ -144,7 +173,7 @@ files:
144
173
  - test/lines.txt
145
174
  - test/questions.rb
146
175
  - test/tick.rb
147
- homepage: ''
176
+ homepage: https://github.com/nrser/cmds
148
177
  licenses:
149
178
  - MIT
150
179
  metadata: {}
@@ -188,3 +217,4 @@ test_files:
188
217
  - test/lines.txt
189
218
  - test/questions.rb
190
219
  - test/tick.rb
220
+ has_rdoc: