mamertes 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +15 -0
  2. data/.DS_Store +0 -0
  3. data/.gitignore +6 -0
  4. data/.travis-gemfile +15 -0
  5. data/.travis.yml +10 -0
  6. data/.yardopts +1 -0
  7. data/Gemfile +21 -0
  8. data/README.md +126 -0
  9. data/Rakefile +29 -0
  10. data/doc/Mamertes.html +155 -0
  11. data/doc/Mamertes/Application.html +3057 -0
  12. data/doc/Mamertes/Command.html +7031 -0
  13. data/doc/Mamertes/CommandMethods.html +125 -0
  14. data/doc/Mamertes/CommandMethods/Children.html +1286 -0
  15. data/doc/Mamertes/CommandMethods/Help.html +209 -0
  16. data/doc/Mamertes/Error.html +631 -0
  17. data/doc/Mamertes/Localizer.html +376 -0
  18. data/doc/Mamertes/Option.html +6671 -0
  19. data/doc/Mamertes/Parser.html +276 -0
  20. data/doc/Mamertes/ParserMethods.html +125 -0
  21. data/doc/Mamertes/ParserMethods/General.html +134 -0
  22. data/doc/Mamertes/ParserMethods/General/ClassMethods.html +574 -0
  23. data/doc/Mamertes/Version.html +189 -0
  24. data/doc/_index.html +276 -0
  25. data/doc/class_list.html +54 -0
  26. data/doc/css/common.css +1 -0
  27. data/doc/css/full_list.css +57 -0
  28. data/doc/css/style.css +338 -0
  29. data/doc/file.README.html +198 -0
  30. data/doc/file_list.html +56 -0
  31. data/doc/frames.html +28 -0
  32. data/doc/index.html +198 -0
  33. data/doc/js/app.js +214 -0
  34. data/doc/js/full_list.js +178 -0
  35. data/doc/js/jquery.js +4 -0
  36. data/doc/method_list.html +509 -0
  37. data/doc/top-level-namespace.html +112 -0
  38. data/lib/mamertes.rb +18 -0
  39. data/lib/mamertes/application.rb +206 -0
  40. data/lib/mamertes/command.rb +529 -0
  41. data/lib/mamertes/option.rb +236 -0
  42. data/lib/mamertes/parser.rb +317 -0
  43. data/lib/mamertes/version.rb +24 -0
  44. data/locales/en.yml +40 -0
  45. data/locales/it.yml +40 -0
  46. data/mamertes.gemspec +30 -0
  47. data/spec/coverage_helper.rb +20 -0
  48. data/spec/mamertes/application_spec.rb +181 -0
  49. data/spec/mamertes/command_spec.rb +526 -0
  50. data/spec/mamertes/option_spec.rb +274 -0
  51. data/spec/mamertes/parser_spec.rb +126 -0
  52. data/spec/spec_helper.rb +15 -0
  53. metadata +115 -0
