cmds 0.2.8 → 0.2.9

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: 429705482fa92b340819e86a875ebbb6a0d93525
4
- data.tar.gz: 7dd781484f134f13f9e4a542cad94434d0635327
3
+ metadata.gz: 5c155b3a2266b44990db163f49efec7a59044a3b
4
+ data.tar.gz: f5fa951737f8b51a0a95aee8f49d3ec7344f3a06
5
5
  SHA512:
6
- metadata.gz: efc825f8094fef891f68bf64cd84755158e43e55c98616e3b10204765835ec87ef2d8e9256a89fd78e5be028f30d3b24964d5551c9a0ae7b63d9ab2f5e9343cc
7
- data.tar.gz: 1891e265fc859564070ac73876b159433c3f7b0c84f04b00fe19d83bfd770ee2408fa63375739f6c2163382af560f2b1c3c36a1f8c2390bf161ebc259f1792ec
6
+ metadata.gz: d879ac96441d732374252beea066e84f2a1fc771ee21cea94374266b02ea02fdb8b47d8fd4771e8aaaed77d6176fb750d8ace803584fe65ebd5469394d8575be
7
+ data.tar.gz: cf7e0c8d02f586e8353b494baaf5a0d9171236708243d694ea50a80eadf96d8f4f975bd152345d834bcb39747eaae5e94fc5981d74944f8ff6f4cd5848a1e3f2
data/.gitignore CHANGED
@@ -17,6 +17,9 @@ test/version_tmp
17
17
  tmp
18
18
 
19
19
  ref/repos
20
+
21
+ .ruby-version
22
+
20
23
  ##############################################################################
21
24
  # BEGIN Qb.gitingore
22
25
  #
@@ -0,0 +1,18 @@
1
+ before_install:
2
+ # Install gem
3
+ - gem update --system
4
+ - gem install bundler
5
+
6
+ language: ruby
7
+
8
+ rvm:
9
+ - 2.3.0
10
+ - 2.3.6
11
+ - 2.4.3
12
+ - 2.5.0
13
+
14
+ script: bundle exec rspec
15
+
16
+ sudo: false
17
+
18
+ cache: bundler
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Cmds
2
2
  =============================================================================
3
3
 
