rst 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +5 -0
- data/README.md +13 -0
- data/bin/rst +37 -39
- data/features/help.feature +3 -2
- data/features/step_definitions/methadone_steps.rb +56 -0
- data/features/step_definitions/rst_steps.rb +1 -1
- data/features/support/env.rb +0 -1
- data/lib/rst/version.rb +1 -1
- data/rst.gemspec +1 -1
- metadata +7 -4
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,8 +1,21 @@
|
|
1
1
|
rst
|
2
2
|
---
|
3
3
|
|
4
|
+
[](http://travis-ci.org/clnclarinet/rst)
|
5
|
+
|
4
6
|
A command line client for [rstat.us](http://rstat.us). Heavily influenced by [t](https://github.com/sferik/t).
|
5
7
|
|
8
|
+
Usage
|
9
|
+
-----
|
10
|
+
|
11
|
+
Install the gem:
|
12
|
+
|
13
|
+
gem install rst
|
14
|
+
|
15
|
+
Run with no arguments to see the help:
|
16
|
+
|
17
|
+
rst
|
18
|
+
|
6
19
|
Current Functionality
|
7
20
|
---------------------
|
8
21
|
|
data/bin/rst
CHANGED
@@ -1,51 +1,49 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
main do |command|
|
12
|
-
case command
|
13
|
-
when "world"
|
14
|
-
puts "\n"
|
15
|
-
puts Rst::CLI.world.join("\n\n")
|
16
|
-
else
|
17
|
-
puts opts
|
2
|
+
# 1.9 adds realpath to resolve symlinks; 1.8 doesn't
|
3
|
+
# have this method, so we add it so we get resolved symlinks
|
4
|
+
# and compatibility
|
5
|
+
unless File.respond_to? :realpath
|
6
|
+
class File #:nodoc:
|
7
|
+
def self.realpath path
|
8
|
+
return realpath(File.readlink(path)) if symlink?(path)
|
9
|
+
path
|
18
10
|
end
|
19
|
-
exit 0
|
20
11
|
end
|
12
|
+
end
|
13
|
+
$: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
14
|
+
|
15
|
+
require 'gli'
|
16
|
+
require 'rst'
|
21
17
|
|
22
|
-
|
18
|
+
include GLI
|
23
19
|
|
24
|
-
|
20
|
+
program_desc 'A command line interface for rstat.us'
|
25
21
|
|
26
|
-
|
22
|
+
version Rst::VERSION
|
27
23
|
|
28
|
-
|
24
|
+
desc 'Display the version and exit.'
|
25
|
+
switch [:v, :version]
|
29
26
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
# on("--[no-]switch","Some switch")
|
37
|
-
#
|
38
|
-
# Or, just call OptionParser methods on opts
|
39
|
-
#
|
40
|
-
# Require an argument
|
41
|
-
# arg :some_arg
|
42
|
-
#
|
43
|
-
# # Make an argument optional
|
44
|
-
# arg :optional_arg, :optional
|
27
|
+
desc 'Get the latest statuses from the whole rstat.us world'
|
28
|
+
command :world do |c|
|
29
|
+
c.action do |global_options, options, args|
|
30
|
+
puts Rst::CLI.world.join("\n\n")
|
31
|
+
end
|
32
|
+
end
|
45
33
|
|
46
|
-
|
34
|
+
pre do |global, command, options, args|
|
35
|
+
if global[:v]
|
36
|
+
puts "version #{Rst::VERSION}"
|
37
|
+
exit! 0
|
38
|
+
end
|
39
|
+
true
|
40
|
+
end
|
47
41
|
|
48
|
-
|
42
|
+
post do |global, command, options, args|
|
43
|
+
end
|
49
44
|
|
50
|
-
|
45
|
+
on_error do |exception|
|
46
|
+
true
|
51
47
|
end
|
48
|
+
|
49
|
+
exit GLI.run(ARGV)
|
data/features/help.feature
CHANGED
@@ -10,7 +10,7 @@ Feature: Help text
|
|
10
10
|
And the banner should document that this app takes options
|
11
11
|
And the following options should be documented:
|
12
12
|
|--version|
|
13
|
-
|--
|
13
|
+
|--help|
|
14
14
|
|
15
15
|
Scenario: rst --help
|
16
16
|
When I get help for "rst"
|
@@ -19,7 +19,8 @@ Feature: Help text
|
|
19
19
|
And the banner should document that this app takes options
|
20
20
|
And the following options should be documented:
|
21
21
|
|--version|
|
22
|
+
|--help|
|
22
23
|
And the output should contain:
|
23
24
|
"""
|
24
|
-
|
25
|
+
usage: rst [global options] command
|
25
26
|
"""
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Cucumber step definitions from
|
2
|
+
# http://github.com/davetron5000/methadone/blob/master/lib/methadone/cucumber.rb
|
3
|
+
|
4
|
+
When /^I get help for "([^"]*)"$/ do |app_name|
|
5
|
+
@app_name = app_name
|
6
|
+
step %(I run `#{app_name} --help`)
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^the following options should be documented:$/ do |options|
|
10
|
+
options.raw.each do |option|
|
11
|
+
step %(the option "#{option[0]}" should be documented)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Then /^the option "([^"]*)" should be documented$/ do |option|
|
16
|
+
step %(the output should match /\\s*#{Regexp.escape(option)}[\\s\\W]+\\w\\w\\w+/)
|
17
|
+
end
|
18
|
+
|
19
|
+
Then /^the banner should be present$/ do
|
20
|
+
step %(the output should match /usage: #{@app_name}/)
|
21
|
+
end
|
22
|
+
|
23
|
+
Then /^the banner should document that this app takes options$/ do
|
24
|
+
step %(the output should match /\[options\]/)
|
25
|
+
step %(the output should contain "Options")
|
26
|
+
end
|
27
|
+
|
28
|
+
Then /^the banner should document that this app's arguments are:$/ do |table|
|
29
|
+
expected_arguments = table.raw.map { |row|
|
30
|
+
option = row[0]
|
31
|
+
option = "[#{option}]" if row[1] == 'optional' || row[1] == 'which is optional'
|
32
|
+
option
|
33
|
+
}.join(' ')
|
34
|
+
step %(the output should contain "#{expected_arguments}")
|
35
|
+
end
|
36
|
+
|
37
|
+
Then /^the banner should document that this app takes no options$/ do
|
38
|
+
step %(the output should not contain "[options]")
|
39
|
+
step %(the output should not contain "Options")
|
40
|
+
end
|
41
|
+
|
42
|
+
Then /^the banner should document that this app takes no arguments$/ do
|
43
|
+
step %(the output should match /Usage: #{@app_name}\\s*\(\\[options\\]\)?$/)
|
44
|
+
end
|
45
|
+
|
46
|
+
Then /^the banner should include the version$/ do
|
47
|
+
step %(the output should match /v\\d+\\.\\d+\\.\\d+/)
|
48
|
+
end
|
49
|
+
|
50
|
+
Then /^there should be a one line summary of what the app does$/ do
|
51
|
+
output_lines = all_output.split(/\n/)
|
52
|
+
output_lines.should have_at_least(3).items
|
53
|
+
# [0] is our banner, which we've checked for
|
54
|
+
output_lines[1].should match(/^\s*$/)
|
55
|
+
output_lines[2].should match(/^\w\w+\s+\w\w+/)
|
56
|
+
end
|
data/features/support/env.rb
CHANGED
data/lib/rst/version.rb
CHANGED
data/rst.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_development_dependency('rake','~> 0.9.2')
|
22
22
|
gem.add_development_dependency('vcr', '~> 2.1.1')
|
23
23
|
|
24
|
-
gem.add_dependency('
|
24
|
+
gem.add_dependency('gli', '~> 1.6.0')
|
25
25
|
gem.add_dependency('typhoeus', '~> 0.3.3')
|
26
26
|
gem.add_dependency('nokogiri', '~> 1.5.2')
|
27
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rst
|
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:
|
@@ -108,13 +108,13 @@ dependencies:
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: 2.1.1
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
111
|
+
name: gli
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
113
|
none: false
|
114
114
|
requirements:
|
115
115
|
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
117
|
+
version: 1.6.0
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
requirements:
|
123
123
|
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 1.
|
125
|
+
version: 1.6.0
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: typhoeus
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,12 +165,14 @@ extra_rdoc_files: []
|
|
165
165
|
files:
|
166
166
|
- .gitignore
|
167
167
|
- .rvmrc
|
168
|
+
- .travis.yml
|
168
169
|
- Gemfile
|
169
170
|
- LICENSE
|
170
171
|
- README.md
|
171
172
|
- Rakefile
|
172
173
|
- bin/rst
|
173
174
|
- features/help.feature
|
175
|
+
- features/step_definitions/methadone_steps.rb
|
174
176
|
- features/step_definitions/rst_steps.rb
|
175
177
|
- features/support/env.rb
|
176
178
|
- features/world.feature
|
@@ -211,6 +213,7 @@ specification_version: 3
|
|
211
213
|
summary: A command line client for rstat.us
|
212
214
|
test_files:
|
213
215
|
- features/help.feature
|
216
|
+
- features/step_definitions/methadone_steps.rb
|
214
217
|
- features/step_definitions/rst_steps.rb
|
215
218
|
- features/support/env.rb
|
216
219
|
- features/world.feature
|