@@ -0,0 +1,198 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" />
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Documentation by YARD 0.8.6.2
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index</a> &raquo;
35
+ <span class="title">File: README</span>
36
+
37
+
38
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
39
+ </div>
40
+
41
+ <div id="search">
42
+
43
+ <a class="full_list_link" id="class_list_link"
44
+ href="class_list.html">
45
+ Class List
46
+ </a>
47
+
48
+ <a class="full_list_link" id="method_list_link"
49
+ href="method_list.html">
50
+ Method List
51
+ </a>
52
+
53
+ <a class="full_list_link" id="file_list_link"
54
+ href="file_list.html">
55
+ File List
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <iframe id="search_frame"></iframe>
63
+
64
+ <div id="content"><div id='filecontents'><h1 id="mamertes">mamertes</h1>
65
+
66
+ <p><a href="http://badge.fury.io/rb/mamertes"><img src="https://badge.fury.io/rb/mamertes.png" alt="Gem Version" /></a>
67
+ <a href="https://gemnasium.com/ShogunPanda/mamertes"><img src="https://gemnasium.com/ShogunPanda/mamertes.png?travis" alt="Dependency Status" /></a>
68
+ <a href="http://travis-ci.org/ShogunPanda/mamertes"><img src="https://secure.travis-ci.org/ShogunPanda/mamertes.png?branch=master" alt="Build Status" /></a>
69
+ <a href="https://codeclimate.com/github/ShogunPanda/mamertes"><img src="https://codeclimate.com/github/ShogunPanda/mamertes.png" alt="Code Climate" /></a>
70
+ <a href="https://coveralls.io/r/ShogunPanda/mamertes"><img src="https://coveralls.io/repos/ShogunPanda/mamertes/badge.png" alt="Coverage Status" /></a></p>
71
+
72
+ <p>Yet another command line manager.</p>
73
+
74
+ <p>http://sw.cow.tc/mamertes</p>
75
+
76
+ <p>http://rdoc.info/gems/mamertes</p>
77
+
78
+ <h2 id="basic-usage">Basic usage.</h2>
79
+
80
+ <p>As ever, talking by example is always better.
81
+ This application:</p>
82
+
83
+ <p>```ruby
84
+ require &#8220;rubygems&#8221;
85
+ require &#8220;mamertes&#8221;</p>
86
+
87
+ <p>Mamertes::Application.create(name: &#8220;Mamertes Usage Test&#8221;, version: &#8220;1.0.0&#8221;, description: &#8220;An example modelled like a TODO application&#8221;, banner: &#8220;Do you like Mamertes?&#8221;) do
88
+ option(:storage, [&#8220;f&#8221;, &#8220;file&#8221;], String, help: &#8220;The file where store TODOs to.&#8221;, meta: &#8220;FILE&#8221;)</p>
89
+
90
+ <p>command :list do
91
+ description &#8220;List all TODOs.&#8221;
92
+ action do |command|
93
+ # You should implement this.
94
+ end
95
+ end</p>
96
+
97
+ <p>command :manage, &#8220;Manage existing TODO.&#8221; do
98
+ option(:verbose, [], &#8220;Be verbose.&#8221;)</p>
99
+
100
+ <pre class="code ruby"><code class="ruby">action do |command|
101
+ puts &quot;Please use \&quot;add\&quot; or \&quot;remove\&quot; subcommands.&quot;
102
+ end
103
+
104
+ command :add, {description: &quot;Add a TODO.&quot;} do
105
+ action do |command|
106
+ # You should implement this.
107
+ end
108
+ end
109
+
110
+ command :remove, {description: &quot;Removes a TODO.&quot;} do
111
+ action do |command|
112
+ # You should implement this.
113
+ end
114
+ end end end ```
115
+ </code></pre>
116
+
117
+ <p>Will create a complete (at least at the interface model) TODO application which support commands <code>list</code> and <code>manage</code>.</p>
118
+
119
+ <p>The <code>manage</code> command supports subcommands <code>add</code> and <code>remove</code>. You can invoke it via syntax <code>manage add</code> or <code>manage:add</code>. <strong>If there is no conflict, just <code>m:r</code> is sufficient!</strong></p>
120
+
121
+ <p>To provide (sub)commands, both hash-style or block-style method style are supported (except for the <code>action</code> option), as you can see in the example.</p>
122
+
123
+ <p>You can use the <code>--help</code> switch or the <code>help command</code> syntax to navigate through commands details.</p>
124
+
125
+ <p>After setting up the skeleton, you will just need to write the action bodies and you&#8217;re done. <strong>Happy coding!</strong></p>
126
+
127
+ <h3 id="wrapping-up-the-example">Wrapping up the example</h3>
128
+ <p>Here&#8217;s the help screen of the application above for the global application and for the <code>manage</code> command.</p>
129
+
130
+ <h4 id="general-help">General help</h4>
131
+
132
+ <p>```
133
+ $ ./test -h
134
+ [NAME]
135
+ Mamertes Usage Test 1.0.0 - An example modelled like a TODO application</p>
136
+
137
+ <p>[SYNOPSIS]
138
+ test [options] [command [subcommand &#8230;]][command-options] [arguments]</p>
139
+
140
+ <p>[DESCRIPTION]
141
+ Do you like Mamertes?</p>
142
+
143
+ <p>[GLOBAL OPTIONS]
144
+ -f FILE, &#8211;file FILE - The file where store TODOs to.
145
+ -h, &#8211;help - Shows this message.</p>
146
+
147
+ <p>[COMMANDS]
148
+ help - Shows a help about a command.
149
+ list - List all TODOs.
150
+ manage - Manage existing TODO.
151
+ ```</p>
152
+
153
+ <h4 id="the-manage-command-help">The <code>manage</code> command help</h4>
154
+
155
+ <p>```
156
+ $ ./test help manage
157
+ [SYNOPSIS]
158
+ test [options] manage [subcommand &#8230;]] [command-options] [arguments]</p>
159
+
160
+ <p>[OPTIONS]
161
+ -v, &#8211;verbose - Be verbose.</p>
162
+
163
+ <p>[SUBCOMMANDS]
164
+ add - Add a TODO.
165
+ remove - Removes a TODO.
166
+ ```</p>
167
+
168
+ <h2 id="advanced-usage">Advanced usage</h2>
169
+
170
+ <p>See documentation for more information.</p>
171
+
172
+ <h2 id="contributing-to-mamertes">Contributing to mamertes</h2>
173
+
174
+ <ul>
175
+ <li>Check out the latest master to make sure the feature hasn&#8217;t been implemented or the bug hasn&#8217;t been fixed yet.</li>
176
+ <li>Check out the issue tracker to make sure someone already hasn&#8217;t requested it and/or contributed it.</li>
177
+ <li>Fork the project.</li>
178
+ <li>Start a feature/bugfix branch.</li>
179
+ <li>Commit and push until you are happy with your contribution.</li>
180
+ <li>Make sure to add tests for it. This is important so I don&#8217;t break it in a future version unintentionally.</li>
181
+ <li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
182
+ </ul>
183
+
184
+ <h2 id="copyright">Copyright</h2>
185
+
186
+ <p>Copyright (C) 2013 and above Shogun (shogun_panda@me.com).</p>
187
+
188
+ <p>Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php).</p>
189
+ </div></div>
190
+
191
+ <div id="footer">
192
+ Generated on Sat Aug 10 16:23:08 2013 by
193
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
194
+ 0.8.6.2 (ruby-1.9.3).
195
+ </div>
196
+
197
+ </body>
198
+ </html>
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <title>File List</title>
19
+ <base id="base_target" target="_parent" />
20
+ </head>
21
+ <body>
22
+ <script type="text/javascript" charset="utf-8">
23
+ if (window.top.frames.main) {
24
+ document.getElementById('base_target').target = 'main';
25
+ document.body.className = 'frames';
26
+ }
27
+ </script>
28
+ <div id="content">
29
+ <h1 id="full_list_header">File List</h1>
30
+ <div id="nav">
31
+
32
+ <span><a target="_self" href="class_list.html">
33
+ Classes
34
+ </a></span>
35
+
36
+ <span><a target="_self" href="method_list.html">
37
+ Methods
38
+ </a></span>
39
+
40
+ <span><a target="_self" href="file_list.html">
41
+ Files
42
+ </a></span>
43
+
44
+ </div>
45
+ <div id="search">Search: <input type="text" /></div>
46
+
47
+ <ul id="full_list" class="file">
48
+
49
+
50
+ <li class="r1"><span class="object_link"><a href="index.html" title="README">README</a></a></li>
51
+
52
+
53
+ </ul>
54
+ </div>
55
+ </body>
56
+ </html>
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
+ <title>Documentation by YARD 0.8.6.2</title>
8
+ </head>
9
+ <script type="text/javascript" charset="utf-8">
10
+ window.onload = function() {
11
+ var match = window.location.hash.match(/^#!(.+)/);
12
+ var name = 'index.html';
13
+ if (match) {
14
+ name = unescape(match[1]);
15
+ }
16
+ document.writeln('<frameset cols="20%,*">' +
17
+ '<frame name="list" src="class_list.html" />' +
18
+ '<frame name="main" src="' + name + '" />' +
19
+ '</frameset>');
20
+ }
21
+ </script>
22
+ <noscript>
23
+ <frameset cols="20%,*">
24
+ <frame name="list" src="class_list.html" />
25
+ <frame name="main" src="index.html" />
26
+ </frameset>
27
+ </noscript>
28
+ </html>
@@ -0,0 +1,198 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" />
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Documentation by YARD 0.8.6.2
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index</a> &raquo;
35
+ <span class="title">File: README</span>
36
+
37
+
38
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
39
+ </div>
40
+
41
+ <div id="search">
42
+
43
+ <a class="full_list_link" id="class_list_link"
44
+ href="class_list.html">
45
+ Class List
46
+ </a>
47
+
48
+ <a class="full_list_link" id="method_list_link"
49
+ href="method_list.html">
50
+ Method List
51
+ </a>
52
+
53
+ <a class="full_list_link" id="file_list_link"
54
+ href="file_list.html">
55
+ File List
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <iframe id="search_frame"></iframe>
63
+
64
+ <div id="content"><div id='filecontents'><h1 id="mamertes">mamertes</h1>
65
+
66
+ <p><a href="http://badge.fury.io/rb/mamertes"><img src="https://badge.fury.io/rb/mamertes.png" alt="Gem Version" /></a>
67
+ <a href="https://gemnasium.com/ShogunPanda/mamertes"><img src="https://gemnasium.com/ShogunPanda/mamertes.png?travis" alt="Dependency Status" /></a>
68
+ <a href="http://travis-ci.org/ShogunPanda/mamertes"><img src="https://secure.travis-ci.org/ShogunPanda/mamertes.png?branch=master" alt="Build Status" /></a>
69
+ <a href="https://codeclimate.com/github/ShogunPanda/mamertes"><img src="https://codeclimate.com/github/ShogunPanda/mamertes.png" alt="Code Climate" /></a>
70
+ <a href="https://coveralls.io/r/ShogunPanda/mamertes"><img src="https://coveralls.io/repos/ShogunPanda/mamertes/badge.png" alt="Coverage Status" /></a></p>
71
+
72
+ <p>Yet another command line manager.</p>
73
+
74
+ <p>http://sw.cow.tc/mamertes</p>
75
+
76
+ <p>http://rdoc.info/gems/mamertes</p>
77
+
78
+ <h2 id="basic-usage">Basic usage.</h2>
79
+
80
+ <p>As ever, talking by example is always better.
81
+ This application:</p>
82
+
83
+ <p>```ruby
84
+ require &#8220;rubygems&#8221;
85
+ require &#8220;mamertes&#8221;</p>
86
+
87
+ <p>Mamertes::Application.create(name: &#8220;Mamertes Usage Test&#8221;, version: &#8220;1.0.0&#8221;, description: &#8220;An example modelled like a TODO application&#8221;, banner: &#8220;Do you like Mamertes?&#8221;) do
88
+ option(:storage, [&#8220;f&#8221;, &#8220;file&#8221;], String, help: &#8220;The file where store TODOs to.&#8221;, meta: &#8220;FILE&#8221;)</p>
89
+
90
+ <p>command :list do
91
+ description &#8220;List all TODOs.&#8221;
92
+ action do |command|
93
+ # You should implement this.
94
+ end
95
+ end</p>
96
+
97
+ <p>command :manage, &#8220;Manage existing TODO.&#8221; do
98
+ option(:verbose, [], &#8220;Be verbose.&#8221;)</p>
99
+
100
+ <pre class="code ruby"><code class="ruby">action do |command|
101
+ puts &quot;Please use \&quot;add\&quot; or \&quot;remove\&quot; subcommands.&quot;
102
+ end
103
+
104
+ command :add, {description: &quot;Add a TODO.&quot;} do
105
+ action do |command|
106
+ # You should implement this.
107
+ end
108
+ end
109
+
110
+ command :remove, {description: &quot;Removes a TODO.&quot;} do
111
+ action do |command|
112
+ # You should implement this.
113
+ end
114
+ end end end ```
115
+ </code></pre>
116
+
117
+ <p>Will create a complete (at least at the interface model) TODO application which support commands <code>list</code> and <code>manage</code>.</p>
118
+
119
+ <p>The <code>manage</code> command supports subcommands <code>add</code> and <code>remove</code>. You can invoke it via syntax <code>manage add</code> or <code>manage:add</code>. <strong>If there is no conflict, just <code>m:r</code> is sufficient!</strong></p>
120
+
121
+ <p>To provide (sub)commands, both hash-style or block-style method style are supported (except for the <code>action</code> option), as you can see in the example.</p>
122
+
123
+ <p>You can use the <code>--help</code> switch or the <code>help command</code> syntax to navigate through commands details.</p>
124
+
125
+ <p>After setting up the skeleton, you will just need to write the action bodies and you&#8217;re done. <strong>Happy coding!</strong></p>
126
+
127
+ <h3 id="wrapping-up-the-example">Wrapping up the example</h3>
128
+ <p>Here&#8217;s the help screen of the application above for the global application and for the <code>manage</code> command.</p>
129
+
130
+ <h4 id="general-help">General help</h4>
131
+
132
+ <p>```
133
+ $ ./test -h
134
+ [NAME]
135
+ Mamertes Usage Test 1.0.0 - An example modelled like a TODO application</p>
136
+
137
+ <p>[SYNOPSIS]
138
+ test [options] [command [subcommand &#8230;]][command-options] [arguments]</p>
139
+
140
+ <p>[DESCRIPTION]
141
+ Do you like Mamertes?</p>
142
+
143
+ <p>[GLOBAL OPTIONS]
144
+ -f FILE, &#8211;file FILE - The file where store TODOs to.
145
+ -h, &#8211;help - Shows this message.</p>
146
+
147
+ <p>[COMMANDS]
148
+ help - Shows a help about a command.
149
+ list - List all TODOs.
150
+ manage - Manage existing TODO.
151
+ ```</p>
152
+
153
+ <h4 id="the-manage-command-help">The <code>manage</code> command help</h4>
154
+
155
+ <p>```
156
+ $ ./test help manage
157
+ [SYNOPSIS]
158
+ test [options] manage [subcommand &#8230;]] [command-options] [arguments]</p>
159
+
160
+ <p>[OPTIONS]
161
+ -v, &#8211;verbose - Be verbose.</p>
162
+
163
+ <p>[SUBCOMMANDS]
164
+ add - Add a TODO.
165
+ remove - Removes a TODO.
166
+ ```</p>
167
+
168
+ <h2 id="advanced-usage">Advanced usage</h2>
169
+
170
+ <p>See documentation for more information.</p>
171
+
172
+ <h2 id="contributing-to-mamertes">Contributing to mamertes</h2>
173
+
174
+ <ul>
175
+ <li>Check out the latest master to make sure the feature hasn&#8217;t been implemented or the bug hasn&#8217;t been fixed yet.</li>
176
+ <li>Check out the issue tracker to make sure someone already hasn&#8217;t requested it and/or contributed it.</li>
177
+ <li>Fork the project.</li>
178
+ <li>Start a feature/bugfix branch.</li>
179
+ <li>Commit and push until you are happy with your contribution.</li>
180
+ <li>Make sure to add tests for it. This is important so I don&#8217;t break it in a future version unintentionally.</li>
181
+ <li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
182
+ </ul>
183
+
184
+ <h2 id="copyright">Copyright</h2>
185
+
186
+ <p>Copyright (C) 2013 and above Shogun (shogun_panda@me.com).</p>
187
+
188
+ <p>Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php).</p>
189
+ </div></div>
190
+
191
+ <div id="footer">
192
+ Generated on Sat Aug 10 16:23:08 2013 by
193
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
194
+ 0.8.6.2 (ruby-1.9.3).
195
+ </div>
196
+
197
+ </body>
198
+ </html>