bovem 3.0.5 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -3
- data/.rubocop.yml +82 -0
- data/.travis-gemfile +4 -5
- data/.travis.yml +8 -6
- data/CHANGELOG.md +12 -0
- data/Gemfile +9 -8
- data/README.md +1 -1
- data/Rakefile +22 -6
- data/bovem.gemspec +5 -5
- data/doc/Bovem.html +10 -10
- data/doc/Bovem/Application.html +670 -318
- data/doc/Bovem/Command.html +1447 -1125
- data/doc/Bovem/CommandMethods.html +4 -4
- data/doc/Bovem/CommandMethods/Children.html +173 -179
- data/doc/Bovem/CommandMethods/Help.html +9 -9
- data/doc/Bovem/Configuration.html +239 -24
- data/doc/Bovem/Console.html +267 -128
- data/doc/Bovem/ConsoleMethods.html +4 -4
- data/doc/Bovem/ConsoleMethods/Interactions.html +57 -70
- data/doc/Bovem/ConsoleMethods/Interactions/ClassMethods.html +9 -9
- data/doc/Bovem/ConsoleMethods/Logging.html +258 -298
- data/doc/Bovem/ConsoleMethods/Logging/ClassMethods.html +8 -8
- data/doc/Bovem/ConsoleMethods/Output.html +96 -118
- data/doc/Bovem/ConsoleMethods/StyleHandling.html +8 -8
- data/doc/Bovem/ConsoleMethods/StyleHandling/ClassMethods.html +26 -39
- data/doc/Bovem/Errors.html +4 -4
- data/doc/Bovem/Errors/Error.html +4 -4
- data/doc/Bovem/Errors/InvalidConfiguration.html +4 -4
- data/doc/Bovem/Errors/InvalidLogger.html +4 -4
- data/doc/Bovem/I18n.html +175 -0
- data/doc/Bovem/Logger.html +95 -83
- data/doc/Bovem/Option.html +669 -862
- data/doc/Bovem/Parser.html +10 -10
- data/doc/Bovem/ParserMethods.html +4 -4
- data/doc/Bovem/ParserMethods/General.html +4 -4
- data/doc/Bovem/ParserMethods/General/ClassMethods.html +26 -38
- data/doc/Bovem/Shell.html +169 -48
- data/doc/Bovem/ShellMethods.html +4 -4
- data/doc/Bovem/ShellMethods/Directories.html +46 -62
- data/doc/Bovem/ShellMethods/Execute.html +51 -99
- data/doc/Bovem/ShellMethods/General.html +4 -445
- data/doc/Bovem/ShellMethods/Read.html +56 -61
- data/doc/Bovem/ShellMethods/Write.html +22 -242
- data/doc/Bovem/Version.html +6 -6
- data/doc/_index.html +18 -18
- data/doc/class_list.html +6 -2
- data/doc/css/style.css +1 -0
- data/doc/file.README.html +5 -5
- data/doc/file_list.html +5 -1
- data/doc/frames.html +1 -1
- data/doc/index.html +5 -5
- data/doc/js/full_list.js +4 -1
- data/doc/method_list.html +161 -157
- data/doc/top-level-namespace.html +4 -4
- data/lib/bovem.rb +3 -4
- data/lib/bovem/application.rb +47 -39
- data/lib/bovem/command.rb +175 -193
- data/lib/bovem/configuration.rb +28 -29
- data/lib/bovem/console.rb +244 -171
- data/lib/bovem/errors.rb +1 -1
- data/lib/bovem/i18n.rb +18 -0
- data/lib/bovem/logger.rb +26 -26
- data/lib/bovem/option.rb +49 -58
- data/lib/bovem/parser.rb +174 -222
- data/lib/bovem/shell.rb +272 -320
- data/lib/bovem/version.rb +2 -2
- data/locales/en.yml +39 -38
- data/locales/it.yml +39 -38
- data/spec/bovem/application_spec.rb +6 -5
- data/spec/bovem/command_spec.rb +23 -23
- data/spec/bovem/console_spec.rb +101 -102
- data/spec/bovem/i18n_spec.rb +21 -0
- data/spec/bovem/logger_spec.rb +4 -4
- data/spec/bovem/option_spec.rb +43 -43
- data/spec/bovem/parser_spec.rb +13 -13
- data/spec/bovem/shell_spec.rb +106 -115
- data/spec/spec_helper.rb +19 -6
- metadata +14 -13
- data/doc/Bovem/Localizer.html +0 -376
- data/lib/bovem/localizer.rb +0 -27
- data/spec/coverage_helper.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c74039ce241abfdccaa81ca8c8efe809ffd2e233
|
4
|
+
data.tar.gz: d96082664d2464166742127ae77a3e37d2549c89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e0c13017af0824268954eff77853d67dfc8ffa5c7335471208b5a954fd2465161637e9eddf8745cf94948fedefd54baa2e48f85ec3970bde57c6ca88f9ed286
|
7
|
+
data.tar.gz: 3855b13c516acb40207394d49a384743dc8bd2ea5b8906cd0f049dd17de2ba4b60fb3f4ab29ad27115516a1c0902c01e57870de0804d122c46f187c55efc68a3
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of the bovem gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
+
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
4
|
+
#
|
5
|
+
|
6
|
+
AllCops:
|
7
|
+
TargetRubyVersion: 2.3
|
8
|
+
Include:
|
9
|
+
- "*/**/.rb"
|
10
|
+
- "config.ru"
|
11
|
+
- "Rakefile"
|
12
|
+
- "Gemfile"
|
13
|
+
Exclude:
|
14
|
+
- "config/**/*"
|
15
|
+
- "db/**/*"
|
16
|
+
- "spec/**/*"
|
17
|
+
|
18
|
+
Alias:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
AsciiComments:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
BracesAroundHashParameters:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
CyclomaticComplexity:
|
28
|
+
Max: 15
|
29
|
+
|
30
|
+
ClassLength:
|
31
|
+
Max: 150
|
32
|
+
|
33
|
+
Documentation:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
EachWithObject:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
FormatString:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
FrozenStringLiteralComment:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
IndentationConsistency:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
LineLength:
|
49
|
+
Max: 160
|
50
|
+
|
51
|
+
MethodLength:
|
52
|
+
Max: 15
|
53
|
+
|
54
|
+
ModuleLength:
|
55
|
+
Max: 200
|
56
|
+
|
57
|
+
MultilineMethodCallIndentation:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
ParameterLists:
|
61
|
+
Max: 9
|
62
|
+
|
63
|
+
RegexpLiteral:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
SignalException:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
SpaceInsideHashLiteralBraces:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
StringLiterals:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
StringLiteralsInInterpolation:
|
76
|
+
Enabled: false
|
77
|
+
|
78
|
+
StringReplacement:
|
79
|
+
Enabled: false
|
80
|
+
|
81
|
+
WordArray:
|
82
|
+
Enabled: false
|
data/.travis-gemfile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
#
|
3
2
|
# This file is part of the bovem gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
4
3
|
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
@@ -9,7 +8,7 @@ source "http://rubygems.org"
|
|
9
8
|
gemspec
|
10
9
|
|
11
10
|
# Testing
|
12
|
-
gem "rspec", "~>
|
13
|
-
gem "rake", "~>
|
14
|
-
gem "simplecov", "
|
15
|
-
gem "coveralls", "
|
11
|
+
gem "rspec", "~> 3.4"
|
12
|
+
gem "rake", "~> 11.0"
|
13
|
+
gem "simplecov", "~> 0.11"
|
14
|
+
gem "coveralls", "~> 0.8", require: false
|
data/.travis.yml
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of the bovem gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
+
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
4
|
+
#
|
5
|
+
|
1
6
|
language: ruby
|
2
7
|
rvm:
|
3
|
-
-
|
4
|
-
|
5
|
-
- jruby-19mode
|
6
|
-
- rbx-19mode
|
7
|
-
script: bundle exec rake spec:coverage
|
8
|
+
- 2.3.0
|
9
|
+
script: bundle exec rake spec:ci
|
8
10
|
gemfile: .travis-gemfile
|
9
11
|
notifications:
|
10
|
-
email: false
|
12
|
+
email: false
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
### 4.0.0 / 2016-03-29
|
2
|
+
|
3
|
+
* Refactored `Bovem::Console`.
|
4
|
+
* Refactored `Bovem::Shell`.
|
5
|
+
* Replace `Bovem::Localizer` with `Bovem::I18n`.
|
6
|
+
* Dropped `is_` or `has_` from all methods in `Bovem::Command` and `Bovem::Option`.
|
7
|
+
* Changed signature of `Bovem::Parser.smart_join`.
|
8
|
+
* Changed signature of `Bovem::Parser.find_command`.
|
9
|
+
* Changed signature of `Bovem::Command::get_options`.
|
10
|
+
* Dropped support for Ruby <2.3
|
11
|
+
* Updated dependencies.
|
12
|
+
|
1
13
|
### 3.0.5 / 2014-03-08
|
2
14
|
|
3
15
|
* Updated dependencies.
|
data/Gemfile
CHANGED
@@ -9,13 +9,14 @@ source "http://rubygems.org"
|
|
9
9
|
gemspec
|
10
10
|
|
11
11
|
# Testing
|
12
|
-
gem "rspec", "~>
|
13
|
-
gem "rake", "~>
|
12
|
+
gem "rspec", "~> 3.4"
|
13
|
+
gem "rake", "~> 11.0"
|
14
14
|
|
15
15
|
# Documentation
|
16
|
-
gem "simplecov", "
|
17
|
-
gem "coveralls", "
|
18
|
-
gem "pry", "
|
19
|
-
gem "yard", "
|
20
|
-
gem "kramdown", "
|
21
|
-
gem "github-markup", "
|
16
|
+
gem "simplecov", "~> 0.11"
|
17
|
+
gem "coveralls", "~> 0.8", require: false
|
18
|
+
gem "pry", "~> 0.10"
|
19
|
+
gem "yard", "~> 0.8"
|
20
|
+
gem "kramdown", "~> 1.10"
|
21
|
+
gem "github-markup", "~> 1.4"
|
22
|
+
gem "rubocop", "~> 0.39"
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -7,23 +7,39 @@
|
|
7
7
|
require "bundler/gem_tasks"
|
8
8
|
require "rspec/core/rake_task"
|
9
9
|
|
10
|
+
# Compatibility layer for Rake 11.0
|
11
|
+
Rake.application.class.send(:alias_method, :last_comment, :last_description) unless Rake.application.respond_to?(:last_comment)
|
12
|
+
|
10
13
|
RSpec::Core::RakeTask.new("spec")
|
11
|
-
RSpec::Core::RakeTask.new("spec:coverage") { |t| t.ruby_opts = "-r./spec/coverage_helper" }
|
12
14
|
|
13
|
-
|
15
|
+
RSpec::Core::RakeTask.new("spec:coverage") do
|
16
|
+
ENV["COVERAGE"] = "true"
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec::Core::RakeTask.new("spec:ci") do
|
20
|
+
ENV["COVERAGE"] = "true"
|
21
|
+
ENV["NO_COLOR"] = "true"
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "Performs linting of the code using rubocop"
|
25
|
+
task "lint" do
|
26
|
+
Kernel.exec("rubocop -ED lib")
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Generates the documentation"
|
14
30
|
task :docs do
|
15
31
|
system("yardoc") || raise("Failed Execution of: yardoc")
|
16
32
|
end
|
17
|
-
|
18
|
-
desc "
|
33
|
+
|
34
|
+
desc "Gets the current release version"
|
19
35
|
task :version, :with_name do |_, args|
|
20
36
|
gem = Bundler::GemHelper.instance.gemspec
|
21
37
|
puts [args[:with_name] == "true" ? gem.name : nil, gem.version].compact.join("-")
|
22
38
|
end
|
23
39
|
|
24
|
-
desc "
|
40
|
+
desc "Prepares the release"
|
25
41
|
task :prerelease => ["spec:coverage", "docs"] do
|
26
42
|
["git add -A", "git commit -am \"Version #{Bundler::GemHelper.instance.gemspec.version}\""].each do |cmd|
|
27
43
|
system(cmd) || raise("Failed Execution of: #{cmd}")
|
28
44
|
end
|
29
|
-
end
|
45
|
+
end
|
data/bovem.gemspec
CHANGED
@@ -4,12 +4,12 @@
|
|
4
4
|
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
5
5
|
#
|
6
6
|
|
7
|
-
require "
|
7
|
+
require File.expand_path("../lib/bovem/version", __FILE__)
|
8
8
|
|
9
9
|
Gem::Specification.new do |gem|
|
10
10
|
gem.name = "bovem"
|
11
11
|
gem.version = Bovem::Version::STRING
|
12
|
-
gem.homepage = "http://sw.
|
12
|
+
gem.homepage = "http://sw.cowtech.it/bovem"
|
13
13
|
gem.summary = %q{A command line manager and a collection of utilities for developers.}
|
14
14
|
gem.description = %q{A command line manager and a collection of utilities for developers.}
|
15
15
|
|
@@ -23,8 +23,8 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
24
|
gem.require_paths = ["lib"]
|
25
25
|
|
26
|
-
gem.required_ruby_version = ">=
|
26
|
+
gem.required_ruby_version = ">= 2.3.0"
|
27
27
|
|
28
|
-
gem.add_dependency("lazier", "~>
|
29
|
-
gem.add_dependency("open4", "~> 1.3
|
28
|
+
gem.add_dependency("lazier", "~> 4.2")
|
29
|
+
gem.add_dependency("open4", "~> 1.3")
|
30
30
|
end
|
data/doc/Bovem.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Bovem
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.7.
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
19
19
|
relpath = '';
|
20
|
-
framesUrl = "frames.html#!"
|
20
|
+
framesUrl = "frames.html#!Bovem.html";
|
21
21
|
</script>
|
22
22
|
|
23
23
|
|
@@ -79,8 +79,8 @@
|
|
79
79
|
|
80
80
|
|
81
81
|
<dt class="r1 last">Defined in:</dt>
|
82
|
-
<dd class="r1 last">lib/bovem/
|
83
|
-
lib/bovem/
|
82
|
+
<dd class="r1 last">lib/bovem/i18n.rb<span class="defines">,<br />
|
83
|
+
lib/bovem/shell.rb,<br /> lib/bovem/logger.rb,<br /> lib/bovem/errors.rb,<br /> lib/bovem/option.rb,<br /> lib/bovem/parser.rb,<br /> lib/bovem/version.rb,<br /> lib/bovem/command.rb,<br /> lib/bovem/console.rb,<br /> lib/bovem/application.rb,<br /> lib/bovem/configuration.rb</span>
|
84
84
|
</dd>
|
85
85
|
|
86
86
|
</dl>
|
@@ -105,7 +105,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
105
105
|
|
106
106
|
|
107
107
|
|
108
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Bovem/Application.html" title="Bovem::Application (class)">Application</a></span>, <span class='object_link'><a href="Bovem/Command.html" title="Bovem::Command (class)">Command</a></span>, <span class='object_link'><a href="Bovem/Configuration.html" title="Bovem::Configuration (class)">Configuration</a></span>, <span class='object_link'><a href="Bovem/Console.html" title="Bovem::Console (class)">Console</a></span>, <span class='object_link'><a href="Bovem/
|
108
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Bovem/Application.html" title="Bovem::Application (class)">Application</a></span>, <span class='object_link'><a href="Bovem/Command.html" title="Bovem::Command (class)">Command</a></span>, <span class='object_link'><a href="Bovem/Configuration.html" title="Bovem::Configuration (class)">Configuration</a></span>, <span class='object_link'><a href="Bovem/Console.html" title="Bovem::Console (class)">Console</a></span>, <span class='object_link'><a href="Bovem/I18n.html" title="Bovem::I18n (class)">I18n</a></span>, <span class='object_link'><a href="Bovem/Logger.html" title="Bovem::Logger (class)">Logger</a></span>, <span class='object_link'><a href="Bovem/Option.html" title="Bovem::Option (class)">Option</a></span>, <span class='object_link'><a href="Bovem/Parser.html" title="Bovem::Parser (class)">Parser</a></span>, <span class='object_link'><a href="Bovem/Shell.html" title="Bovem::Shell (class)">Shell</a></span>
|
109
109
|
|
110
110
|
|
111
111
|
</p>
|
@@ -131,7 +131,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
131
131
|
|
132
132
|
</div>
|
133
133
|
</dt>
|
134
|
-
<dd><pre class="code"><span class='lbrace'>{</span><span class='const'>String</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='const'>Integer</span> <span class='op'>=></span> <span class='int'>0</span><span class='comma'>,</span> <span class='const'>Fixnum</span> <span class='op'>=></span> <span class='int'>0</span><span class='comma'>,</span> <span class='const'>Bignum</span> <span class='op'>=></span> <span class='int'>0</span><span class='comma'>,</span> <span class='const'>Float</span> <span class='op'>=></span> <span class='float'>0.0</span><span class='comma'>,</span> <span class='const'>Array</span> <span class='op'>=></span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rbrace'>}</span></pre></dd>
|
134
|
+
<dd><pre class="code"><span class='lbrace'>{</span><span class='const'>String</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='const'>Integer</span> <span class='op'>=></span> <span class='int'>0</span><span class='comma'>,</span> <span class='const'>Fixnum</span> <span class='op'>=></span> <span class='int'>0</span><span class='comma'>,</span> <span class='const'>Bignum</span> <span class='op'>=></span> <span class='int'>0</span><span class='comma'>,</span> <span class='const'>Float</span> <span class='op'>=></span> <span class='float'>0.0</span><span class='comma'>,</span> <span class='const'>Array</span> <span class='op'>=></span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
135
135
|
|
136
136
|
<dt id="TERM_COLORS-constant" class="">TERM_COLORS =
|
137
137
|
<div class="docstring">
|
@@ -146,7 +146,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
146
146
|
|
147
147
|
</div>
|
148
148
|
</dt>
|
149
|
-
<dd><pre class="code"><span class='lbrace'>{</span
|
149
|
+
<dd><pre class="code"><span class='lbrace'>{</span><span class='label'>black:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>red:</span> <span class='int'>1</span><span class='comma'>,</span> <span class='label'>green:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>yellow:</span> <span class='int'>3</span><span class='comma'>,</span> <span class='label'>blue:</span> <span class='int'>4</span><span class='comma'>,</span> <span class='label'>magenta:</span> <span class='int'>5</span><span class='comma'>,</span> <span class='label'>cyan:</span> <span class='int'>6</span><span class='comma'>,</span> <span class='label'>white:</span> <span class='int'>7</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='int'>9</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
150
150
|
|
151
151
|
<dt id="TERM_EFFECTS-constant" class="">TERM_EFFECTS =
|
152
152
|
<div class="docstring">
|
@@ -161,7 +161,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
161
161
|
|
162
162
|
</div>
|
163
163
|
</dt>
|
164
|
-
<dd><pre class="code"><span class='lbrace'>{</span
|
164
|
+
<dd><pre class="code"><span class='lbrace'>{</span><span class='label'>reset:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>bright:</span> <span class='int'>1</span><span class='comma'>,</span> <span class='label'>italic:</span> <span class='int'>3</span><span class='comma'>,</span> <span class='label'>underline:</span> <span class='int'>4</span><span class='comma'>,</span> <span class='label'>blink:</span> <span class='int'>5</span><span class='comma'>,</span> <span class='label'>inverse:</span> <span class='int'>7</span><span class='comma'>,</span> <span class='label'>hide:</span> <span class='int'>8</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
165
165
|
|
166
166
|
</dl>
|
167
167
|
|
@@ -177,9 +177,9 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
177
177
|
</div>
|
178
178
|
|
179
179
|
<div id="footer">
|
180
|
-
Generated on
|
180
|
+
Generated on Tue Mar 29 20:43:16 2016 by
|
181
181
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
182
|
-
0.8.7.
|
182
|
+
0.8.7.6 (ruby-2.3.0).
|
183
183
|
</div>
|
184
184
|
|
185
185
|
</body>
|
data/doc/Bovem/Application.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Bovem::Application
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.7.
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
19
19
|
relpath = '../';
|
20
|
-
framesUrl = "../frames.html#!"
|
20
|
+
framesUrl = "../frames.html#!Bovem/Application.html";
|
21
21
|
</script>
|
22
22
|
|
23
23
|
|
@@ -114,6 +114,28 @@
|
|
114
114
|
|
115
115
|
|
116
116
|
</div>
|
117
|
+
<h2>Constant Summary</h2>
|
118
|
+
|
119
|
+
<dl class="constants">
|
120
|
+
|
121
|
+
<dt id="LOCALE_ROOT-constant" class="">LOCALE_ROOT =
|
122
|
+
<div class="docstring">
|
123
|
+
<div class="discussion">
|
124
|
+
<p>The location of the locales translation files.</p>
|
125
|
+
|
126
|
+
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
<div class="tags">
|
130
|
+
|
131
|
+
|
132
|
+
</div>
|
133
|
+
</dt>
|
134
|
+
<dd><pre class="code"><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
135
|
+
|
136
|
+
</dl>
|
137
|
+
|
138
|
+
|
117
139
|
|
118
140
|
|
119
141
|
|
@@ -283,7 +305,7 @@
|
|
283
305
|
|
284
306
|
|
285
307
|
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Command.html" title="Bovem::Command (class)">Command</a></span></h3>
|
286
|
-
<p class="inherited"><span class='object_link'><a href="Command.html#action-instance_method" title="Bovem::Command#action (method)">#action</a></span>, <span class='object_link'><a href="Command.html#after-instance_method" title="Bovem::Command#after (method)">#after</a></span>, <span class='object_link'><a href="Command.html#application-instance_method" title="Bovem::Command#application (method)">#application</a></span>, <span class='object_link'><a href="Command.html#arguments-instance_method" title="Bovem::Command#arguments (method)">#arguments</a></span>, <span class='object_link'><a href="Command.html#banner-instance_method" title="Bovem::Command#banner (method)">#banner</a></span>, <span class='object_link'><a href="Command.html#before-instance_method" title="Bovem::Command#before (method)">#before</a></span>, <span class='object_link'><a href="Command.html#commands-instance_method" title="Bovem::Command#commands (method)">#commands</a></span>, <span class='object_link'><a href="Command.html#description-instance_method" title="Bovem::Command#description (method)">#description</a></span>, <span class='object_link'><a href="Command.html#name-instance_method" title="Bovem::Command#name (method)">#name</a></span>, <span class='object_link'><a href="Command.html#options-instance_method" title="Bovem::Command#options (method)">#options</a></span>, <span class='object_link'><a href="Command.html#parent-instance_method" title="Bovem::Command#parent (method)">#parent</a></span>, <span class='object_link'><a href="Command.html#synopsis-instance_method" title="Bovem::Command#synopsis (method)">#synopsis</a></span></p>
|
308
|
+
<p class="inherited"><span class='object_link'><a href="Command.html#action-instance_method" title="Bovem::Command#action (method)">#action</a></span>, <span class='object_link'><a href="Command.html#after-instance_method" title="Bovem::Command#after (method)">#after</a></span>, <span class='object_link'><a href="Command.html#application-instance_method" title="Bovem::Command#application (method)">#application</a></span>, <span class='object_link'><a href="Command.html#arguments-instance_method" title="Bovem::Command#arguments (method)">#arguments</a></span>, <span class='object_link'><a href="Command.html#banner-instance_method" title="Bovem::Command#banner (method)">#banner</a></span>, <span class='object_link'><a href="Command.html#before-instance_method" title="Bovem::Command#before (method)">#before</a></span>, <span class='object_link'><a href="Command.html#commands-instance_method" title="Bovem::Command#commands (method)">#commands</a></span>, <span class='object_link'><a href="Command.html#description-instance_method" title="Bovem::Command#description (method)">#description</a></span>, <span class='object_link'><a href="Command.html#i18n-instance_method" title="Bovem::Command#i18n (method)">#i18n</a></span>, <span class='object_link'><a href="Command.html#name-instance_method" title="Bovem::Command#name (method)">#name</a></span>, <span class='object_link'><a href="Command.html#options-instance_method" title="Bovem::Command#options (method)">#options</a></span>, <span class='object_link'><a href="Command.html#parent-instance_method" title="Bovem::Command#parent (method)">#parent</a></span>, <span class='object_link'><a href="Command.html#synopsis-instance_method" title="Bovem::Command#synopsis (method)">#synopsis</a></span></p>
|
287
309
|
|
288
310
|
|
289
311
|
|
@@ -319,6 +341,52 @@
|
|
319
341
|
<span class="summary_desc"><div class='inline'><p>Initializes a new Bovem application.</p>
|
320
342
|
</div></span>
|
321
343
|
|
344
|
+
</li>
|
345
|
+
|
346
|
+
|
347
|
+
<li class="public ">
|
348
|
+
<span class="summary_signature">
|
349
|
+
|
350
|
+
<a href="#create_application-class_method" title="create_application (class method)">+ (Application) <strong>create_application</strong>(run, args, options, &block) </a>
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
</span>
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
<span class="summary_desc"><div class='inline'><p>Create the application.</p>
|
365
|
+
</div></span>
|
366
|
+
|
367
|
+
</li>
|
368
|
+
|
369
|
+
|
370
|
+
<li class="public ">
|
371
|
+
<span class="summary_signature">
|
372
|
+
|
373
|
+
<a href="#setup_application_option-class_method" title="setup_application_option (class method)">+ (Array) <strong>setup_application_option</strong>(options) </a>
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
</span>
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
<span class="summary_desc"><div class='inline'><p>Setup options for application creation.</p>
|
388
|
+
</div></span>
|
389
|
+
|
322
390
|
</li>
|
323
391
|
|
324
392
|
|
@@ -484,7 +552,7 @@
|
|
484
552
|
|
485
553
|
|
486
554
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Command.html" title="Bovem::Command (class)">Command</a></span></h3>
|
487
|
-
<p class="inherited"><span class='object_link'><a href="Command.html#
|
555
|
+
<p class="inherited"><span class='object_link'><a href="Command.html#application%3F-instance_method" title="Bovem::Command#application? (method)">#application?</a></span>, <span class='object_link'><a href="Command.html#banner%3F-instance_method" title="Bovem::Command#banner? (method)">#banner?</a></span>, <span class='object_link'><a href="Command.html#description%3F-instance_method" title="Bovem::Command#description? (method)">#description?</a></span>, <span class='object_link'><a href="Command.html#full_name-instance_method" title="Bovem::Command#full_name (method)">#full_name</a></span>, <span class='object_link'><a href="Command.html#setup_with-instance_method" title="Bovem::Command#setup_with (method)">#setup_with</a></span></p>
|
488
556
|
|
489
557
|
|
490
558
|
|
@@ -495,7 +563,7 @@
|
|
495
563
|
|
496
564
|
|
497
565
|
<h3 class="inherited">Methods included from <span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">CommandMethods::Children</a></span></h3>
|
498
|
-
<p class="inherited"><span class='object_link'><a href="CommandMethods/Children.html#argument-instance_method" title="Bovem::CommandMethods::Children#argument (method)">#argument</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#arguments-instance_method" title="Bovem::CommandMethods::Children#arguments (method)">#arguments</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#clear_commands-instance_method" title="Bovem::CommandMethods::Children#clear_commands (method)">#clear_commands</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#clear_options-instance_method" title="Bovem::CommandMethods::Children#clear_options (method)">#clear_options</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#command-instance_method" title="Bovem::CommandMethods::Children#command (method)">#command</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#
|
566
|
+
<p class="inherited"><span class='object_link'><a href="CommandMethods/Children.html#argument-instance_method" title="Bovem::CommandMethods::Children#argument (method)">#argument</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#arguments-instance_method" title="Bovem::CommandMethods::Children#arguments (method)">#arguments</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#clear_commands-instance_method" title="Bovem::CommandMethods::Children#clear_commands (method)">#clear_commands</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#clear_options-instance_method" title="Bovem::CommandMethods::Children#clear_options (method)">#clear_options</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#command-instance_method" title="Bovem::CommandMethods::Children#command (method)">#command</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#commands%3F-instance_method" title="Bovem::CommandMethods::Children#commands? (method)">#commands?</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#get_options-instance_method" title="Bovem::CommandMethods::Children#get_options (method)">#get_options</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#option-instance_method" title="Bovem::CommandMethods::Children#option (method)">#option</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#options%3F-instance_method" title="Bovem::CommandMethods::Children#options? (method)">#options?</a></span></p>
|
499
567
|
|
500
568
|
|
501
569
|
|
@@ -507,8 +575,7 @@
|
|
507
575
|
|
508
576
|
<h3 class="inherited">Methods included from <span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">CommandMethods::Help</a></span></h3>
|
509
577
|
<p class="inherited"><span class='object_link'><a href="CommandMethods/Help.html#show_help-instance_method" title="Bovem::CommandMethods::Help#show_help (method)">#show_help</a></span></p>
|
510
|
-
|
511
|
-
<div id="constructor_details" class="method_details_list">
|
578
|
+
<div id="constructor_details" class="method_details_list">
|
512
579
|
<h2>Constructor Details</h2>
|
513
580
|
|
514
581
|
<div class="method_details first">
|
@@ -557,20 +624,20 @@
|
|
557
624
|
<pre class="lines">
|
558
625
|
|
559
626
|
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
627
|
+
90
|
628
|
+
91
|
629
|
+
92
|
630
|
+
93
|
631
|
+
94
|
632
|
+
95
|
633
|
+
96
|
634
|
+
97
|
635
|
+
98
|
636
|
+
99
|
637
|
+
100</pre>
|
571
638
|
</td>
|
572
639
|
<td>
|
573
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line
|
640
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 90</span>
|
574
641
|
|
575
642
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
576
643
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
@@ -770,7 +837,15 @@
|
|
770
837
|
154
|
771
838
|
155
|
772
839
|
156
|
773
|
-
157
|
840
|
+
157
|
841
|
+
158
|
842
|
+
159
|
843
|
+
160
|
844
|
+
161
|
845
|
+
162
|
846
|
+
163
|
847
|
+
164
|
848
|
+
165</pre>
|
774
849
|
</td>
|
775
850
|
<td>
|
776
851
|
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 24</span>
|
@@ -783,6 +858,9 @@
|
|
783
858
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:show_commands</span>
|
784
859
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:output_commands</span>
|
785
860
|
|
861
|
+
<span class='comment'># The location of the locales translation files.
|
862
|
+
</span> <span class='const'>LOCALE_ROOT</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
|
863
|
+
|
786
864
|
<span class='comment'># Initializes a new Bovem application.
|
787
865
|
</span> <span class='comment'>#
|
788
866
|
</span> <span class='comment'># In options, you can override the command line arguments with `:__args__`, and you can skip execution by specifying `run: false`.
|
@@ -792,7 +870,13 @@
|
|
792
870
|
</span> <span class='comment'># @param options [Hash] The settings to initialize the application with.
|
793
871
|
</span> <span class='comment'># @return [Application] The created application.
|
794
872
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
795
|
-
<span class='
|
873
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
874
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>Error</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
875
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Application</span><span class='comma'>,</span> <span class='symbol'>:missing_block</span><span class='comma'>,</span>
|
876
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_missing_app_block'>missing_app_block</span>
|
877
|
+
<span class='rparen'>)</span>
|
878
|
+
<span class='kw'>end</span>
|
879
|
+
|
796
880
|
<span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
797
881
|
|
798
882
|
<span class='kw'>begin</span>
|
@@ -803,6 +887,32 @@
|
|
803
887
|
<span class='kw'>end</span>
|
804
888
|
<span class='kw'>end</span>
|
805
889
|
|
890
|
+
<span class='comment'># Setup options for application creation.
|
891
|
+
</span> <span class='comment'>#
|
892
|
+
</span> <span class='comment'># @param options [Hash] The options to setups.
|
893
|
+
</span> <span class='comment'># @return [Array] If to run the application, the arguments and the specified options.
|
894
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
895
|
+
<span class='id identifier rubyid_base_options'>base_options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
896
|
+
<span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_default_application_name'>default_application_name</span><span class='comma'>,</span>
|
897
|
+
<span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span>
|
898
|
+
<span class='rbrace'>}</span>
|
899
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_base_options'>base_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
900
|
+
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
901
|
+
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
902
|
+
<span class='kw'>end</span>
|
903
|
+
|
904
|
+
<span class='comment'># Create the application.
|
905
|
+
</span> <span class='comment'>#
|
906
|
+
</span> <span class='comment'># @param run [Boolean] If to run the application.
|
907
|
+
</span> <span class='comment'># @param args [Hash] The arguments to use for running.
|
908
|
+
</span> <span class='comment'># @param options [Hash] The options of the application.
|
909
|
+
</span> <span class='comment'># @return [Application] The new application.
|
910
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
911
|
+
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
912
|
+
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
913
|
+
<span class='id identifier rubyid_application'>application</span>
|
914
|
+
<span class='kw'>end</span>
|
915
|
+
|
806
916
|
<span class='comment'># Creates a new application.
|
807
917
|
</span> <span class='comment'>#
|
808
918
|
</span> <span class='comment'># @param options [Hash] The settings to initialize the application with.
|
@@ -823,7 +933,7 @@
|
|
823
933
|
</span> <span class='comment'># @param value [String|nil] The new version of this application.
|
824
934
|
</span> <span class='comment'># @return [String|nil] The version of this application.
|
825
935
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_version'>version</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
826
|
-
<span class='ivar'>@version</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>
|
936
|
+
<span class='ivar'>@version</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
827
937
|
<span class='ivar'>@version</span>
|
828
938
|
<span class='kw'>end</span>
|
829
939
|
|
@@ -840,14 +950,14 @@
|
|
840
950
|
<span class='id identifier rubyid_action'>action</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_command'>command</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
841
951
|
<span class='kw'>end</span>
|
842
952
|
|
843
|
-
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span
|
953
|
+
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_application'>application</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span> <span class='rbrace'>}</span>
|
844
954
|
<span class='kw'>end</span>
|
845
955
|
|
846
956
|
<span class='comment'># The name of the current executable.
|
847
957
|
</span> <span class='comment'>#
|
848
958
|
</span> <span class='comment'># @return [String] The name of the current executable.
|
849
959
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_executable_name'>executable_name</span>
|
850
|
-
<span class='gvar'>$
|
960
|
+
<span class='gvar'>$PROGRAM_NAME</span>
|
851
961
|
<span class='kw'>end</span>
|
852
962
|
|
853
963
|
<span class='comment'># Shows a help about a command.
|
@@ -856,13 +966,9 @@
|
|
856
966
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
857
967
|
<span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_arg'>arg</span><span class='op'>|</span>
|
858
968
|
<span class='comment'># Find the command across
|
859
|
-
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
860
|
-
|
861
|
-
<span class='
|
862
|
-
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
863
|
-
<span class='kw'>else</span>
|
864
|
-
<span class='kw'>break</span>
|
865
|
-
<span class='kw'>end</span>
|
969
|
+
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='label'>args:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
970
|
+
<span class='kw'>break</span> <span class='kw'>unless</span> <span class='id identifier rubyid_next_command'>next_command</span>
|
971
|
+
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
866
972
|
<span class='kw'>end</span>
|
867
973
|
|
868
974
|
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span>
|
@@ -880,34 +986,11 @@
|
|
880
986
|
<span class='kw'>end</span>
|
881
987
|
|
882
988
|
<span class='id identifier rubyid_private'>private</span>
|
883
|
-
<span class='comment'># Setup options for application creation.
|
884
|
-
</span> <span class='comment'>#
|
885
|
-
</span> <span class='comment'># @param options [Hash] The options to setups.
|
886
|
-
</span> <span class='comment'># @return [Array] If to run the application, the arguments and the specified options.
|
887
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
888
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Localizer</span><span class='period'>.</span><span class='id identifier rubyid_localize_on_locale'>localize_on_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:default_application_name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
889
|
-
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
890
|
-
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
891
|
-
<span class='kw'>end</span>
|
892
989
|
|
893
|
-
|
894
|
-
</span>
|
895
|
-
</span>
|
896
|
-
|
897
|
-
</span> <span class='comment'># @param options [Hash] The options of the application.
|
898
|
-
</span> <span class='comment'># @return [Application] The new application.
|
899
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
900
|
-
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
901
|
-
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
902
|
-
<span class='id identifier rubyid_application'>application</span>
|
903
|
-
<span class='kw'>end</span>
|
904
|
-
|
905
|
-
<span class='comment'># Fetch a command list for showing help.
|
906
|
-
</span> <span class='comment'>#
|
907
|
-
</span> <span class='comment'># @param command [Command] The command to show help for.
|
908
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
909
|
-
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span>
|
910
|
-
<span class='kw'>end</span>
|
990
|
+
<span class='comment'># :nodoc:
|
991
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
992
|
+
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span>
|
993
|
+
<span class='kw'>end</span>
|
911
994
|
<span class='kw'>end</span></pre>
|
912
995
|
</td>
|
913
996
|
</tr>
|
@@ -1091,7 +1174,15 @@
|
|
1091
1174
|
154
|
1092
1175
|
155
|
1093
1176
|
156
|
1094
|
-
157
|
1177
|
+
157
|
1178
|
+
158
|
1179
|
+
159
|
1180
|
+
160
|
1181
|
+
161
|
1182
|
+
162
|
1183
|
+
163
|
1184
|
+
164
|
1185
|
+
165</pre>
|
1095
1186
|
</td>
|
1096
1187
|
<td>
|
1097
1188
|
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 24</span>
|
@@ -1104,6 +1195,9 @@
|
|
1104
1195
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:show_commands</span>
|
1105
1196
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:output_commands</span>
|
1106
1197
|
|
1198
|
+
<span class='comment'># The location of the locales translation files.
|
1199
|
+
</span> <span class='const'>LOCALE_ROOT</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
|
1200
|
+
|
1107
1201
|
<span class='comment'># Initializes a new Bovem application.
|
1108
1202
|
</span> <span class='comment'>#
|
1109
1203
|
</span> <span class='comment'># In options, you can override the command line arguments with `:__args__`, and you can skip execution by specifying `run: false`.
|
@@ -1113,7 +1207,13 @@
|
|
1113
1207
|
</span> <span class='comment'># @param options [Hash] The settings to initialize the application with.
|
1114
1208
|
</span> <span class='comment'># @return [Application] The created application.
|
1115
1209
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1116
|
-
<span class='
|
1210
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
1211
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>Error</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
1212
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Application</span><span class='comma'>,</span> <span class='symbol'>:missing_block</span><span class='comma'>,</span>
|
1213
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_missing_app_block'>missing_app_block</span>
|
1214
|
+
<span class='rparen'>)</span>
|
1215
|
+
<span class='kw'>end</span>
|
1216
|
+
|
1117
1217
|
<span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1118
1218
|
|
1119
1219
|
<span class='kw'>begin</span>
|
@@ -1124,6 +1224,32 @@
|
|
1124
1224
|
<span class='kw'>end</span>
|
1125
1225
|
<span class='kw'>end</span>
|
1126
1226
|
|
1227
|
+
<span class='comment'># Setup options for application creation.
|
1228
|
+
</span> <span class='comment'>#
|
1229
|
+
</span> <span class='comment'># @param options [Hash] The options to setups.
|
1230
|
+
</span> <span class='comment'># @return [Array] If to run the application, the arguments and the specified options.
|
1231
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1232
|
+
<span class='id identifier rubyid_base_options'>base_options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1233
|
+
<span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_default_application_name'>default_application_name</span><span class='comma'>,</span>
|
1234
|
+
<span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span>
|
1235
|
+
<span class='rbrace'>}</span>
|
1236
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_base_options'>base_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
1237
|
+
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
1238
|
+
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
1239
|
+
<span class='kw'>end</span>
|
1240
|
+
|
1241
|
+
<span class='comment'># Create the application.
|
1242
|
+
</span> <span class='comment'>#
|
1243
|
+
</span> <span class='comment'># @param run [Boolean] If to run the application.
|
1244
|
+
</span> <span class='comment'># @param args [Hash] The arguments to use for running.
|
1245
|
+
</span> <span class='comment'># @param options [Hash] The options of the application.
|
1246
|
+
</span> <span class='comment'># @return [Application] The new application.
|
1247
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1248
|
+
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1249
|
+
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
1250
|
+
<span class='id identifier rubyid_application'>application</span>
|
1251
|
+
<span class='kw'>end</span>
|
1252
|
+
|
1127
1253
|
<span class='comment'># Creates a new application.
|
1128
1254
|
</span> <span class='comment'>#
|
1129
1255
|
</span> <span class='comment'># @param options [Hash] The settings to initialize the application with.
|
@@ -1144,7 +1270,7 @@
|
|
1144
1270
|
</span> <span class='comment'># @param value [String|nil] The new version of this application.
|
1145
1271
|
</span> <span class='comment'># @return [String|nil] The version of this application.
|
1146
1272
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_version'>version</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1147
|
-
<span class='ivar'>@version</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>
|
1273
|
+
<span class='ivar'>@version</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1148
1274
|
<span class='ivar'>@version</span>
|
1149
1275
|
<span class='kw'>end</span>
|
1150
1276
|
|
@@ -1161,14 +1287,14 @@
|
|
1161
1287
|
<span class='id identifier rubyid_action'>action</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_command'>command</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1162
1288
|
<span class='kw'>end</span>
|
1163
1289
|
|
1164
|
-
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span
|
1290
|
+
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_application'>application</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span> <span class='rbrace'>}</span>
|
1165
1291
|
<span class='kw'>end</span>
|
1166
1292
|
|
1167
1293
|
<span class='comment'># The name of the current executable.
|
1168
1294
|
</span> <span class='comment'>#
|
1169
1295
|
</span> <span class='comment'># @return [String] The name of the current executable.
|
1170
1296
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_executable_name'>executable_name</span>
|
1171
|
-
<span class='gvar'>$
|
1297
|
+
<span class='gvar'>$PROGRAM_NAME</span>
|
1172
1298
|
<span class='kw'>end</span>
|
1173
1299
|
|
1174
1300
|
<span class='comment'># Shows a help about a command.
|
@@ -1177,13 +1303,9 @@
|
|
1177
1303
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
1178
1304
|
<span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_arg'>arg</span><span class='op'>|</span>
|
1179
1305
|
<span class='comment'># Find the command across
|
1180
|
-
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1181
|
-
|
1182
|
-
<span class='
|
1183
|
-
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
1184
|
-
<span class='kw'>else</span>
|
1185
|
-
<span class='kw'>break</span>
|
1186
|
-
<span class='kw'>end</span>
|
1306
|
+
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='label'>args:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1307
|
+
<span class='kw'>break</span> <span class='kw'>unless</span> <span class='id identifier rubyid_next_command'>next_command</span>
|
1308
|
+
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
1187
1309
|
<span class='kw'>end</span>
|
1188
1310
|
|
1189
1311
|
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span>
|
@@ -1201,34 +1323,11 @@
|
|
1201
1323
|
<span class='kw'>end</span>
|
1202
1324
|
|
1203
1325
|
<span class='id identifier rubyid_private'>private</span>
|
1204
|
-
<span class='comment'># Setup options for application creation.
|
1205
|
-
</span> <span class='comment'>#
|
1206
|
-
</span> <span class='comment'># @param options [Hash] The options to setups.
|
1207
|
-
</span> <span class='comment'># @return [Array] If to run the application, the arguments and the specified options.
|
1208
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1209
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Localizer</span><span class='period'>.</span><span class='id identifier rubyid_localize_on_locale'>localize_on_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:default_application_name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
1210
|
-
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
1211
|
-
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
1212
|
-
<span class='kw'>end</span>
|
1213
|
-
|
1214
|
-
<span class='comment'># Create the application.
|
1215
|
-
</span> <span class='comment'>#
|
1216
|
-
</span> <span class='comment'># @param run [Boolean ]If to run the application.
|
1217
|
-
</span> <span class='comment'># @param args [Hash] The arguments to use for running.
|
1218
|
-
</span> <span class='comment'># @param options [Hash] The options of the application.
|
1219
|
-
</span> <span class='comment'># @return [Application] The new application.
|
1220
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1221
|
-
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1222
|
-
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
1223
|
-
<span class='id identifier rubyid_application'>application</span>
|
1224
|
-
<span class='kw'>end</span>
|
1225
1326
|
|
1226
|
-
|
1227
|
-
</span>
|
1228
|
-
</span>
|
1229
|
-
|
1230
|
-
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span>
|
1231
|
-
<span class='kw'>end</span>
|
1327
|
+
<span class='comment'># :nodoc:
|
1328
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
1329
|
+
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span>
|
1330
|
+
<span class='kw'>end</span>
|
1232
1331
|
<span class='kw'>end</span></pre>
|
1233
1332
|
</td>
|
1234
1333
|
</tr>
|
@@ -1412,7 +1511,15 @@
|
|
1412
1511
|
154
|
1413
1512
|
155
|
1414
1513
|
156
|
1415
|
-
157
|
1514
|
+
157
|
1515
|
+
158
|
1516
|
+
159
|
1517
|
+
160
|
1518
|
+
161
|
1519
|
+
162
|
1520
|
+
163
|
1521
|
+
164
|
1522
|
+
165</pre>
|
1416
1523
|
</td>
|
1417
1524
|
<td>
|
1418
1525
|
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 24</span>
|
@@ -1425,6 +1532,9 @@
|
|
1425
1532
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:show_commands</span>
|
1426
1533
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:output_commands</span>
|
1427
1534
|
|
1535
|
+
<span class='comment'># The location of the locales translation files.
|
1536
|
+
</span> <span class='const'>LOCALE_ROOT</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
|
1537
|
+
|
1428
1538
|
<span class='comment'># Initializes a new Bovem application.
|
1429
1539
|
</span> <span class='comment'>#
|
1430
1540
|
</span> <span class='comment'># In options, you can override the command line arguments with `:__args__`, and you can skip execution by specifying `run: false`.
|
@@ -1434,7 +1544,13 @@
|
|
1434
1544
|
</span> <span class='comment'># @param options [Hash] The settings to initialize the application with.
|
1435
1545
|
</span> <span class='comment'># @return [Application] The created application.
|
1436
1546
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1437
|
-
<span class='
|
1547
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
1548
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>Error</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
1549
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Application</span><span class='comma'>,</span> <span class='symbol'>:missing_block</span><span class='comma'>,</span>
|
1550
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_missing_app_block'>missing_app_block</span>
|
1551
|
+
<span class='rparen'>)</span>
|
1552
|
+
<span class='kw'>end</span>
|
1553
|
+
|
1438
1554
|
<span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1439
1555
|
|
1440
1556
|
<span class='kw'>begin</span>
|
@@ -1445,6 +1561,32 @@
|
|
1445
1561
|
<span class='kw'>end</span>
|
1446
1562
|
<span class='kw'>end</span>
|
1447
1563
|
|
1564
|
+
<span class='comment'># Setup options for application creation.
|
1565
|
+
</span> <span class='comment'>#
|
1566
|
+
</span> <span class='comment'># @param options [Hash] The options to setups.
|
1567
|
+
</span> <span class='comment'># @return [Array] If to run the application, the arguments and the specified options.
|
1568
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1569
|
+
<span class='id identifier rubyid_base_options'>base_options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1570
|
+
<span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_default_application_name'>default_application_name</span><span class='comma'>,</span>
|
1571
|
+
<span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span>
|
1572
|
+
<span class='rbrace'>}</span>
|
1573
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_base_options'>base_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
1574
|
+
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
1575
|
+
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
1576
|
+
<span class='kw'>end</span>
|
1577
|
+
|
1578
|
+
<span class='comment'># Create the application.
|
1579
|
+
</span> <span class='comment'>#
|
1580
|
+
</span> <span class='comment'># @param run [Boolean] If to run the application.
|
1581
|
+
</span> <span class='comment'># @param args [Hash] The arguments to use for running.
|
1582
|
+
</span> <span class='comment'># @param options [Hash] The options of the application.
|
1583
|
+
</span> <span class='comment'># @return [Application] The new application.
|
1584
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1585
|
+
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1586
|
+
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
1587
|
+
<span class='id identifier rubyid_application'>application</span>
|
1588
|
+
<span class='kw'>end</span>
|
1589
|
+
|
1448
1590
|
<span class='comment'># Creates a new application.
|
1449
1591
|
</span> <span class='comment'>#
|
1450
1592
|
</span> <span class='comment'># @param options [Hash] The settings to initialize the application with.
|
@@ -1465,7 +1607,7 @@
|
|
1465
1607
|
</span> <span class='comment'># @param value [String|nil] The new version of this application.
|
1466
1608
|
</span> <span class='comment'># @return [String|nil] The version of this application.
|
1467
1609
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_version'>version</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1468
|
-
<span class='ivar'>@version</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>
|
1610
|
+
<span class='ivar'>@version</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1469
1611
|
<span class='ivar'>@version</span>
|
1470
1612
|
<span class='kw'>end</span>
|
1471
1613
|
|
@@ -1482,14 +1624,14 @@
|
|
1482
1624
|
<span class='id identifier rubyid_action'>action</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_command'>command</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1483
1625
|
<span class='kw'>end</span>
|
1484
1626
|
|
1485
|
-
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span
|
1627
|
+
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_application'>application</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span> <span class='rbrace'>}</span>
|
1486
1628
|
<span class='kw'>end</span>
|
1487
1629
|
|
1488
1630
|
<span class='comment'># The name of the current executable.
|
1489
1631
|
</span> <span class='comment'>#
|
1490
1632
|
</span> <span class='comment'># @return [String] The name of the current executable.
|
1491
1633
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_executable_name'>executable_name</span>
|
1492
|
-
<span class='gvar'>$
|
1634
|
+
<span class='gvar'>$PROGRAM_NAME</span>
|
1493
1635
|
<span class='kw'>end</span>
|
1494
1636
|
|
1495
1637
|
<span class='comment'># Shows a help about a command.
|
@@ -1498,13 +1640,9 @@
|
|
1498
1640
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
1499
1641
|
<span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_arg'>arg</span><span class='op'>|</span>
|
1500
1642
|
<span class='comment'># Find the command across
|
1501
|
-
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1502
|
-
|
1503
|
-
<span class='
|
1504
|
-
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
1505
|
-
<span class='kw'>else</span>
|
1506
|
-
<span class='kw'>break</span>
|
1507
|
-
<span class='kw'>end</span>
|
1643
|
+
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='label'>args:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1644
|
+
<span class='kw'>break</span> <span class='kw'>unless</span> <span class='id identifier rubyid_next_command'>next_command</span>
|
1645
|
+
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
1508
1646
|
<span class='kw'>end</span>
|
1509
1647
|
|
1510
1648
|
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span>
|
@@ -1522,34 +1660,11 @@
|
|
1522
1660
|
<span class='kw'>end</span>
|
1523
1661
|
|
1524
1662
|
<span class='id identifier rubyid_private'>private</span>
|
1525
|
-
<span class='comment'># Setup options for application creation.
|
1526
|
-
</span> <span class='comment'>#
|
1527
|
-
</span> <span class='comment'># @param options [Hash] The options to setups.
|
1528
|
-
</span> <span class='comment'># @return [Array] If to run the application, the arguments and the specified options.
|
1529
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1530
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Localizer</span><span class='period'>.</span><span class='id identifier rubyid_localize_on_locale'>localize_on_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:default_application_name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
1531
|
-
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
1532
|
-
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
1533
|
-
<span class='kw'>end</span>
|
1534
1663
|
|
1535
|
-
|
1536
|
-
</span>
|
1537
|
-
</span>
|
1538
|
-
|
1539
|
-
</span> <span class='comment'># @param options [Hash] The options of the application.
|
1540
|
-
</span> <span class='comment'># @return [Application] The new application.
|
1541
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1542
|
-
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1543
|
-
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
1544
|
-
<span class='id identifier rubyid_application'>application</span>
|
1545
|
-
<span class='kw'>end</span>
|
1546
|
-
|
1547
|
-
<span class='comment'># Fetch a command list for showing help.
|
1548
|
-
</span> <span class='comment'>#
|
1549
|
-
</span> <span class='comment'># @param command [Command] The command to show help for.
|
1550
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
1551
|
-
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span>
|
1552
|
-
<span class='kw'>end</span>
|
1664
|
+
<span class='comment'># :nodoc:
|
1665
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
1666
|
+
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span>
|
1667
|
+
<span class='kw'>end</span>
|
1553
1668
|
<span class='kw'>end</span></pre>
|
1554
1669
|
</td>
|
1555
1670
|
</tr>
|
@@ -1733,7 +1848,15 @@
|
|
1733
1848
|
154
|
1734
1849
|
155
|
1735
1850
|
156
|
1736
|
-
157
|
1851
|
+
157
|
1852
|
+
158
|
1853
|
+
159
|
1854
|
+
160
|
1855
|
+
161
|
1856
|
+
162
|
1857
|
+
163
|
1858
|
+
164
|
1859
|
+
165</pre>
|
1737
1860
|
</td>
|
1738
1861
|
<td>
|
1739
1862
|
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 24</span>
|
@@ -1746,6 +1869,9 @@
|
|
1746
1869
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:show_commands</span>
|
1747
1870
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:output_commands</span>
|
1748
1871
|
|
1872
|
+
<span class='comment'># The location of the locales translation files.
|
1873
|
+
</span> <span class='const'>LOCALE_ROOT</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
|
1874
|
+
|
1749
1875
|
<span class='comment'># Initializes a new Bovem application.
|
1750
1876
|
</span> <span class='comment'>#
|
1751
1877
|
</span> <span class='comment'># In options, you can override the command line arguments with `:__args__`, and you can skip execution by specifying `run: false`.
|
@@ -1755,7 +1881,13 @@
|
|
1755
1881
|
</span> <span class='comment'># @param options [Hash] The settings to initialize the application with.
|
1756
1882
|
</span> <span class='comment'># @return [Application] The created application.
|
1757
1883
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1758
|
-
<span class='
|
1884
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
1885
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>Error</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
1886
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Application</span><span class='comma'>,</span> <span class='symbol'>:missing_block</span><span class='comma'>,</span>
|
1887
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_missing_app_block'>missing_app_block</span>
|
1888
|
+
<span class='rparen'>)</span>
|
1889
|
+
<span class='kw'>end</span>
|
1890
|
+
|
1759
1891
|
<span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1760
1892
|
|
1761
1893
|
<span class='kw'>begin</span>
|
@@ -1766,6 +1898,32 @@
|
|
1766
1898
|
<span class='kw'>end</span>
|
1767
1899
|
<span class='kw'>end</span>
|
1768
1900
|
|
1901
|
+
<span class='comment'># Setup options for application creation.
|
1902
|
+
</span> <span class='comment'>#
|
1903
|
+
</span> <span class='comment'># @param options [Hash] The options to setups.
|
1904
|
+
</span> <span class='comment'># @return [Array] If to run the application, the arguments and the specified options.
|
1905
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1906
|
+
<span class='id identifier rubyid_base_options'>base_options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1907
|
+
<span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_default_application_name'>default_application_name</span><span class='comma'>,</span>
|
1908
|
+
<span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span>
|
1909
|
+
<span class='rbrace'>}</span>
|
1910
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_base_options'>base_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
1911
|
+
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
1912
|
+
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
1913
|
+
<span class='kw'>end</span>
|
1914
|
+
|
1915
|
+
<span class='comment'># Create the application.
|
1916
|
+
</span> <span class='comment'>#
|
1917
|
+
</span> <span class='comment'># @param run [Boolean] If to run the application.
|
1918
|
+
</span> <span class='comment'># @param args [Hash] The arguments to use for running.
|
1919
|
+
</span> <span class='comment'># @param options [Hash] The options of the application.
|
1920
|
+
</span> <span class='comment'># @return [Application] The new application.
|
1921
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1922
|
+
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1923
|
+
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
1924
|
+
<span class='id identifier rubyid_application'>application</span>
|
1925
|
+
<span class='kw'>end</span>
|
1926
|
+
|
1769
1927
|
<span class='comment'># Creates a new application.
|
1770
1928
|
</span> <span class='comment'>#
|
1771
1929
|
</span> <span class='comment'># @param options [Hash] The settings to initialize the application with.
|
@@ -1786,7 +1944,7 @@
|
|
1786
1944
|
</span> <span class='comment'># @param value [String|nil] The new version of this application.
|
1787
1945
|
</span> <span class='comment'># @return [String|nil] The version of this application.
|
1788
1946
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_version'>version</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1789
|
-
<span class='ivar'>@version</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>
|
1947
|
+
<span class='ivar'>@version</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1790
1948
|
<span class='ivar'>@version</span>
|
1791
1949
|
<span class='kw'>end</span>
|
1792
1950
|
|
@@ -1803,14 +1961,14 @@
|
|
1803
1961
|
<span class='id identifier rubyid_action'>action</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_command'>command</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1804
1962
|
<span class='kw'>end</span>
|
1805
1963
|
|
1806
|
-
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span
|
1964
|
+
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_application'>application</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span> <span class='rbrace'>}</span>
|
1807
1965
|
<span class='kw'>end</span>
|
1808
1966
|
|
1809
1967
|
<span class='comment'># The name of the current executable.
|
1810
1968
|
</span> <span class='comment'>#
|
1811
1969
|
</span> <span class='comment'># @return [String] The name of the current executable.
|
1812
1970
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_executable_name'>executable_name</span>
|
1813
|
-
<span class='gvar'>$
|
1971
|
+
<span class='gvar'>$PROGRAM_NAME</span>
|
1814
1972
|
<span class='kw'>end</span>
|
1815
1973
|
|
1816
1974
|
<span class='comment'># Shows a help about a command.
|
@@ -1819,13 +1977,9 @@
|
|
1819
1977
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
1820
1978
|
<span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_arg'>arg</span><span class='op'>|</span>
|
1821
1979
|
<span class='comment'># Find the command across
|
1822
|
-
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1823
|
-
|
1824
|
-
<span class='
|
1825
|
-
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
1826
|
-
<span class='kw'>else</span>
|
1827
|
-
<span class='kw'>break</span>
|
1828
|
-
<span class='kw'>end</span>
|
1980
|
+
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='label'>args:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1981
|
+
<span class='kw'>break</span> <span class='kw'>unless</span> <span class='id identifier rubyid_next_command'>next_command</span>
|
1982
|
+
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
1829
1983
|
<span class='kw'>end</span>
|
1830
1984
|
|
1831
1985
|
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span>
|
@@ -1843,34 +1997,11 @@
|
|
1843
1997
|
<span class='kw'>end</span>
|
1844
1998
|
|
1845
1999
|
<span class='id identifier rubyid_private'>private</span>
|
1846
|
-
<span class='comment'># Setup options for application creation.
|
1847
|
-
</span> <span class='comment'>#
|
1848
|
-
</span> <span class='comment'># @param options [Hash] The options to setups.
|
1849
|
-
</span> <span class='comment'># @return [Array] If to run the application, the arguments and the specified options.
|
1850
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1851
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Localizer</span><span class='period'>.</span><span class='id identifier rubyid_localize_on_locale'>localize_on_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:default_application_name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
1852
|
-
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
1853
|
-
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
1854
|
-
<span class='kw'>end</span>
|
1855
|
-
|
1856
|
-
<span class='comment'># Create the application.
|
1857
|
-
</span> <span class='comment'>#
|
1858
|
-
</span> <span class='comment'># @param run [Boolean ]If to run the application.
|
1859
|
-
</span> <span class='comment'># @param args [Hash] The arguments to use for running.
|
1860
|
-
</span> <span class='comment'># @param options [Hash] The options of the application.
|
1861
|
-
</span> <span class='comment'># @return [Application] The new application.
|
1862
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1863
|
-
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1864
|
-
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
1865
|
-
<span class='id identifier rubyid_application'>application</span>
|
1866
|
-
<span class='kw'>end</span>
|
1867
2000
|
|
1868
|
-
|
1869
|
-
</span>
|
1870
|
-
</span>
|
1871
|
-
|
1872
|
-
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span>
|
1873
|
-
<span class='kw'>end</span>
|
2001
|
+
<span class='comment'># :nodoc:
|
2002
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
2003
|
+
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span>
|
2004
|
+
<span class='kw'>end</span>
|
1874
2005
|
<span class='kw'>end</span></pre>
|
1875
2006
|
</td>
|
1876
2007
|
</tr>
|
@@ -2054,7 +2185,15 @@
|
|
2054
2185
|
154
|
2055
2186
|
155
|
2056
2187
|
156
|
2057
|
-
157
|
2188
|
+
157
|
2189
|
+
158
|
2190
|
+
159
|
2191
|
+
160
|
2192
|
+
161
|
2193
|
+
162
|
2194
|
+
163
|
2195
|
+
164
|
2196
|
+
165</pre>
|
2058
2197
|
</td>
|
2059
2198
|
<td>
|
2060
2199
|
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 24</span>
|
@@ -2067,6 +2206,9 @@
|
|
2067
2206
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:show_commands</span>
|
2068
2207
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:output_commands</span>
|
2069
2208
|
|
2209
|
+
<span class='comment'># The location of the locales translation files.
|
2210
|
+
</span> <span class='const'>LOCALE_ROOT</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
|
2211
|
+
|
2070
2212
|
<span class='comment'># Initializes a new Bovem application.
|
2071
2213
|
</span> <span class='comment'>#
|
2072
2214
|
</span> <span class='comment'># In options, you can override the command line arguments with `:__args__`, and you can skip execution by specifying `run: false`.
|
@@ -2076,7 +2218,13 @@
|
|
2076
2218
|
</span> <span class='comment'># @param options [Hash] The settings to initialize the application with.
|
2077
2219
|
</span> <span class='comment'># @return [Application] The created application.
|
2078
2220
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2079
|
-
<span class='
|
2221
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
2222
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>Error</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
2223
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Application</span><span class='comma'>,</span> <span class='symbol'>:missing_block</span><span class='comma'>,</span>
|
2224
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_missing_app_block'>missing_app_block</span>
|
2225
|
+
<span class='rparen'>)</span>
|
2226
|
+
<span class='kw'>end</span>
|
2227
|
+
|
2080
2228
|
<span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
2081
2229
|
|
2082
2230
|
<span class='kw'>begin</span>
|
@@ -2087,6 +2235,32 @@
|
|
2087
2235
|
<span class='kw'>end</span>
|
2088
2236
|
<span class='kw'>end</span>
|
2089
2237
|
|
2238
|
+
<span class='comment'># Setup options for application creation.
|
2239
|
+
</span> <span class='comment'>#
|
2240
|
+
</span> <span class='comment'># @param options [Hash] The options to setups.
|
2241
|
+
</span> <span class='comment'># @return [Array] If to run the application, the arguments and the specified options.
|
2242
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
2243
|
+
<span class='id identifier rubyid_base_options'>base_options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
2244
|
+
<span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_default_application_name'>default_application_name</span><span class='comma'>,</span>
|
2245
|
+
<span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span>
|
2246
|
+
<span class='rbrace'>}</span>
|
2247
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_base_options'>base_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
2248
|
+
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
2249
|
+
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
2250
|
+
<span class='kw'>end</span>
|
2251
|
+
|
2252
|
+
<span class='comment'># Create the application.
|
2253
|
+
</span> <span class='comment'>#
|
2254
|
+
</span> <span class='comment'># @param run [Boolean] If to run the application.
|
2255
|
+
</span> <span class='comment'># @param args [Hash] The arguments to use for running.
|
2256
|
+
</span> <span class='comment'># @param options [Hash] The options of the application.
|
2257
|
+
</span> <span class='comment'># @return [Application] The new application.
|
2258
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2259
|
+
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2260
|
+
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
2261
|
+
<span class='id identifier rubyid_application'>application</span>
|
2262
|
+
<span class='kw'>end</span>
|
2263
|
+
|
2090
2264
|
<span class='comment'># Creates a new application.
|
2091
2265
|
</span> <span class='comment'>#
|
2092
2266
|
</span> <span class='comment'># @param options [Hash] The settings to initialize the application with.
|
@@ -2107,7 +2281,7 @@
|
|
2107
2281
|
</span> <span class='comment'># @param value [String|nil] The new version of this application.
|
2108
2282
|
</span> <span class='comment'># @return [String|nil] The version of this application.
|
2109
2283
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_version'>version</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2110
|
-
<span class='ivar'>@version</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>
|
2284
|
+
<span class='ivar'>@version</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
2111
2285
|
<span class='ivar'>@version</span>
|
2112
2286
|
<span class='kw'>end</span>
|
2113
2287
|
|
@@ -2124,14 +2298,14 @@
|
|
2124
2298
|
<span class='id identifier rubyid_action'>action</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_command'>command</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
2125
2299
|
<span class='kw'>end</span>
|
2126
2300
|
|
2127
|
-
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span
|
2301
|
+
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_application'>application</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span> <span class='rbrace'>}</span>
|
2128
2302
|
<span class='kw'>end</span>
|
2129
2303
|
|
2130
2304
|
<span class='comment'># The name of the current executable.
|
2131
2305
|
</span> <span class='comment'>#
|
2132
2306
|
</span> <span class='comment'># @return [String] The name of the current executable.
|
2133
2307
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_executable_name'>executable_name</span>
|
2134
|
-
<span class='gvar'>$
|
2308
|
+
<span class='gvar'>$PROGRAM_NAME</span>
|
2135
2309
|
<span class='kw'>end</span>
|
2136
2310
|
|
2137
2311
|
<span class='comment'># Shows a help about a command.
|
@@ -2140,13 +2314,9 @@
|
|
2140
2314
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
2141
2315
|
<span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_arg'>arg</span><span class='op'>|</span>
|
2142
2316
|
<span class='comment'># Find the command across
|
2143
|
-
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
2144
|
-
|
2145
|
-
<span class='
|
2146
|
-
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
2147
|
-
<span class='kw'>else</span>
|
2148
|
-
<span class='kw'>break</span>
|
2149
|
-
<span class='kw'>end</span>
|
2317
|
+
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='label'>args:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
2318
|
+
<span class='kw'>break</span> <span class='kw'>unless</span> <span class='id identifier rubyid_next_command'>next_command</span>
|
2319
|
+
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
2150
2320
|
<span class='kw'>end</span>
|
2151
2321
|
|
2152
2322
|
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span>
|
@@ -2164,34 +2334,11 @@
|
|
2164
2334
|
<span class='kw'>end</span>
|
2165
2335
|
|
2166
2336
|
<span class='id identifier rubyid_private'>private</span>
|
2167
|
-
<span class='comment'># Setup options for application creation.
|
2168
|
-
</span> <span class='comment'>#
|
2169
|
-
</span> <span class='comment'># @param options [Hash] The options to setups.
|
2170
|
-
</span> <span class='comment'># @return [Array] If to run the application, the arguments and the specified options.
|
2171
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
2172
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Localizer</span><span class='period'>.</span><span class='id identifier rubyid_localize_on_locale'>localize_on_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:default_application_name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
2173
|
-
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
2174
|
-
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
2175
|
-
<span class='kw'>end</span>
|
2176
2337
|
|
2177
|
-
|
2178
|
-
</span>
|
2179
|
-
</span>
|
2180
|
-
|
2181
|
-
</span> <span class='comment'># @param options [Hash] The options of the application.
|
2182
|
-
</span> <span class='comment'># @return [Application] The new application.
|
2183
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2184
|
-
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2185
|
-
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
2186
|
-
<span class='id identifier rubyid_application'>application</span>
|
2187
|
-
<span class='kw'>end</span>
|
2188
|
-
|
2189
|
-
<span class='comment'># Fetch a command list for showing help.
|
2190
|
-
</span> <span class='comment'>#
|
2191
|
-
</span> <span class='comment'># @param command [Command] The command to show help for.
|
2192
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
2193
|
-
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span>
|
2194
|
-
<span class='kw'>end</span>
|
2338
|
+
<span class='comment'># :nodoc:
|
2339
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
2340
|
+
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span>
|
2341
|
+
<span class='kw'>end</span>
|
2195
2342
|
<span class='kw'>end</span></pre>
|
2196
2343
|
</td>
|
2197
2344
|
</tr>
|
@@ -2396,7 +2543,15 @@
|
|
2396
2543
|
154
|
2397
2544
|
155
|
2398
2545
|
156
|
2399
|
-
157
|
2546
|
+
157
|
2547
|
+
158
|
2548
|
+
159
|
2549
|
+
160
|
2550
|
+
161
|
2551
|
+
162
|
2552
|
+
163
|
2553
|
+
164
|
2554
|
+
165</pre>
|
2400
2555
|
</td>
|
2401
2556
|
<td>
|
2402
2557
|
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 24</span>
|
@@ -2409,6 +2564,9 @@
|
|
2409
2564
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:show_commands</span>
|
2410
2565
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:output_commands</span>
|
2411
2566
|
|
2567
|
+
<span class='comment'># The location of the locales translation files.
|
2568
|
+
</span> <span class='const'>LOCALE_ROOT</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
|
2569
|
+
|
2412
2570
|
<span class='comment'># Initializes a new Bovem application.
|
2413
2571
|
</span> <span class='comment'>#
|
2414
2572
|
</span> <span class='comment'># In options, you can override the command line arguments with `:__args__`, and you can skip execution by specifying `run: false`.
|
@@ -2418,7 +2576,13 @@
|
|
2418
2576
|
</span> <span class='comment'># @param options [Hash] The settings to initialize the application with.
|
2419
2577
|
</span> <span class='comment'># @return [Application] The created application.
|
2420
2578
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2421
|
-
<span class='
|
2579
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
2580
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>Error</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
2581
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Application</span><span class='comma'>,</span> <span class='symbol'>:missing_block</span><span class='comma'>,</span>
|
2582
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_missing_app_block'>missing_app_block</span>
|
2583
|
+
<span class='rparen'>)</span>
|
2584
|
+
<span class='kw'>end</span>
|
2585
|
+
|
2422
2586
|
<span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
2423
2587
|
|
2424
2588
|
<span class='kw'>begin</span>
|
@@ -2429,6 +2593,32 @@
|
|
2429
2593
|
<span class='kw'>end</span>
|
2430
2594
|
<span class='kw'>end</span>
|
2431
2595
|
|
2596
|
+
<span class='comment'># Setup options for application creation.
|
2597
|
+
</span> <span class='comment'>#
|
2598
|
+
</span> <span class='comment'># @param options [Hash] The options to setups.
|
2599
|
+
</span> <span class='comment'># @return [Array] If to run the application, the arguments and the specified options.
|
2600
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
2601
|
+
<span class='id identifier rubyid_base_options'>base_options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
2602
|
+
<span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_default_application_name'>default_application_name</span><span class='comma'>,</span>
|
2603
|
+
<span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span>
|
2604
|
+
<span class='rbrace'>}</span>
|
2605
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_base_options'>base_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
2606
|
+
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
2607
|
+
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
2608
|
+
<span class='kw'>end</span>
|
2609
|
+
|
2610
|
+
<span class='comment'># Create the application.
|
2611
|
+
</span> <span class='comment'>#
|
2612
|
+
</span> <span class='comment'># @param run [Boolean] If to run the application.
|
2613
|
+
</span> <span class='comment'># @param args [Hash] The arguments to use for running.
|
2614
|
+
</span> <span class='comment'># @param options [Hash] The options of the application.
|
2615
|
+
</span> <span class='comment'># @return [Application] The new application.
|
2616
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2617
|
+
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2618
|
+
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
2619
|
+
<span class='id identifier rubyid_application'>application</span>
|
2620
|
+
<span class='kw'>end</span>
|
2621
|
+
|
2432
2622
|
<span class='comment'># Creates a new application.
|
2433
2623
|
</span> <span class='comment'>#
|
2434
2624
|
</span> <span class='comment'># @param options [Hash] The settings to initialize the application with.
|
@@ -2449,7 +2639,7 @@
|
|
2449
2639
|
</span> <span class='comment'># @param value [String|nil] The new version of this application.
|
2450
2640
|
</span> <span class='comment'># @return [String|nil] The version of this application.
|
2451
2641
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_version'>version</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2452
|
-
<span class='ivar'>@version</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>
|
2642
|
+
<span class='ivar'>@version</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
2453
2643
|
<span class='ivar'>@version</span>
|
2454
2644
|
<span class='kw'>end</span>
|
2455
2645
|
|
@@ -2466,14 +2656,14 @@
|
|
2466
2656
|
<span class='id identifier rubyid_action'>action</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_command'>command</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
2467
2657
|
<span class='kw'>end</span>
|
2468
2658
|
|
2469
|
-
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span
|
2659
|
+
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_application'>application</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span> <span class='rbrace'>}</span>
|
2470
2660
|
<span class='kw'>end</span>
|
2471
2661
|
|
2472
2662
|
<span class='comment'># The name of the current executable.
|
2473
2663
|
</span> <span class='comment'>#
|
2474
2664
|
</span> <span class='comment'># @return [String] The name of the current executable.
|
2475
2665
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_executable_name'>executable_name</span>
|
2476
|
-
<span class='gvar'>$
|
2666
|
+
<span class='gvar'>$PROGRAM_NAME</span>
|
2477
2667
|
<span class='kw'>end</span>
|
2478
2668
|
|
2479
2669
|
<span class='comment'># Shows a help about a command.
|
@@ -2482,13 +2672,9 @@
|
|
2482
2672
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
2483
2673
|
<span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_arg'>arg</span><span class='op'>|</span>
|
2484
2674
|
<span class='comment'># Find the command across
|
2485
|
-
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
2486
|
-
|
2487
|
-
<span class='
|
2488
|
-
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
2489
|
-
<span class='kw'>else</span>
|
2490
|
-
<span class='kw'>break</span>
|
2491
|
-
<span class='kw'>end</span>
|
2675
|
+
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='label'>args:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
2676
|
+
<span class='kw'>break</span> <span class='kw'>unless</span> <span class='id identifier rubyid_next_command'>next_command</span>
|
2677
|
+
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
2492
2678
|
<span class='kw'>end</span>
|
2493
2679
|
|
2494
2680
|
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span>
|
@@ -2506,34 +2692,11 @@
|
|
2506
2692
|
<span class='kw'>end</span>
|
2507
2693
|
|
2508
2694
|
<span class='id identifier rubyid_private'>private</span>
|
2509
|
-
<span class='comment'># Setup options for application creation.
|
2510
|
-
</span> <span class='comment'>#
|
2511
|
-
</span> <span class='comment'># @param options [Hash] The options to setups.
|
2512
|
-
</span> <span class='comment'># @return [Array] If to run the application, the arguments and the specified options.
|
2513
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
2514
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Localizer</span><span class='period'>.</span><span class='id identifier rubyid_localize_on_locale'>localize_on_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:default_application_name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
2515
|
-
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
2516
|
-
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
2517
|
-
<span class='kw'>end</span>
|
2518
2695
|
|
2519
|
-
|
2520
|
-
</span>
|
2521
|
-
</span>
|
2522
|
-
|
2523
|
-
</span> <span class='comment'># @param options [Hash] The options of the application.
|
2524
|
-
</span> <span class='comment'># @return [Application] The new application.
|
2525
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2526
|
-
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2527
|
-
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
2528
|
-
<span class='id identifier rubyid_application'>application</span>
|
2529
|
-
<span class='kw'>end</span>
|
2530
|
-
|
2531
|
-
<span class='comment'># Fetch a command list for showing help.
|
2532
|
-
</span> <span class='comment'>#
|
2533
|
-
</span> <span class='comment'># @param command [Command] The command to show help for.
|
2534
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
2535
|
-
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span>
|
2536
|
-
<span class='kw'>end</span>
|
2696
|
+
<span class='comment'># :nodoc:
|
2697
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
2698
|
+
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span>
|
2699
|
+
<span class='kw'>end</span>
|
2537
2700
|
<span class='kw'>end</span></pre>
|
2538
2701
|
</td>
|
2539
2702
|
</tr>
|
@@ -2602,19 +2765,6 @@
|
|
2602
2765
|
<div class='inline'><p>The created application.</p>
|
2603
2766
|
</div>
|
2604
2767
|
|
2605
|
-
</li>
|
2606
|
-
|
2607
|
-
</ul>
|
2608
|
-
<p class="tag_title">Raises:</p>
|
2609
|
-
<ul class="raise">
|
2610
|
-
|
2611
|
-
<li>
|
2612
|
-
|
2613
|
-
|
2614
|
-
<span class='type'>(<tt><span class='object_link'><a href="Errors/Error.html" title="Bovem::Errors::Error (class)">Bovem::Errors::Error</a></span></tt>)</span>
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
2618
2768
|
</li>
|
2619
2769
|
|
2620
2770
|
</ul>
|
@@ -2632,9 +2782,6 @@
|
|
2632
2782
|
<pre class="lines">
|
2633
2783
|
|
2634
2784
|
|
2635
|
-
40
|
2636
|
-
41
|
2637
|
-
42
|
2638
2785
|
43
|
2639
2786
|
44
|
2640
2787
|
45
|
@@ -2642,13 +2789,28 @@
|
|
2642
2789
|
47
|
2643
2790
|
48
|
2644
2791
|
49
|
2645
|
-
50
|
2792
|
+
50
|
2793
|
+
51
|
2794
|
+
52
|
2795
|
+
53
|
2796
|
+
54
|
2797
|
+
55
|
2798
|
+
56
|
2799
|
+
57
|
2800
|
+
58
|
2801
|
+
59</pre>
|
2646
2802
|
</td>
|
2647
2803
|
<td>
|
2648
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line
|
2804
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 43</span>
|
2649
2805
|
|
2650
2806
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2651
|
-
<span class='
|
2807
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
2808
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>Error</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
2809
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Application</span><span class='comma'>,</span> <span class='symbol'>:missing_block</span><span class='comma'>,</span>
|
2810
|
+
<span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_missing_app_block'>missing_app_block</span>
|
2811
|
+
<span class='rparen'>)</span>
|
2812
|
+
<span class='kw'>end</span>
|
2813
|
+
|
2652
2814
|
<span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
2653
2815
|
|
2654
2816
|
<span class='kw'>begin</span>
|
@@ -2661,6 +2823,204 @@
|
|
2661
2823
|
</td>
|
2662
2824
|
</tr>
|
2663
2825
|
</table>
|
2826
|
+
</div>
|
2827
|
+
|
2828
|
+
<div class="method_details ">
|
2829
|
+
<h3 class="signature " id="create_application-class_method">
|
2830
|
+
|
2831
|
+
+ (<tt><span class='object_link'><a href="" title="Bovem::Application (class)">Application</a></span></tt>) <strong>create_application</strong>(run, args, options, &block)
|
2832
|
+
|
2833
|
+
|
2834
|
+
|
2835
|
+
|
2836
|
+
|
2837
|
+
</h3><div class="docstring">
|
2838
|
+
<div class="discussion">
|
2839
|
+
<p>Create the application.</p>
|
2840
|
+
|
2841
|
+
|
2842
|
+
</div>
|
2843
|
+
</div>
|
2844
|
+
<div class="tags">
|
2845
|
+
<p class="tag_title">Parameters:</p>
|
2846
|
+
<ul class="param">
|
2847
|
+
|
2848
|
+
<li>
|
2849
|
+
|
2850
|
+
<span class='name'>run</span>
|
2851
|
+
|
2852
|
+
|
2853
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
2854
|
+
|
2855
|
+
|
2856
|
+
|
2857
|
+
—
|
2858
|
+
<div class='inline'><p>If to run the application.</p>
|
2859
|
+
</div>
|
2860
|
+
|
2861
|
+
</li>
|
2862
|
+
|
2863
|
+
<li>
|
2864
|
+
|
2865
|
+
<span class='name'>args</span>
|
2866
|
+
|
2867
|
+
|
2868
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2869
|
+
|
2870
|
+
|
2871
|
+
|
2872
|
+
—
|
2873
|
+
<div class='inline'><p>The arguments to use for running.</p>
|
2874
|
+
</div>
|
2875
|
+
|
2876
|
+
</li>
|
2877
|
+
|
2878
|
+
<li>
|
2879
|
+
|
2880
|
+
<span class='name'>options</span>
|
2881
|
+
|
2882
|
+
|
2883
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2884
|
+
|
2885
|
+
|
2886
|
+
|
2887
|
+
—
|
2888
|
+
<div class='inline'><p>The options of the application.</p>
|
2889
|
+
</div>
|
2890
|
+
|
2891
|
+
</li>
|
2892
|
+
|
2893
|
+
</ul>
|
2894
|
+
|
2895
|
+
<p class="tag_title">Returns:</p>
|
2896
|
+
<ul class="return">
|
2897
|
+
|
2898
|
+
<li>
|
2899
|
+
|
2900
|
+
|
2901
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Bovem::Application (class)">Application</a></span></tt>)</span>
|
2902
|
+
|
2903
|
+
|
2904
|
+
|
2905
|
+
—
|
2906
|
+
<div class='inline'><p>The new application.</p>
|
2907
|
+
</div>
|
2908
|
+
|
2909
|
+
</li>
|
2910
|
+
|
2911
|
+
</ul>
|
2912
|
+
|
2913
|
+
</div><table class="source_code">
|
2914
|
+
<tr>
|
2915
|
+
<td>
|
2916
|
+
<pre class="lines">
|
2917
|
+
|
2918
|
+
|
2919
|
+
81
|
2920
|
+
82
|
2921
|
+
83
|
2922
|
+
84
|
2923
|
+
85</pre>
|
2924
|
+
</td>
|
2925
|
+
<td>
|
2926
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 81</span>
|
2927
|
+
|
2928
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_application'>create_application</span><span class='lparen'>(</span><span class='id identifier rubyid_run'>run</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2929
|
+
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2930
|
+
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_application'>application</span> <span class='op'>&&</span> <span class='id identifier rubyid_run'>run</span>
|
2931
|
+
<span class='id identifier rubyid_application'>application</span>
|
2932
|
+
<span class='kw'>end</span></pre>
|
2933
|
+
</td>
|
2934
|
+
</tr>
|
2935
|
+
</table>
|
2936
|
+
</div>
|
2937
|
+
|
2938
|
+
<div class="method_details ">
|
2939
|
+
<h3 class="signature " id="setup_application_option-class_method">
|
2940
|
+
|
2941
|
+
+ (<tt>Array</tt>) <strong>setup_application_option</strong>(options)
|
2942
|
+
|
2943
|
+
|
2944
|
+
|
2945
|
+
|
2946
|
+
|
2947
|
+
</h3><div class="docstring">
|
2948
|
+
<div class="discussion">
|
2949
|
+
<p>Setup options for application creation.</p>
|
2950
|
+
|
2951
|
+
|
2952
|
+
</div>
|
2953
|
+
</div>
|
2954
|
+
<div class="tags">
|
2955
|
+
<p class="tag_title">Parameters:</p>
|
2956
|
+
<ul class="param">
|
2957
|
+
|
2958
|
+
<li>
|
2959
|
+
|
2960
|
+
<span class='name'>options</span>
|
2961
|
+
|
2962
|
+
|
2963
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2964
|
+
|
2965
|
+
|
2966
|
+
|
2967
|
+
—
|
2968
|
+
<div class='inline'><p>The options to setups.</p>
|
2969
|
+
</div>
|
2970
|
+
|
2971
|
+
</li>
|
2972
|
+
|
2973
|
+
</ul>
|
2974
|
+
|
2975
|
+
<p class="tag_title">Returns:</p>
|
2976
|
+
<ul class="return">
|
2977
|
+
|
2978
|
+
<li>
|
2979
|
+
|
2980
|
+
|
2981
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
2982
|
+
|
2983
|
+
|
2984
|
+
|
2985
|
+
—
|
2986
|
+
<div class='inline'><p>If to run the application, the arguments and the specified options.</p>
|
2987
|
+
</div>
|
2988
|
+
|
2989
|
+
</li>
|
2990
|
+
|
2991
|
+
</ul>
|
2992
|
+
|
2993
|
+
</div><table class="source_code">
|
2994
|
+
<tr>
|
2995
|
+
<td>
|
2996
|
+
<pre class="lines">
|
2997
|
+
|
2998
|
+
|
2999
|
+
65
|
3000
|
+
66
|
3001
|
+
67
|
3002
|
+
68
|
3003
|
+
69
|
3004
|
+
70
|
3005
|
+
71
|
3006
|
+
72
|
3007
|
+
73</pre>
|
3008
|
+
</td>
|
3009
|
+
<td>
|
3010
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 65</span>
|
3011
|
+
|
3012
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_application_option'>setup_application_option</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
3013
|
+
<span class='id identifier rubyid_base_options'>base_options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
3014
|
+
<span class='label'>name:</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'>LOCALE_ROOT</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_default_application_name'>default_application_name</span><span class='comma'>,</span>
|
3015
|
+
<span class='label'>parent:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>application:</span> <span class='kw'>nil</span>
|
3016
|
+
<span class='rbrace'>}</span>
|
3017
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_base_options'>base_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='rparen'>)</span>
|
3018
|
+
<span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
|
3019
|
+
<span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:__args__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
3020
|
+
<span class='kw'>end</span></pre>
|
3021
|
+
</td>
|
3022
|
+
</tr>
|
3023
|
+
</table>
|
2664
3024
|
</div>
|
2665
3025
|
|
2666
3026
|
</div>
|
@@ -2713,34 +3073,26 @@
|
|
2713
3073
|
<pre class="lines">
|
2714
3074
|
|
2715
3075
|
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
|
2726
|
-
112
|
2727
|
-
113
|
2728
|
-
114
|
2729
|
-
115</pre>
|
3076
|
+
137
|
3077
|
+
138
|
3078
|
+
139
|
3079
|
+
140
|
3080
|
+
141
|
3081
|
+
142
|
3082
|
+
143
|
3083
|
+
144
|
3084
|
+
145
|
3085
|
+
146</pre>
|
2730
3086
|
</td>
|
2731
3087
|
<td>
|
2732
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line
|
3088
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 137</span>
|
2733
3089
|
|
2734
3090
|
<span class='kw'>def</span> <span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
2735
3091
|
<span class='id identifier rubyid_fetch_commands_for_help'>fetch_commands_for_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_arg'>arg</span><span class='op'>|</span>
|
2736
3092
|
<span class='comment'># Find the command across
|
2737
|
-
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
2738
|
-
|
2739
|
-
<span class='
|
2740
|
-
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
2741
|
-
<span class='kw'>else</span>
|
2742
|
-
<span class='kw'>break</span>
|
2743
|
-
<span class='kw'>end</span>
|
3093
|
+
</span> <span class='id identifier rubyid_next_command'>next_command</span> <span class='op'>=</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_find_command'>find_command</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='label'>args:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
3094
|
+
<span class='kw'>break</span> <span class='kw'>unless</span> <span class='id identifier rubyid_next_command'>next_command</span>
|
3095
|
+
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_next_command'>next_command</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
2744
3096
|
<span class='kw'>end</span>
|
2745
3097
|
|
2746
3098
|
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span>
|
@@ -2792,15 +3144,15 @@
|
|
2792
3144
|
<pre class="lines">
|
2793
3145
|
|
2794
3146
|
|
2795
|
-
|
2796
|
-
|
2797
|
-
|
3147
|
+
130
|
3148
|
+
131
|
3149
|
+
132</pre>
|
2798
3150
|
</td>
|
2799
3151
|
<td>
|
2800
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line
|
3152
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 130</span>
|
2801
3153
|
|
2802
3154
|
<span class='kw'>def</span> <span class='id identifier rubyid_executable_name'>executable_name</span>
|
2803
|
-
<span class='gvar'>$
|
3155
|
+
<span class='gvar'>$PROGRAM_NAME</span>
|
2804
3156
|
<span class='kw'>end</span></pre>
|
2805
3157
|
</td>
|
2806
3158
|
</tr>
|
@@ -2853,12 +3205,12 @@
|
|
2853
3205
|
<pre class="lines">
|
2854
3206
|
|
2855
3207
|
|
2856
|
-
|
2857
|
-
|
2858
|
-
|
3208
|
+
114
|
3209
|
+
115
|
3210
|
+
116</pre>
|
2859
3211
|
</td>
|
2860
3212
|
<td>
|
2861
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line
|
3213
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 114</span>
|
2862
3214
|
|
2863
3215
|
<span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2864
3216
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span> <span class='op'>||</span> <span class='const'>ARGV</span><span class='rparen'>)</span>
|
@@ -2893,23 +3245,23 @@
|
|
2893
3245
|
<pre class="lines">
|
2894
3246
|
|
2895
3247
|
|
2896
|
-
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
3248
|
+
119
|
3249
|
+
120
|
3250
|
+
121
|
3251
|
+
122
|
3252
|
+
123
|
3253
|
+
124
|
3254
|
+
125</pre>
|
2903
3255
|
</td>
|
2904
3256
|
<td>
|
2905
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line
|
3257
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 119</span>
|
2906
3258
|
|
2907
3259
|
<span class='kw'>def</span> <span class='id identifier rubyid_help_option'>help_option</span>
|
2908
3260
|
<span class='id identifier rubyid_command'>command</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='label'>description:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_command_description'>help_command_description</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
2909
3261
|
<span class='id identifier rubyid_action'>action</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_command'>command</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_command_help'>command_help</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
2910
3262
|
<span class='kw'>end</span>
|
2911
3263
|
|
2912
|
-
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span
|
3264
|
+
<span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_short_form'>help_option_short_form</span><span class='comma'>,</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_option_long_form'>help_option_long_form</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>help:</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_help_message'>help_message</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_application'>application</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_show_help'>show_help</span> <span class='rbrace'>}</span>
|
2913
3265
|
<span class='kw'>end</span></pre>
|
2914
3266
|
</td>
|
2915
3267
|
</tr>
|
@@ -3028,12 +3380,12 @@
|
|
3028
3380
|
<pre class="lines">
|
3029
3381
|
|
3030
3382
|
|
3031
|
-
|
3032
|
-
|
3033
|
-
|
3383
|
+
155
|
3384
|
+
156
|
3385
|
+
157</pre>
|
3034
3386
|
</td>
|
3035
3387
|
<td>
|
3036
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line
|
3388
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/application.rb', line 155</span>
|
3037
3389
|
|
3038
3390
|
<span class='kw'>def</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_message'>message</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_show_exit'>show_exit</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_fatal'>fatal</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
3039
3391
|
<span class='ivar'>@shell</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_message'>message</span><span class='comma'>,</span> <span class='op'>!</span><span class='ivar'>@skip_commands</span><span class='comma'>,</span> <span class='id identifier rubyid_show_exit'>show_exit</span><span class='comma'>,</span> <span class='ivar'>@output_commands</span><span class='comma'>,</span> <span class='ivar'>@show_commands</span><span class='comma'>,</span> <span class='id identifier rubyid_fatal'>fatal</span><span class='rparen'>)</span>
|
@@ -3048,9 +3400,9 @@
|
|
3048
3400
|
</div>
|
3049
3401
|
|
3050
3402
|
<div id="footer">
|
3051
|
-
Generated on
|
3403
|
+
Generated on Tue Mar 29 20:43:18 2016 by
|
3052
3404
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
3053
|
-
0.8.7.
|
3405
|
+
0.8.7.6 (ruby-2.3.0).
|
3054
3406
|
</div>
|
3055
3407
|
|
3056
3408
|
</body>
|