cyclops 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +5 -0
- data/README +2 -2
- data/lib/cyclops.rb +25 -11
- data/lib/cyclops/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db466ccb87d28350391ce2adebba44b94dc71e2e
|
4
|
+
data.tar.gz: 4f98b24ed4c00d7f6f024504b5d5ec7f7155d914
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d552ed05cde6aadea4249bf1ef6f0a8509266dea4a7307157c597159aba2db0ae6da7ba1b89f9a256418ff52fdb3823239c5a73c4ac940ab7120bd9d8db44b90
|
7
|
+
data.tar.gz: d3fad67b9dd9197fba278b4e65961f0b3d4a540cbb9dbceafeeb9dd66a0f28096d23f5c371026ad67b3e7af3fc03cd4b266fd2a7ce084d5655b627627adb7e57
|
data/ChangeLog
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
= Revision history for cyclops
|
4
4
|
|
5
|
+
== 0.2.0 [2015-10-02]
|
6
|
+
|
7
|
+
* Extracted Cyclops#open_file and Cyclops#open_std from
|
8
|
+
Cyclops#open_file_or_std so they can be overwritten in subclasses.
|
9
|
+
|
5
10
|
== 0.1.0 [2014-11-26]
|
6
11
|
|
7
12
|
* Extracted Cyclops#config_present? from Cyclops#config_opts so it can be
|
data/README
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
== VERSION
|
4
4
|
|
5
|
-
This documentation refers to cyclops version 0.
|
5
|
+
This documentation refers to cyclops version 0.2.0
|
6
6
|
|
7
7
|
|
8
8
|
== DESCRIPTION
|
@@ -25,7 +25,7 @@ RubyGem:: https://rubygems.org/gems/cyclops
|
|
25
25
|
|
26
26
|
== LICENSE AND COPYRIGHT
|
27
27
|
|
28
|
-
Copyright (C) 2014 Jens Wille
|
28
|
+
Copyright (C) 2014-2015 Jens Wille
|
29
29
|
|
30
30
|
cyclops is free software: you can redistribute it and/or modify it
|
31
31
|
under the terms of the GNU Affero General Public License as published by
|
data/lib/cyclops.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# #
|
4
4
|
# cyclops -- A command-line option parser #
|
5
5
|
# #
|
6
|
-
# Copyright (C) 2014 Jens Wille
|
6
|
+
# Copyright (C) 2014-2015 Jens Wille #
|
7
7
|
# #
|
8
8
|
# Authors: #
|
9
9
|
# Jens Wille <jens.wille@gmail.com> #
|
@@ -95,8 +95,8 @@ class Cyclops
|
|
95
95
|
run(arguments)
|
96
96
|
rescue => err
|
97
97
|
raise if $VERBOSE
|
98
|
-
|
99
|
-
"#{err
|
98
|
+
err.is_a?(OptionParser::ParseError) ? quit(err) :
|
99
|
+
abort("#{err.backtrace.first}: #{err} (#{err.class})")
|
100
100
|
ensure
|
101
101
|
options.each_value { |value| value.close if value.is_a?(Zlib::GzipWriter) }
|
102
102
|
end
|
@@ -166,15 +166,29 @@ class Cyclops
|
|
166
166
|
Kernel.exit(status)
|
167
167
|
end
|
168
168
|
|
169
|
-
def open_file_or_std(file,
|
170
|
-
|
171
|
-
|
169
|
+
def open_file_or_std(file, mode = 'r')
|
170
|
+
mode = 'w' if mode == true
|
171
|
+
stdio?(file) ? open_std(file, mode) : open_file(file, mode)
|
172
|
+
end
|
172
173
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
174
|
+
def open_file(file, mode = 'r')
|
175
|
+
write = write?(mode) or
|
176
|
+
File.readable?(file) or quit "No such file: #{file}"
|
177
|
+
|
178
|
+
file =~ /\.gz\z/i ? (write ? Zlib::GzipWriter :
|
179
|
+
Zlib::GzipReader).open(file) : File.open(file, mode)
|
180
|
+
end
|
181
|
+
|
182
|
+
def open_std(file, mode = nil)
|
183
|
+
write?(mode) ? stdout : stdin
|
184
|
+
end
|
185
|
+
|
186
|
+
def write?(mode)
|
187
|
+
mode == true || mode =~ /w/
|
188
|
+
end
|
189
|
+
|
190
|
+
def stdio?(file)
|
191
|
+
file == '-'
|
178
192
|
end
|
179
193
|
|
180
194
|
def config_present?(config)
|
data/lib/cyclops/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyclops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
version: '0.8'
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 0.8.
|
50
|
+
version: 0.8.3
|
51
51
|
type: :development
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version: '0.8'
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.8.
|
60
|
+
version: 0.8.3
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,14 +94,14 @@ licenses:
|
|
94
94
|
metadata: {}
|
95
95
|
post_install_message: |2+
|
96
96
|
|
97
|
-
cyclops-0.
|
97
|
+
cyclops-0.2.0 [2015-10-02]:
|
98
98
|
|
99
|
-
* Extracted Cyclops#
|
100
|
-
overwritten in subclasses.
|
99
|
+
* Extracted Cyclops#open_file and Cyclops#open_std from
|
100
|
+
Cyclops#open_file_or_std so they can be overwritten in subclasses.
|
101
101
|
|
102
102
|
rdoc_options:
|
103
103
|
- "--title"
|
104
|
-
- cyclops Application documentation (v0.
|
104
|
+
- cyclops Application documentation (v0.2.0)
|
105
105
|
- "--charset"
|
106
106
|
- UTF-8
|
107
107
|
- "--line-numbers"
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.4.
|
125
|
+
rubygems_version: 2.4.8
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: A command-line option parser based on optparse.
|