honey 0.0.6
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.
- data/.gitignore +14 -0
- data/.rspec +1 -0
- data/.travis.yml +19 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +55 -0
- data/Rakefile +26 -0
- data/bin/apiary +12 -0
- data/bin/honey +12 -0
- data/doc/Apiary.html +131 -0
- data/doc/Apiary/CLI.html +480 -0
- data/doc/Apiary/Command.html +117 -0
- data/doc/Apiary/Command/Help.html +331 -0
- data/doc/Apiary/Command/Preview.html +1102 -0
- data/doc/Apiary/Command/Runner.html +201 -0
- data/doc/Apiary/Command/Version.html +201 -0
- data/doc/_index.html +192 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +328 -0
- data/doc/file.README.html +119 -0
- data/doc/file_list.html +55 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +119 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +252 -0
- data/doc/top-level-namespace.html +112 -0
- data/honey.gemspec +27 -0
- data/lib/honey.rb +7 -0
- data/lib/honey/cli.rb +70 -0
- data/lib/honey/command/help.rb +36 -0
- data/lib/honey/command/preview.rb +103 -0
- data/lib/honey/command/publish.rb +74 -0
- data/lib/honey/command/runner.rb +13 -0
- data/lib/honey/command/version.rb +13 -0
- data/lib/honey/version.rb +3 -0
- data/lib/okapi.rb +13 -0
- data/lib/okapi/apiary_connector.rb +98 -0
- data/lib/okapi/cli.rb +122 -0
- data/lib/okapi/config.rb +13 -0
- data/lib/okapi/examples/apiary.apib +59 -0
- data/lib/okapi/examples/apiary.yaml +5 -0
- data/lib/okapi/examples/tests.spec +6 -0
- data/lib/okapi/examples/tests2.spec +3 -0
- data/lib/okapi/exceptions.rb +0 -0
- data/lib/okapi/help.rb +36 -0
- data/lib/okapi/okapi +43 -0
- data/lib/okapi/output.rb +14 -0
- data/lib/okapi/outputs/base.rb +91 -0
- data/lib/okapi/outputs/tap.rb +44 -0
- data/lib/okapi/resources.rb +53 -0
- data/lib/okapi/spec_parser.rb +82 -0
- data/lib/okapi/test.rb +141 -0
- data/spec/cli_spec.rb +9 -0
- data/spec/spec_helper.rb +2 -0
- metadata +205 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/.travis.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- "1.8.7"
|
4
|
+
- "1.9.2"
|
5
|
+
- "1.9.3"
|
6
|
+
- jruby-18mode # JRuby in 1.8 mode
|
7
|
+
- jruby-19mode # JRuby in 1.9 mode
|
8
|
+
- rbx-18mode
|
9
|
+
- rbx-19mode
|
10
|
+
|
11
|
+
notifications:
|
12
|
+
email:
|
13
|
+
recipients:
|
14
|
+
- lukas@apiary.io
|
15
|
+
- adam@apiary.io
|
16
|
+
on_success: change
|
17
|
+
on_failure: always
|
18
|
+
hipchat:
|
19
|
+
- secure: "HqBUrmf4P2bgvwb4b9PL1tBae2wcZaXadOgwRwAFhdhDZFHaKXIXlJRUW8tN\ntdO83OZgatxJrpWWQj8VYTfDuhlE3b3NxVWeXc3PkfrHmuvejQf4veh7kwR0\njLVE6jb+ZbFIwRE2W0VFLFKYQHI6PLem4W0OKXW5Shqzy8Ewlow="
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Emili Parreno
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
Honey: All you need to attract API bees
|
2
|
+
==========================================
|
3
|
+
|
4
|
+
Command Line Interface to [Apiary](http://apiary.io])
|
5
|
+
|
6
|
+
[](https://travis-ci.org/apiaryio/honey)
|
7
|
+
|
8
|
+
|
9
|
+
## Install
|
10
|
+
|
11
|
+
``` bash
|
12
|
+
gem install honey
|
13
|
+
```
|
14
|
+
|
15
|
+
|
16
|
+
## Description
|
17
|
+
|
18
|
+
Apiaryio gem provides a way to test and display your API documentation on your local
|
19
|
+
machine, either using static files or using a standalone web server...
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
$ apiary help
|
24
|
+
|
25
|
+
Usage: apiary command [options]
|
26
|
+
Try 'apiary help' for more information.
|
27
|
+
|
28
|
+
Currently available apiary commands are:
|
29
|
+
|
30
|
+
preview Show API documentation in default browser
|
31
|
+
preview --browser [chrome|safari|firefox] Show API documentation in specified browser
|
32
|
+
preview --path [PATH] Specify path to blueprint file
|
33
|
+
preview --api_host [HOST] Specify apiary host
|
34
|
+
preview --server Start standalone web server on port 8080
|
35
|
+
preview --server --port [PORT] Start standalone web server on specified port
|
36
|
+
okapi help Show okapi testing tool help
|
37
|
+
help Show help
|
38
|
+
|
39
|
+
version Show version
|
40
|
+
|
41
|
+
## Copyright
|
42
|
+
|
43
|
+
Copyright 2012-2013 (c) Apiary Ltd.
|
44
|
+
|
45
|
+
## Contributors
|
46
|
+
|
47
|
+
- Jakub Nešetřil
|
48
|
+
- James Charles Russell
|
49
|
+
- Lukáš Linhart
|
50
|
+
- Emili Parreño
|
51
|
+
- Peter Grilli [Tu1ly]
|
52
|
+
|
53
|
+
## License
|
54
|
+
|
55
|
+
Released under MIT license. See LICENSE file for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "rubygems"
|
3
|
+
require "rspec/core/rake_task"
|
4
|
+
require 'yard'
|
5
|
+
|
6
|
+
desc "Run all specs"
|
7
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
8
|
+
t.verbose = true
|
9
|
+
end
|
10
|
+
|
11
|
+
desc 'Default: Run all specs.'
|
12
|
+
task :default => :spec
|
13
|
+
|
14
|
+
task :doc => :yard
|
15
|
+
task :gem => :gemspec
|
16
|
+
|
17
|
+
def gemspec
|
18
|
+
@gemspec ||= eval(File.read('honey.gemspec'), binding, '.gemspec')
|
19
|
+
end
|
20
|
+
|
21
|
+
YARD::Rake::YardocTask.new
|
22
|
+
|
23
|
+
desc "Validate the gemspec"
|
24
|
+
task :gemspec do
|
25
|
+
gemspec.validate
|
26
|
+
end
|
data/bin/apiary
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..','lib')))
|
3
|
+
require 'honey'
|
4
|
+
require 'okapi'
|
5
|
+
|
6
|
+
trap(:INT) { abort "" }
|
7
|
+
if ARGV[0] == 'okapi' || ARGV[0] == 'test'
|
8
|
+
ARGV.delete_at(0)
|
9
|
+
Honey::Okapi::CLI.new(ARGV)
|
10
|
+
else
|
11
|
+
Honey::CLI.new(ARGV)
|
12
|
+
end
|
data/bin/honey
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..','lib')))
|
3
|
+
require 'honey'
|
4
|
+
require 'okapi'
|
5
|
+
|
6
|
+
trap(:INT) { abort "" }
|
7
|
+
if ARGV[0] == 'okapi' || ARGV[0] == 'test'
|
8
|
+
ARGV.delete_at(0)
|
9
|
+
Honey::Okapi::CLI.new(ARGV)
|
10
|
+
else
|
11
|
+
Honey::CLI.new(ARGV)
|
12
|
+
end
|
data/doc/Apiary.html
ADDED
@@ -0,0 +1,131 @@
|
|
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=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Apiary
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" 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)</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">Apiary</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Apiary
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/apiary.rb<span class="defines">,<br />
|
83
|
+
lib/apiary/cli.rb,<br /> lib/apiary/version.rb,<br /> lib/apiary/command/help.rb,<br /> lib/apiary/command/runner.rb,<br /> lib/apiary/command/version.rb,<br /> lib/apiary/command/preview.rb</span>
|
84
|
+
</dd>
|
85
|
+
|
86
|
+
</dl>
|
87
|
+
<div class="clear"></div>
|
88
|
+
|
89
|
+
<h2>Defined Under Namespace</h2>
|
90
|
+
<p class="children">
|
91
|
+
|
92
|
+
|
93
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Apiary/Command.html" title="Apiary::Command (module)">Command</a></span>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Apiary/CLI.html" title="Apiary::CLI (class)">CLI</a></span>
|
98
|
+
|
99
|
+
|
100
|
+
</p>
|
101
|
+
|
102
|
+
<h2>Constant Summary</h2>
|
103
|
+
|
104
|
+
<dl class="constants">
|
105
|
+
|
106
|
+
<dt id="VERSION-constant" class="">VERSION =
|
107
|
+
|
108
|
+
</dt>
|
109
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0.1</span><span class='tstring_end'>"</span></span></pre></dd>
|
110
|
+
|
111
|
+
</dl>
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
<div id="footer">
|
125
|
+
Generated on Tue Aug 7 17:58:18 2012 by
|
126
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
127
|
+
0.8.2.1 (ruby-1.9.2).
|
128
|
+
</div>
|
129
|
+
|
130
|
+
</body>
|
131
|
+
</html>
|
data/doc/Apiary/CLI.html
ADDED
@@ -0,0 +1,480 @@
|
|
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=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Apiary::CLI
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" 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 (C)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Apiary.html" title="Apiary (module)">Apiary</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">CLI</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Apiary::CLI
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Apiary::CLI</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/apiary/cli.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
107
|
+
<ul class="summary">
|
108
|
+
|
109
|
+
<li class="public ">
|
110
|
+
<span class="summary_signature">
|
111
|
+
|
112
|
+
<a href="#command-instance_method" title="#command (instance method)">- (Object) <strong>command</strong> </a>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
</span>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<span class="note title readonly">readonly</span>
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
<span class="summary_desc"><div class='inline'><p>
|
132
|
+
Returns the value of attribute command.
|
133
|
+
</p>
|
134
|
+
</div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
</ul>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<h2>
|
146
|
+
Instance Method Summary
|
147
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
148
|
+
</h2>
|
149
|
+
|
150
|
+
<ul class="summary">
|
151
|
+
|
152
|
+
<li class="public ">
|
153
|
+
<span class="summary_signature">
|
154
|
+
|
155
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (CLI) <strong>initialize</strong>(args) </a>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
</span>
|
160
|
+
|
161
|
+
|
162
|
+
<span class="note title constructor">constructor</span>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<span class="summary_desc"><div class='inline'><p>
|
172
|
+
A new instance of CLI.
|
173
|
+
</p>
|
174
|
+
</div></span>
|
175
|
+
|
176
|
+
</li>
|
177
|
+
|
178
|
+
|
179
|
+
<li class="public ">
|
180
|
+
<span class="summary_signature">
|
181
|
+
|
182
|
+
<a href="#parse_options%21-instance_method" title="#parse_options! (instance method)">- (Object) <strong>parse_options!</strong>(args) </a>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
</span>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
197
|
+
|
198
|
+
</li>
|
199
|
+
|
200
|
+
|
201
|
+
<li class="public ">
|
202
|
+
<span class="summary_signature">
|
203
|
+
|
204
|
+
<a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong>(args, options) </a>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
</span>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
219
|
+
|
220
|
+
</li>
|
221
|
+
|
222
|
+
|
223
|
+
</ul>
|
224
|
+
|
225
|
+
|
226
|
+
<div id="constructor_details" class="method_details_list">
|
227
|
+
<h2>Constructor Details</h2>
|
228
|
+
|
229
|
+
<div class="method_details first">
|
230
|
+
<h3 class="signature first" id="initialize-instance_method">
|
231
|
+
|
232
|
+
- (<tt><span class='object_link'><a href="" title="Apiary::CLI (class)">CLI</a></span></tt>) <strong>initialize</strong>(args)
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
</h3><div class="docstring">
|
239
|
+
<div class="discussion">
|
240
|
+
<p>
|
241
|
+
A new instance of CLI
|
242
|
+
</p>
|
243
|
+
|
244
|
+
|
245
|
+
</div>
|
246
|
+
</div>
|
247
|
+
<div class="tags">
|
248
|
+
|
249
|
+
|
250
|
+
</div><table class="source_code">
|
251
|
+
<tr>
|
252
|
+
<td>
|
253
|
+
<pre class="lines">
|
254
|
+
|
255
|
+
|
256
|
+
9
|
257
|
+
10
|
258
|
+
11
|
259
|
+
12</pre>
|
260
|
+
</td>
|
261
|
+
<td>
|
262
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 9</span>
|
263
|
+
|
264
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
265
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_options!'>parse_options!</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
266
|
+
<span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
267
|
+
<span class='kw'>end</span></pre>
|
268
|
+
</td>
|
269
|
+
</tr>
|
270
|
+
</table>
|
271
|
+
</div>
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
<div id="instance_attr_details" class="attr_details">
|
276
|
+
<h2>Instance Attribute Details</h2>
|
277
|
+
|
278
|
+
|
279
|
+
<span id=""></span>
|
280
|
+
<div class="method_details first">
|
281
|
+
<h3 class="signature first" id="command-instance_method">
|
282
|
+
|
283
|
+
- (<tt>Object</tt>) <strong>command</strong> <span class="extras">(readonly)</span>
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
</h3><div class="docstring">
|
290
|
+
<div class="discussion">
|
291
|
+
<p>
|
292
|
+
Returns the value of attribute command
|
293
|
+
</p>
|
294
|
+
|
295
|
+
|
296
|
+
</div>
|
297
|
+
</div>
|
298
|
+
<div class="tags">
|
299
|
+
|
300
|
+
|
301
|
+
</div><table class="source_code">
|
302
|
+
<tr>
|
303
|
+
<td>
|
304
|
+
<pre class="lines">
|
305
|
+
|
306
|
+
|
307
|
+
7
|
308
|
+
8
|
309
|
+
9</pre>
|
310
|
+
</td>
|
311
|
+
<td>
|
312
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 7</span>
|
313
|
+
|
314
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_command'>command</span>
|
315
|
+
<span class='ivar'>@command</span>
|
316
|
+
<span class='kw'>end</span></pre>
|
317
|
+
</td>
|
318
|
+
</tr>
|
319
|
+
</table>
|
320
|
+
</div>
|
321
|
+
|
322
|
+
</div>
|
323
|
+
|
324
|
+
|
325
|
+
<div id="instance_method_details" class="method_details_list">
|
326
|
+
<h2>Instance Method Details</h2>
|
327
|
+
|
328
|
+
|
329
|
+
<div class="method_details first">
|
330
|
+
<h3 class="signature first" id="parse_options!-instance_method">
|
331
|
+
|
332
|
+
- (<tt>Object</tt>) <strong>parse_options!</strong>(args)
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
</h3><table class="source_code">
|
339
|
+
<tr>
|
340
|
+
<td>
|
341
|
+
<pre class="lines">
|
342
|
+
|
343
|
+
|
344
|
+
20
|
345
|
+
21
|
346
|
+
22
|
347
|
+
23
|
348
|
+
24
|
349
|
+
25
|
350
|
+
26
|
351
|
+
27
|
352
|
+
28
|
353
|
+
29
|
354
|
+
30
|
355
|
+
31
|
356
|
+
32
|
357
|
+
33
|
358
|
+
34
|
359
|
+
35
|
360
|
+
36
|
361
|
+
37
|
362
|
+
38
|
363
|
+
39
|
364
|
+
40
|
365
|
+
41
|
366
|
+
42
|
367
|
+
43
|
368
|
+
44
|
369
|
+
45
|
370
|
+
46
|
371
|
+
47
|
372
|
+
48
|
373
|
+
49
|
374
|
+
50
|
375
|
+
51
|
376
|
+
52
|
377
|
+
53
|
378
|
+
54
|
379
|
+
55
|
380
|
+
56
|
381
|
+
57
|
382
|
+
58
|
383
|
+
59
|
384
|
+
60</pre>
|
385
|
+
</td>
|
386
|
+
<td>
|
387
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 20</span>
|
388
|
+
|
389
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_parse_options!'>parse_options!</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
390
|
+
<span class='ivar'>@command</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
391
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
392
|
+
<span class='id identifier rubyid_options_parser'>options_parser</span> <span class='op'>=</span> <span class='const'>OptionParser</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_opts'>opts</span><span class='op'>|</span>
|
393
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--path [PATH]</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_path'>path</span><span class='op'>|</span>
|
394
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:apib_path</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
|
395
|
+
<span class='kw'>end</span>
|
396
|
+
|
397
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--api_host API_HOST</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_api_host'>api_host</span><span class='op'>|</span>
|
398
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:api_host</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_api_host'>api_host</span>
|
399
|
+
<span class='kw'>end</span>
|
400
|
+
|
401
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--browser BROWSER</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_browser'>browser</span><span class='op'>|</span>
|
402
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:browser</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_browser'>browser</span>
|
403
|
+
<span class='kw'>end</span>
|
404
|
+
|
405
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--server</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span>
|
406
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:server</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>true</span>
|
407
|
+
<span class='kw'>end</span>
|
408
|
+
|
409
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--port [PORT]</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_port'>port</span><span class='op'>|</span>
|
410
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:port</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_port'>port</span>
|
411
|
+
<span class='kw'>end</span>
|
412
|
+
|
413
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-v</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--version</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span>
|
414
|
+
<span class='ivar'>@command</span> <span class='op'>=</span> <span class='symbol'>:version</span>
|
415
|
+
<span class='kw'>end</span>
|
416
|
+
|
417
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-h</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--help</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span>
|
418
|
+
<span class='ivar'>@command</span> <span class='op'>=</span> <span class='symbol'>:help</span>
|
419
|
+
<span class='kw'>end</span>
|
420
|
+
<span class='kw'>end</span>
|
421
|
+
|
422
|
+
<span class='id identifier rubyid_options_parser'>options_parser</span><span class='period'>.</span><span class='id identifier rubyid_parse!'>parse!</span>
|
423
|
+
<span class='id identifier rubyid_options'>options</span>
|
424
|
+
|
425
|
+
<span class='kw'>rescue</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
426
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_e'>e</span>
|
427
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='const'>Apiary</span><span class='op'>::</span><span class='const'>Command</span><span class='op'>::</span><span class='const'>Help</span><span class='period'>.</span><span class='id identifier rubyid_banner'>banner</span>
|
428
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
|
429
|
+
<span class='kw'>end</span></pre>
|
430
|
+
</td>
|
431
|
+
</tr>
|
432
|
+
</table>
|
433
|
+
</div>
|
434
|
+
|
435
|
+
<div class="method_details ">
|
436
|
+
<h3 class="signature " id="run-instance_method">
|
437
|
+
|
438
|
+
- (<tt>Object</tt>) <strong>run</strong>(args, options)
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
</h3><table class="source_code">
|
445
|
+
<tr>
|
446
|
+
<td>
|
447
|
+
<pre class="lines">
|
448
|
+
|
449
|
+
|
450
|
+
14
|
451
|
+
15
|
452
|
+
16
|
453
|
+
17
|
454
|
+
18</pre>
|
455
|
+
</td>
|
456
|
+
<td>
|
457
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 14</span>
|
458
|
+
|
459
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
460
|
+
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
461
|
+
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='ivar'>@command</span> <span class='kw'>if</span> <span class='ivar'>@command</span>
|
462
|
+
<span class='const'>Apiary</span><span class='op'>::</span><span class='const'>Command</span><span class='op'>::</span><span class='const'>Runner</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
463
|
+
<span class='kw'>end</span></pre>
|
464
|
+
</td>
|
465
|
+
</tr>
|
466
|
+
</table>
|
467
|
+
</div>
|
468
|
+
|
469
|
+
</div>
|
470
|
+
|
471
|
+
</div>
|
472
|
+
|
473
|
+
<div id="footer">
|
474
|
+
Generated on Tue Aug 7 17:58:18 2012 by
|
475
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
476
|
+
0.8.2.1 (ruby-1.9.2).
|
477
|
+
</div>
|
478
|
+
|
479
|
+
</body>
|
480
|
+
</html>
|