roda-route_list 2.0.0 → 2.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG +5 -1
- data/MIT-LICENSE +1 -1
- data/Rakefile +3 -12
- data/bin/roda-parse_routes +6 -1
- data/spec/roda-route_list_spec.rb +21 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a77d83e5113f962868d1ac46dae2a1f1476fc717
|
4
|
+
data.tar.gz: a224916022deddc115cb074fe2cb274b2db03e7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f30faf5497f0c6a52f28aaa1ca6cdb83e693bf228b79cb72c1bd092d5b2211646ee3d8e1385e4e644bdef6d9b0a115977be36416d977725a90e3d7434528120d
|
7
|
+
data.tar.gz: 56c09a4ba09b5ada0bce76f5e2f717182cf8a9bd3dd9ef45c5f2595b1ee0fdf827b081402f1ee93ff6f77a12884a93b724ae52a58519e5f2db71fd4457491e7c
|
data/CHANGELOG
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
= 2.1.0 (2017-10-09)
|
2
|
+
|
3
|
+
* Add support for -p flag for bin/roda-parse_routes to pretty print the JSON file (oldgreen) (#3)
|
4
|
+
|
1
5
|
= 2.0.0 (2016-02-24)
|
2
6
|
|
3
|
-
* Use Roda.listed_route instead of
|
7
|
+
* Use Roda.listed_route instead of Roda.named_route to not conflict with multi_route plugin (jeremyevans) (#1)
|
4
8
|
|
5
9
|
= 1.0.0 (2015-03-08)
|
6
10
|
|
data/MIT-LICENSE
CHANGED
data/Rakefile
CHANGED
@@ -10,11 +10,9 @@ end
|
|
10
10
|
|
11
11
|
### Specs
|
12
12
|
|
13
|
-
desc "
|
13
|
+
desc "Run all specs"
|
14
14
|
task :spec do |p|
|
15
15
|
ENV['RUBY'] = FileUtils::RUBY
|
16
|
-
ENV['RUBYLIB'] = "ENV['RUBYLIB']:lib"
|
17
|
-
ENV['RUBYOPT'] = "-rubygems"
|
18
16
|
sh %{#{FileUtils::RUBY} spec/roda-route_list_spec.rb }
|
19
17
|
end
|
20
18
|
task :default=>:spec
|
@@ -29,19 +27,12 @@ begin
|
|
29
27
|
rescue Gem::LoadError
|
30
28
|
end
|
31
29
|
|
32
|
-
|
33
|
-
require "rdoc/task"
|
34
|
-
RDoc::Task
|
35
|
-
rescue LoadError
|
36
|
-
require "rake/rdoctask"
|
37
|
-
Rake::RDocTask
|
38
|
-
end
|
30
|
+
require "rdoc/task"
|
39
31
|
|
40
32
|
RDOC_OPTS = RDOC_DEFAULT_OPTS + ['--main', 'README.rdoc']
|
41
33
|
|
42
|
-
|
34
|
+
RDoc::Task.new do |rdoc|
|
43
35
|
rdoc.rdoc_dir = "rdoc"
|
44
36
|
rdoc.options += RDOC_OPTS
|
45
37
|
rdoc.rdoc_files.add %w"README.rdoc CHANGELOG MIT-LICENSE lib/**/*.rb"
|
46
38
|
end
|
47
|
-
|
data/bin/roda-parse_routes
CHANGED
@@ -5,6 +5,7 @@ require 'json'
|
|
5
5
|
require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'lib', 'roda-route_parser')
|
6
6
|
|
7
7
|
file = $stdout
|
8
|
+
json_gen_opts = {}
|
8
9
|
options = OptionParser.new do |opts|
|
9
10
|
opts.banner = "roda-parse_routes: Parse route comments from roda app files"
|
10
11
|
opts.define_head "Usage: roda-parse_routes [options] [file] ..."
|
@@ -18,8 +19,12 @@ options = OptionParser.new do |opts|
|
|
18
19
|
opts.on("-f", "--file ", "output to given file instead of stdout") do |v|
|
19
20
|
file = File.open(v, 'wb')
|
20
21
|
end
|
22
|
+
|
23
|
+
opts.on("-p", "--pretty", "output pretty json (with indentation and newlines)") do
|
24
|
+
json_gen_opts = {:indent => ' ', :space => ' ', :object_nl => "\n", :array_nl => "\n"}
|
25
|
+
end
|
21
26
|
end
|
22
27
|
opts = options
|
23
28
|
opts.parse!
|
24
29
|
|
25
|
-
file.puts(RodaRouteParser.parse(ARGF).to_json)
|
30
|
+
file.puts(RodaRouteParser.parse(ARGF).to_json(json_gen_opts))
|
@@ -1,7 +1,10 @@
|
|
1
1
|
require 'roda'
|
2
2
|
require 'json'
|
3
|
+
gem 'minitest'
|
3
4
|
require 'minitest/autorun'
|
4
5
|
|
6
|
+
$: << File.join(File.dirname(__FILE__), '..', 'lib')
|
7
|
+
|
5
8
|
describe 'roda-route_list plugin' do
|
6
9
|
def req(path='/', env={})
|
7
10
|
if path.is_a?(Hash)
|
@@ -98,7 +101,12 @@ end
|
|
98
101
|
|
99
102
|
describe 'roda-route_parser executable' do
|
100
103
|
after do
|
101
|
-
|
104
|
+
%w[spec/routes-example.json spec/routes-example-pretty.json].each do |file|
|
105
|
+
begin
|
106
|
+
File.delete(file)
|
107
|
+
rescue Errno::ENOENT
|
108
|
+
end
|
109
|
+
end
|
102
110
|
end
|
103
111
|
|
104
112
|
it "should correctly parse the routes" do
|
@@ -106,4 +114,16 @@ describe 'roda-route_parser executable' do
|
|
106
114
|
File.file?("spec/routes-example.json").must_equal true
|
107
115
|
JSON.parse(File.read('spec/routes-example.json')).must_equal JSON.parse(File.read('spec/routes.json'))
|
108
116
|
end
|
117
|
+
|
118
|
+
it "should correctly write the pretty routes" do
|
119
|
+
system(ENV['RUBY'] || 'ruby', "bin/roda-parse_routes", "-f", "spec/routes-example-pretty.json", "-p", "spec/routes.example")
|
120
|
+
File.file?("spec/routes-example-pretty.json").must_equal true
|
121
|
+
File.read("spec/routes-example-pretty.json").must_equal(File.read("spec/routes-pretty.json"))
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should correctly parse the pretty routes" do
|
125
|
+
system(ENV['RUBY'] || 'ruby', "bin/roda-parse_routes", "-f", "spec/routes-example-pretty.json", "-p", "spec/routes.example")
|
126
|
+
File.file?("spec/routes-example-pretty.json").must_equal true
|
127
|
+
JSON.parse(File.read('spec/routes-example-pretty.json')).must_equal JSON.parse(File.read('spec/routes.json'))
|
128
|
+
end
|
109
129
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roda-route_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: roda
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.
|
92
|
+
rubygems_version: 2.6.13
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: List routes when using Roda
|