apiaryio 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +32 -0
- data/LICENSE +22 -0
- data/README.md +38 -8
- data/Rakefile +26 -0
- data/apiary.gemspec +26 -0
- data/bin/apiary +4 -12
- 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/lib/apiary.rb +6 -1
- data/lib/apiary/cli.rb +59 -9
- data/lib/apiary/command/help.rb +34 -0
- data/lib/apiary/command/preview.rb +103 -0
- data/lib/apiary/command/runner.rb +13 -0
- data/lib/apiary/command/version.rb +13 -0
- data/lib/apiary/version.rb +2 -2
- data/spec/cli_spec.rb +9 -0
- data/spec/spec_helper.rb +2 -0
- metadata +87 -18
- data/lib/apiary/cmd.rb +0 -63
- data/lib/apiary/commands/base.rb +0 -41
- data/lib/apiary/commands/preview.rb +0 -27
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
apiaryio (0.0.1)
|
5
|
+
rack (~> 1.4.1)
|
6
|
+
rest-client (~> 1.6.7)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
diff-lcs (1.1.3)
|
12
|
+
mime-types (1.19)
|
13
|
+
rack (1.4.1)
|
14
|
+
rest-client (1.6.7)
|
15
|
+
mime-types (>= 1.16)
|
16
|
+
rspec (2.11.0)
|
17
|
+
rspec-core (~> 2.11.0)
|
18
|
+
rspec-expectations (~> 2.11.0)
|
19
|
+
rspec-mocks (~> 2.11.0)
|
20
|
+
rspec-core (2.11.1)
|
21
|
+
rspec-expectations (2.11.2)
|
22
|
+
diff-lcs (~> 1.1.3)
|
23
|
+
rspec-mocks (2.11.1)
|
24
|
+
yard (0.8.2.1)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
apiaryio!
|
31
|
+
rspec (~> 2.11.0)
|
32
|
+
yard (~> 0.8.2.1)
|
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
CHANGED
@@ -1,14 +1,44 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
apiaryio
|
2
|
+
=============
|
3
3
|
|
4
|
-
|
4
|
+
Apiary.io CLI
|
5
5
|
|
6
|
-
|
6
|
+
## Description
|
7
7
|
|
8
|
+
Apiaryio gem provides a way to display your API documentation on your local
|
9
|
+
machine, either using static files or using a standalone web server
|
8
10
|
|
9
|
-
|
10
|
-
----------
|
11
|
+
## Usage
|
11
12
|
|
12
|
-
|
13
|
+
$ apiary help
|
13
14
|
|
14
|
-
|
15
|
+
Usage: apiary command [options]
|
16
|
+
Try 'apiary help' for more information.
|
17
|
+
|
18
|
+
Currently available apiary commands are:
|
19
|
+
|
20
|
+
preview Show API documentation in default browser
|
21
|
+
preview --browser [chrome|safari|firefox] Show API documentation in specified browser
|
22
|
+
preview --path [PATH] Specify path to blueprint file
|
23
|
+
preview --api_host [HOST] Specify apiary host
|
24
|
+
preview --server Start standalone web server on port 8080
|
25
|
+
preview --server --port [PORT] Start standalone web server on specified port
|
26
|
+
|
27
|
+
help Show help
|
28
|
+
|
29
|
+
version Show version
|
30
|
+
|
31
|
+
## Copyright
|
32
|
+
|
33
|
+
Copyright 2012 (c) Apiary Ltd.
|
34
|
+
|
35
|
+
## Contributors
|
36
|
+
|
37
|
+
- Jakub Nešetřil
|
38
|
+
- James Charles Russell
|
39
|
+
- Lukáš Linhart
|
40
|
+
- Emili Parreño
|
41
|
+
|
42
|
+
## License
|
43
|
+
|
44
|
+
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('apiary.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/apiary.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/apiary/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Apiary Ltd."]
|
6
|
+
gem.email = ["team@apiary.io"]
|
7
|
+
gem.description = %q{Apiary.io CLI}
|
8
|
+
gem.summary = %q{Apiary.io CLI}
|
9
|
+
gem.homepage = "http://apiary.io"
|
10
|
+
gem.license = "MIT"
|
11
|
+
|
12
|
+
gem.files = `git ls-files`.split($\)
|
13
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
14
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
15
|
+
gem.name = "apiaryio"
|
16
|
+
gem.require_paths = ["lib"]
|
17
|
+
gem.version = Apiary::VERSION
|
18
|
+
|
19
|
+
gem.add_dependency "rest-client", "~> 1.6.7"
|
20
|
+
gem.add_dependency "rack", "~> 1.4.1"
|
21
|
+
|
22
|
+
gem.add_development_dependency "rspec", "~> 2.11.0"
|
23
|
+
gem.add_development_dependency "yard", "~> 0.8.2.1"
|
24
|
+
|
25
|
+
gem.post_install_message = "This gem is a client for http://apiary.io. Apiary is in closed beta version now, you need an invitation. If you don't have one, visit http://apiary.us2.list-manage.com/subscribe?u=b89934a238dcec9533f4a834a&id=08f2bdde55 to get on the waiting list!"
|
26
|
+
end
|
data/bin/apiary
CHANGED
@@ -1,14 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..','lib')))
|
3
|
+
require 'apiary'
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
bin_file = Pathname.new(__FILE__).realpath
|
7
|
-
|
8
|
-
$:.unshift File.expand_path("../../lib", bin_file)
|
9
|
-
|
10
|
-
require "apiary/cli"
|
11
|
-
Apiary::CLI.start(*ARGV)
|
12
|
-
rescue Interrupt
|
13
|
-
puts("\n Cancelled.")
|
14
|
-
end
|
5
|
+
trap(:INT) { abort "" }
|
6
|
+
Apiary::CLI.new(ARGV)
|
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>
|