yacli 0.3.1 → 0.3.2

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
  SHA256:
3
- metadata.gz: 691fb6e6c5a723ad454e5f52beab77e8a5513244881aaa1e57175bc1408ba210
4
- data.tar.gz: 8d5132e2f82c3a995e251c31bc2a745084d43685b6e950917b3f1b5385a02416
3
+ metadata.gz: 2f022deb6f751e2a13810475540f1f90dac5010f7660b3d1dbb4ab1a3be9c67e
4
+ data.tar.gz: 087e00d8b531088dd9aa4d534f8b62cdb81ff5647c425472cf68a52cd885fc68
5
5
  SHA512:
6
- metadata.gz: f99f9427890bc9088275a4dc3e0cf701090a73a686cc62f175aefe14acc1c25559a5177ac02a35730845b3880235c47596ecd3ea7fa640f84ddd08fd597f3386
7
- data.tar.gz: d6540571c43f1889283f7a3a0ea11fa51b24a998d96b92a9ca82cc00ca414a0ef251f20c927989d7ee9c172c601bb050cd6a523c22a885cdae1bb926e2997c3c
6
+ metadata.gz: e87b956f42499ec2fc1f72396882535fffca0d741cc86538b0cd0e28ed6063037d8f4281814bb90820042dece52b0447abec0001254f2bc7e6febadf2b36feb6
7
+ data.tar.gz: 164d396bccddb8b747a36dd0400857f4b5ec3d4025f087367de08b5127bc21278403c579dd38a7557c824b86b9afb867712eaf38c45f816fc88fc28c08345f30
data/README.md CHANGED
@@ -3,7 +3,7 @@ Yacli
3
3
 
4
4
  [![Gem Version](http://img.shields.io/gem/v/yacli.svg)][gem]
5
5
  [![Build Status](http://img.shields.io/travis/rombob/yacli.svg)][travis]
6
- [![Code Climate](http://img.shields.io/codeclimate/github/rombob/yacli.svg)][codeclimate]
6
+ <!-- [![Code Climate](http://img.shields.io/codeclimate/github/rombob/yacli.svg)][codeclimate] -->
7
7
  [![Coverage Status](https://img.shields.io/coveralls/rombob/yacli.svg)][coveralls]
8
8
  [![Codacy Badge](https://api.codacy.com/project/badge/grade/dc6b761f73aa423ba610746d19f8597c)][codacy]
9
9
 
@@ -15,14 +15,14 @@ Yacli
15
15
  Description
16
16
  -----------
17
17
  Yacli a.k.a yet another CLI, is a simple gem allowing to build custom CLI wrappers.
18
- It uses [Thor][thor] as a CLI option manager as well as additional minimal helpers for logging and output handling.
18
+ It uses [Optimist][optimist] as a CLI option manager as well as additional minimal helpers for logging and output handling.
19
19
 
20
20
  Please note: Yacli, by design, is a system tool created to allow seamless file and url
21
21
  access, which should not receive application user input. It relies on [open-uri][open-uri],
22
22
  which combined with application user input would provide a command injection attack
23
23
  vector.
24
24
 
25
- [thor]: https://github.com/ruby/rake
25
+ [optimist]: https://github.com/ManageIQ/optimist
26
26
  [open-uri]: https://ruby-doc.org/stdlib-2.5.1/libdoc/open-uri/rdoc/index.html
27
27
 
28
28
  Prerequisites
@@ -27,7 +27,7 @@ module Yacli
27
27
  end
28
28
 
29
29
  def self.options(&block)
30
- Trollop.options(&block)
30
+ Optimist.options(&block)
31
31
  end
32
32
 
33
33
  def initialize(opt = {})
@@ -1,20 +1,15 @@
1
- require 'thor'
2
-
3
1
  module Yacli
4
- class Cli < Thor
5
- def self.common_opts
6
- method_option :'dry-run', aliases: '-d', type: :boolean, default: false
7
- end
8
-
9
- desc 'cli', 'run cli'
10
- common_opts
11
- method_option :cmd, aliases: '-c', default: 'uname'
12
- def cli
2
+ class Cli
3
+ def self.start
13
4
  require 'yacli/base'
14
5
  b = Base.new
15
- b.cli(options)
16
- # b.log("I'm logging")
17
- # b.log("I'm logging error", :error)
6
+ options = Base.options do
7
+ opt :cmd, "Number of limbs", :default => 'uname', :type => :string
8
+ end
9
+ b.log("running CLI with options: #{options.inspect}")
10
+ result = b.cli(options)
11
+ b.log("result: #{result.inspect}")
12
+ #b.log("I'm logging error", :error)
18
13
  end
19
14
  end
20
15
  end
@@ -1,3 +1,3 @@
1
1
  module Yacli
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+ require 'yacli/base'
3
+
4
+ include Helpers
5
+
6
+ describe Yacli::Run do
7
+ context 'run is successfull' do
8
+ let(:options_hash) { { :monkey=>false, :name=>nil, :num_limbs=>4, :help=>false } }
9
+
10
+ before do
11
+ #allow_any_instance_of(Yacli::Run).to receive(:pass_cli).and_return(nil)
12
+ end
13
+
14
+ it 'parse options' do
15
+ opts = Yacli::Base.options do
16
+ opt :monkey, "Use monkey mode" # flag --monkey, default false
17
+ opt :name, "Monkey name", :type => :string # string --name <s>, default nil
18
+ opt :num_limbs, "Number of limbs", :default => 4 # integer --num-limbs <i>, default to 4
19
+ end
20
+
21
+ expect(opts).to eq options_hash
22
+ end
23
+ end
24
+ end
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "thor", "~> 0.20"
22
21
  spec.add_dependency "optimist", "~> 3.0"
23
22
 
24
23
  spec.add_development_dependency "rspec_junit_formatter", "~> 0.2"
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yacli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rombob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-12 00:00:00.000000000 Z
11
+ date: 2018-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: thor
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0.20'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '0.20'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: optimist
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -189,6 +175,7 @@ files:
189
175
  - lib/yacli/errors.rb
190
176
  - lib/yacli/run.rb
191
177
  - lib/yacli/version.rb
178
+ - spec/base_spec.rb
192
179
  - spec/cli_spec.rb
193
180
  - spec/run_spec.rb
194
181
  - spec/spec_helper.rb
@@ -218,6 +205,7 @@ signing_key:
218
205
  specification_version: 4
219
206
  summary: CLI wrapper library tool
220
207
  test_files:
208
+ - spec/base_spec.rb
221
209
  - spec/cli_spec.rb
222
210
  - spec/run_spec.rb
223
211
  - spec/spec_helper.rb