4
+ [![Gem Version](http://img.shields.io/gem/v/cmds.svg)][gem]
5
+ [![Build Status](http://img.shields.io/travis/nrser/cmds.svg)][travis]
6
+
7
+ [gem]: https://rubygems.org/gems/cmds
8
+ [travis]: http://travis-ci.org/nrser/cmds
9
+
4
10
  `Cmds` tries to make it easier to read, write and remember using shell commands in Ruby.
5
11
 
6
12
  It treats generating shell the in a similar fashion to generating SQL or HTML.
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  # ----------------------------------------------------------------------------
29
29
 
30
30
  # Mu guns
31
- spec.add_dependency "nrser", ">= 0.2.0.pre.1"
31
+ spec.add_dependency "nrser", ">= 0.2.0.pre.3"
32
32
 
33
33
  # ERB replacement with more features
34
34
  #
@@ -16,6 +16,6 @@ class Cmds
16
16
  #
17
17
  # @return [String]
18
18
  #
19
- VERSION = '0.2.8'
19
+ VERSION = '0.2.9'
20
20
 
21
21
  end
@@ -11,13 +11,30 @@ describe Cmds::ERBContext do
11
11
  BLOCK
12
12
  }
13
13
 
14
- def get_result tpl, bnd
15
- NRSER.squish ERB.new(tpl).result(bnd.get_binding)
14
+ def get_result tpl, context
15
+ # NOTE This *used* to use {ERB.new}, but that stopped working in Ruby
16
+ # 2.4+ with a weird
17
+ #
18
+ # uninitialized constant Cmds::ERBContext::String
19
+ #
20
+ # message... https://travis-ci.org/nrser/cmds/jobs/347910522
21
+ #
22
+ # This doesn't matter, because we use {ERubis}, and that still works,
23
+ # so switched to that here...
24
+ #
25
+ NRSER.squish Cmds::ShellEruby.new( tpl ).result( context.get_binding )
16
26
  end
17
27
 
18
28
  it "should work" do
19
- bnd = Cmds::ERBContext.new [], current_host: 'xyz', domain: 'com.nrser.blah', filepath: '/tmp/export.plist'
29
+ context = Cmds::ERBContext.new(
30
+ [],
31
+ current_host: 'xyz',
32
+ domain: 'com.nrser.blah',
33
+ filepath: '/tmp/export.plist',
34
+ )
20
35
 
21
- expect(get_result tpl, bnd).to eq "defaults -currentHost xyz export com.nrser.blah /tmp/export.plist"
36
+ expect(
37
+ get_result tpl, context
38
+ ).to eq "defaults -currentHost xyz export com.nrser.blah /tmp/export.plist"
22
39
  end
23
- end
40
+ end
@@ -221,8 +221,10 @@ describe "Cmds.prepare" do
221
221
  context "specify :repeat behavior" do
222
222
  it "outputs repeated options" do
223
223
  expect(
224
- Cmds.prepare 'blah <%= opts %>',
225
- opts: { list: ['a', 'b', 'see'] } {
224
+ Cmds.prepare(
225
+ 'blah <%= opts %>',
226
+ opts: { list: ['a', 'b', 'see'] }
227
+ ) {
226
228
  { array_mode: :repeat }
227
229
  }
228
230
  ).to eq 'blah --list=a --list=b --list=see'
@@ -232,15 +234,21 @@ describe "Cmds.prepare" do
232
234
  context "specify :json behavior" do
233
235
  it "outputs JSON-encoded options" do
234
236
  expect(
235
- Cmds.prepare 'blah <%= opts %>',
236
- opts: { list: ['a', 'b', 'see'] } {{ array_mode: :json }}
237
+ Cmds.prepare(
238
+ 'blah <%= opts %>',
239
+ opts: { list: ['a', 'b', 'see'] }
240
+ ) {
241
+ { array_mode: :json }
242
+ }
237
243
  ).to eq %{blah --list='["a","b","see"]'}
238
244
  end
239
245
 
240
246
  it "handles single quotes in the string" do
241
247
  expect(
242
- Cmds.prepare 'blah <%= opts %>',
243
- opts: { list: ["you're the best"] } {{ array_mode: :json }}
248
+ Cmds.prepare(
249
+ 'blah <%= opts %>',
250
+ opts: { list: ["you're the best"] }
251
+ ) {{ array_mode: :json }}
244
252
  ).to eq %{blah --list='["you'"'"'re the best"]'}
245
253
 
246
254
 
@@ -41,7 +41,7 @@ describe 'Cmds#stream' do
41
41
  end
42
42
  end
43
43
 
44
- expect(out).to match /^\s+3\n$/
44
+ expect(out).to match /^\s*3\n$/
45
45
  expect(err).to eq ''
46
46
  end
47
47
 
@@ -52,7 +52,7 @@ describe 'Cmds#stream' do
52
52
  end
53
53
  end
54
54
 
55
- expect(out).to match /^\s+3\n$/
55
+ expect(out).to match /^\s*3\n$/
56
56
  end
57
57
  end # input
58
58
 
@@ -66,4 +66,4 @@ describe 'Cmds#stream!' do
66
66
  it "raises when exit code is not 0" do
67
67
  expect { Cmds.new('false').stream! }.to raise_error SystemCallError
68
68
  end
69
- end
69
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-24 00:00:00.000000000 Z
11
+ date: 2018-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nrser
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.0.pre.1
19
+ version: 0.2.0.pre.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.0.pre.1
26
+ version: 0.2.0.pre.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: erubis
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -159,6 +159,7 @@ extra_rdoc_files: []
159
159
  files:
160
160
  - ".gitignore"
161
161
  - ".rspec"
162
+ - ".travis.yml"
162
163
  - ".yardopts"
163
164
  - Gemfile
164
165
  - LICENSE.txt