dotopts 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.index +2 -2
- data/HISTORY.md +10 -0
- data/README.md +9 -9
- data/lib/dotopts/api.rb +15 -9
- metadata +2 -2
data/.index
CHANGED
@@ -49,7 +49,7 @@ paths:
|
|
49
49
|
created: '2013-01-23'
|
50
50
|
summary: Automatic Arguments for Ruby
|
51
51
|
title: DotOpts
|
52
|
-
version: 0.1.
|
52
|
+
version: 0.1.1
|
53
53
|
name: dotopts
|
54
54
|
description: DotOpts is an automatic commandline argument augmenter for Ruby tools.
|
55
|
-
date: '2013-01-
|
55
|
+
date: '2013-01-29'
|
data/HISTORY.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# RELEASE HISTORY
|
2
2
|
|
3
|
+
## 0.1.1 / 2013-01-29
|
4
|
+
|
5
|
+
This release simply fixes the missing optional argument on the
|
6
|
+
`DotOpts#configure!` method's interface.
|
7
|
+
|
8
|
+
Changes:
|
9
|
+
|
10
|
+
* Fix `DotOpts#configure!` method. [bug]
|
11
|
+
|
12
|
+
|
3
13
|
## 0.1.0 / 2013-01-28
|
4
14
|
|
5
15
|
First release of DotOpts.
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
[![Build Status](https://secure.travis-ci.org/rubyworks/dotopts.png)](http://travis-ci.org/rubyworks/dotopts)
|
2
1
|
[![Gem Version](https://badge.fury.io/rb/dotopts.png)](http://badge.fury.io/rb/dotopts)
|
2
|
+
[![Build Status](https://secure.travis-ci.org/rubyworks/dotopts.png)](http://travis-ci.org/rubyworks/dotopts)
|
3
3
|
|
4
4
|
<br/>
|
5
5
|
|
6
6
|
# DotOpts
|
7
7
|
|
8
|
-
**
|
8
|
+
**Automated Commandline Options (for Ruby Executables)**
|
9
9
|
|
10
10
|
[Website](http://rubyworks.github.com/dotopts) /
|
11
11
|
[Report Issue](http://github.com/rubyworks/dotopts/issues) /
|
@@ -14,9 +14,9 @@
|
|
14
14
|
|
15
15
|
## About
|
16
16
|
|
17
|
-
DotOpts is an automatic
|
18
|
-
local `.opts` configuration file and applies the appropriate
|
19
|
-
when a matching command is invoked.
|
17
|
+
DotOpts is an automatic commandline argument augmenter. It looks for a
|
18
|
+
project's local `.opts` configuration file and applies the appropriate
|
19
|
+
arguments when a matching command is invoked.
|
20
20
|
|
21
21
|
|
22
22
|
## Features
|
@@ -35,7 +35,7 @@ DotOpts can be install via Rubygems:
|
|
35
35
|
gem install dotopts
|
36
36
|
|
37
37
|
If you would like to use DotOpts with all Ruby tools, regardless of
|
38
|
-
|
38
|
+
whether they have built-in support for DotOpts, then add `-rdotopts`
|
39
39
|
to you `RUBYOPT` environment variable.
|
40
40
|
|
41
41
|
export RUBYOPT="-rdotopts"
|
@@ -119,8 +119,8 @@ using regular expressions.
|
|
119
119
|
## Third Party Support
|
120
120
|
|
121
121
|
Ruby tool developers can support dotopts out-of-the-box simple by running
|
122
|
-
`require '
|
123
|
-
simply
|
122
|
+
`require 'dotopts'` in their program before parsing the commandline. DotOpts
|
123
|
+
simply injects arguments into `ARGV` so it can work with any commandline
|
124
124
|
option parser.
|
125
125
|
|
126
126
|
|
@@ -129,7 +129,7 @@ option parser.
|
|
129
129
|
### Universal Solution?
|
130
130
|
|
131
131
|
It would be awesome if it were possible to have DotOpts apply to *all* executables,
|
132
|
-
not just Ruby-based executables. But I do not know
|
132
|
+
not just Ruby-based executables. But I do not know how this can be done for Bash, Zsh
|
133
133
|
or any other shell. Of course, each scripting language could potentially have
|
134
134
|
its own implementation of DotOpts, which would cover many more executables, but it
|
135
135
|
would still not cover all of them.
|
data/lib/dotopts/api.rb
CHANGED
@@ -2,23 +2,29 @@ module DotOpts
|
|
2
2
|
require 'dotopts/parser'
|
3
3
|
|
4
4
|
#
|
5
|
-
|
5
|
+
OPTIONS_FILE = '.opts'
|
6
6
|
|
7
7
|
# Configure
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
#
|
9
|
+
# @param [String] file
|
10
|
+
# The configuration file to load. (optional)
|
11
|
+
#
|
12
|
+
# @return nothing
|
13
|
+
def self.configure!(file=nil)
|
14
|
+
file = options_file unless file
|
15
|
+
if file
|
16
|
+
text = File.read(file)
|
11
17
|
parser = Parser.parse(text)
|
12
18
|
ARGV.concat parser.arguments
|
13
|
-
end
|
19
|
+
end
|
14
20
|
end
|
15
21
|
|
16
|
-
# Returns the
|
22
|
+
# Returns the options file of the current project.
|
17
23
|
#
|
18
|
-
# @return {String] The
|
19
|
-
def self.
|
24
|
+
# @return {String] The options file of the project.
|
25
|
+
def self.options_file
|
20
26
|
if project_root
|
21
|
-
file = File.join(project_root,
|
27
|
+
file = File.join(project_root, OPTIONS_FILE)
|
22
28
|
return file if File.exist?(file)
|
23
29
|
end
|
24
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotopts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: qed
|