console_runner 0.1.2 → 0.1.3

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: 536a22f5c750f346fc7688315a6c309a36a3af1c
4
- data.tar.gz: b5466496a8650cd2b9c5ec8d4b73bb46e18a870f
3
+ metadata.gz: dfc0511852127d604ae309cfc39364d21107e0b6
4
+ data.tar.gz: 4aad476abc1e57409be5b61925deacc2e30b4354
5
5
  SHA512:
6
- metadata.gz: c5df1a7e4eda87dafbb436f4e1aadc6ef562d58529b8eedeed9713ac8a6f9ce29a8cab33f51562b9a09b984b0564ff4d32a1a6b4797bf57dff7255aafc493c8e
7
- data.tar.gz: 5ed013791df3f7a7dd0b0efbe1cd6614b956899fb0508c572bef1bcde52c830b6e46e0b23716ef6e302d5fbc4714010e28993f99e8d4346f0a56b2d020387b10
6
+ metadata.gz: 7c8ce2344ea0ed28c89a0df3c3d46adc04b1a6eda040c39a6b6264e3729a78dc06ad8eec97e7ac29672aaa24a11d9ad7767f0b7ab4eb7a875b46325bc7272064
7
+ data.tar.gz: 71373f02f65eec0cecf438eb72d4f33bd7c09bb076d7509e7df2ff5dad612b91babbce3d408e321e8afec1c14c6839f421b0108c318ef8cf5998db84ae6fd28b
data/README.md CHANGED
@@ -25,8 +25,85 @@ Or install it yourself as:
25
25
  $ gem install console_runner
26
26
 
27
27
  ## Usage
28
+ Usage is simple. First of all you need to add `gem 'console_runner'` in your `Gemfile`.
29
+ Then you need to specify `@runnable` tag in your class and method annotations. For example,
30
+
31
+ ```ruby
32
+ # This is basic Ruby class with YARD annotation.
33
+ # Nothing special here except @runnable tag. This is a `console_runner` tag that
34
+ # shows that this class can be runnable via bash command line.
35
+ #
36
+ # You can mark any method (class method or instance method) with @runnable tag to show you want the method to be executable.
37
+ # We name class method as *class action* and instance method as *instance action* or just *action*.
38
+ # Instance action requires #initialize method to be executed first. `console_runner` tool invokes #initialize
39
+ # method automatically.
40
+ #
41
+ # @author Yuri Karpovich
42
+ #
43
+ # @runnable This is your "smart" assistant tool.
44
+ # NOTE: This message will be shown in your tool in --help menu.
45
+ #
46
+ # @since 0.1.0
47
+ class SimpleSiri
48
+
49
+ def initialize
50
+ @name = 'Siri'
51
+ @age = Random.rand 100
52
+ end
53
+
54
+ # Say something
55
+ #
56
+ # @runnable
57
+ # @return [String]
58
+ # @param [String] what_to_say ask name or age of Siri
59
+ def say(what_to_say)
60
+ case what_to_say.downcase
61
+ when 'name'
62
+ puts 'My name is ' + @name
63
+ when 'age'
64
+ puts "I'm #{@age} years old"
65
+ else
66
+ puts "I don't know".green
67
+ end
68
+ end
69
+
70
+ end
71
+ ```
72
+
73
+ Then you can run the tool in your console:
74
+ ```bash
75
+ c_run ruby_class.rb say --help
76
+
77
+ This is your "smart" assistant tool.
78
+ NOTE: This message will be shown in your tool in --help menu.
79
+ -h, --help Show this message
80
+ -w, --what-to-say=<s> (Ruby class: String) ask name or age of Siri
81
+ ```
82
+
83
+ ```bash
84
+ c_run ruby_class.rb say -w age
85
+
86
+ =======================================================
87
+ Global options:
88
+ help = false
89
+ INIT: initialize
90
+ INIT options:
91
+
92
+ Subcommand: say
93
+ Subcommand options:
94
+ what_to_say = age
95
+ =======================================================
96
+ Start Time: 2017-04-11 21:39:40 +0300
97
+ I'm 78 years old
98
+ Finish Time: 2017-04-11 21:39:40 +0300 (Duration: 0.0 minutes)
99
+
100
+ ```
28
101
 
29
- TODO: Write usage instructions here
102
+ ## ToDo
103
+ - fix help menu for action: action help text should be displayed.
104
+ - add tests for class actions
105
+ - add tests for same methods naming
106
+ - write good readme
30
107
 
31
108
  ## Development
32
109
 
@@ -1,3 +1,3 @@
1
1
  module ConsoleRunner
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console_runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Karpovich