taxplorer 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +4 -1
- data/lib/taxplorer/command.rb +2 -2
- data/lib/taxplorer/find.rb +1 -5
- data/lib/taxplorer/version.rb +1 -1
- data/lib/taxplorer/view.rb +12 -12
- data/lib/taxplorer.rb +1 -0
- data/test/test_helper.rb +14 -1
- data/test/view_test.rb +38 -29
- metadata +2 -5
- data/.coveralls.yml +0 -1
- data/test/command_test.rb +0 -6
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjY0ODQ1ZTVjMjUwYjhkYWI2MjQ4MzY2M2IxM2RlYTE1ODYzNTY1MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWU0OTNlOWNmYmQ1MzM0ZWFkZjM2ZDhmNmQ5MWQ3ODAyZDM2ODE0Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODM3OTFmM2FhMWQ4YzhkMjVmNGI4Y2FhZmRhNjY5YWIyMjAwM2Q2Yzk3YTdj
|
10
|
+
NWI2YTdiY2JmYWE4MzkxYjliNGQwYWNjNjhjMTY0ZmIwMGQ5ODIzY2EyY2Uz
|
11
|
+
NzNhNTM0NmQ2MDdlNGY5MDU3Nzk3YjYwNWVlMjRlYTdlYjQ5ZGY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODkxODRkMDdkOWYyMmRkMjYxYmFkMjdmOTU3NTQyMWVhMDIzOTRjMzg5NmM4
|
14
|
+
NDRlOWQyYTFmMDc0ZWUyYWFmMWUwMzBlYjllY2ZkZWQyM2U3MDk3ODY0MzIx
|
15
|
+
NGQ1M2Y5ZTU0NWZkMTVhYmQxMTRhYTkxMGFhMjM0NGViMTQ5ZjU=
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Taxplorer
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/taxplorer.svg)](http://badge.fury.io/rb/taxplorer)
|
4
|
+
[![Build Status](https://travis-ci.org/seocahill/taxplorer.svg?branch=master)](https://travis-ci.org/seocahill/taxplorer)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/seocahill/taxplorer/badges/gpa.svg)](https://codeclimate.com/github/seocahill/taxplorer)
|
6
|
+
[![Test Coverage](https://codeclimate.com/github/seocahill/taxplorer/badges/coverage.svg)](https://codeclimate.com/github/seocahill/taxplorer/coverage)
|
4
7
|
|
5
8
|
Taxplorer is a command line tool to view the content of XBRL taxonomy Schemas.
|
6
9
|
|
data/lib/taxplorer/command.rb
CHANGED
@@ -12,7 +12,7 @@ module Taxplorer
|
|
12
12
|
def welcome_prompt
|
13
13
|
choose do |menu|
|
14
14
|
menu.prompt = "Choose preferred taxonomy"
|
15
|
-
["
|
15
|
+
["UK GAAP", "UK IFRS"].each do |t|
|
16
16
|
menu.choice(t) { |c| say("have a glass of whiskey while we load up #{c} for you"); load_taxonomy }
|
17
17
|
end
|
18
18
|
end
|
@@ -61,7 +61,7 @@ module Taxplorer
|
|
61
61
|
menu_prompt
|
62
62
|
when "tree"
|
63
63
|
clear
|
64
|
-
tree_view(node)
|
64
|
+
puts tree_view(node)
|
65
65
|
puts "\n\n"
|
66
66
|
node_commands(node)
|
67
67
|
when "quit"
|
data/lib/taxplorer/find.rb
CHANGED
@@ -19,11 +19,7 @@ module Taxplorer
|
|
19
19
|
def get_parent(node)
|
20
20
|
child = @section[:elements].values.find {|e| e[:label] == node}
|
21
21
|
parent = @section[:elements].values.find {|p| p[:label] == child[:parent]} if child
|
22
|
-
|
23
|
-
node_commands(parent[:label])
|
24
|
-
else
|
25
|
-
menu_prompt
|
26
|
-
end
|
22
|
+
parent ? node_commands(parent[:label]) : menu_prompt
|
27
23
|
end
|
28
24
|
|
29
25
|
def get_children(node_id)
|
data/lib/taxplorer/version.rb
CHANGED
data/lib/taxplorer/view.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
module Taxplorer
|
2
2
|
module View
|
3
3
|
|
4
|
-
def
|
5
|
-
|
6
|
-
|
7
|
-
else
|
8
|
-
puts "no information"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def tree_view(node, links="")
|
4
|
+
def build_tree(node, level)
|
5
|
+
leaf = {value: node, level: level}
|
6
|
+
@nodes << leaf
|
13
7
|
children = @section[:elements].values.select {|e| e[:parent] == node}
|
14
|
-
|
15
|
-
links = links + " "
|
8
|
+
level += 1
|
16
9
|
children.map do |child|
|
17
|
-
|
10
|
+
build_tree(child[:label], level)
|
18
11
|
end
|
12
|
+
@nodes
|
13
|
+
end
|
14
|
+
|
15
|
+
def tree_view(node)
|
16
|
+
@nodes = []
|
17
|
+
build_tree(node, 0)
|
18
|
+
Hirb::Helpers::Tree.render(@nodes, type: :directory)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/taxplorer.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
require 'simplecov'
|
2
|
-
SimpleCov.start
|
3
2
|
require "codeclimate-test-reporter"
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter "test"
|
5
|
+
add_filter "taxplorer/command.rb"
|
6
|
+
end
|
4
7
|
CodeClimate::TestReporter.start
|
5
8
|
require 'minitest/autorun'
|
6
9
|
|
10
|
+
module Helpers
|
11
|
+
def with_stdin
|
12
|
+
stdin = $stdin
|
13
|
+
$stdin, write = IO.pipe
|
14
|
+
yield write
|
15
|
+
ensure
|
16
|
+
write.close
|
17
|
+
$stdin = stdin
|
18
|
+
end
|
19
|
+
end
|
data/test/view_test.rb
CHANGED
@@ -4,39 +4,48 @@ require 'taxplorer'
|
|
4
4
|
|
5
5
|
class TestView < Minitest::Test
|
6
6
|
def setup
|
7
|
-
@
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
7
|
+
@mockapp = Class.new do
|
8
|
+
include Taxplorer::View
|
9
|
+
def initialize
|
10
|
+
@nodes = []
|
11
|
+
@section = {
|
12
|
+
elements: {
|
13
|
+
"root": {label: "root"},
|
14
|
+
"A": {label: "A", parent: "root"},
|
15
|
+
"B": {label: "B", parent: "root"},
|
16
|
+
"C": {label: "C", parent: "root"},
|
17
|
+
"D": {label: "D", parent: "B"},
|
18
|
+
"E": {label: "E", parent: "D"},
|
19
|
+
"F": {label: "F", parent: "D"}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
end
|
23
|
+
def clear;end
|
24
|
+
end.new
|
18
25
|
end
|
19
26
|
|
20
|
-
def
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
+
def test_build_tree
|
28
|
+
tree_hash = [
|
29
|
+
{value: "root", level:0},
|
30
|
+
{value: "A", level:1},
|
31
|
+
{value: "B", level:1},
|
32
|
+
{value: "D", level:2},
|
33
|
+
{value: "E", level:3},
|
34
|
+
{value: "F", level:3},
|
35
|
+
{value: "C", level:1},
|
36
|
+
]
|
37
|
+
assert_equal tree_hash, @mockapp.build_tree("root", 0)
|
27
38
|
end
|
28
39
|
|
29
40
|
def test_tree_view
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
38
|
-
|
39
|
-
"
|
40
|
-
assert_equal result, tree_view("root")
|
41
|
+
result =
|
42
|
+
"root\n"+
|
43
|
+
"|-- A\n"+
|
44
|
+
"|-- B\n"+
|
45
|
+
"| `-- D\n"+
|
46
|
+
"| |-- E\n"+
|
47
|
+
"| `-- F\n"+
|
48
|
+
"`-- C"
|
49
|
+
assert_equal result, @mockapp.tree_view("root")
|
41
50
|
end
|
42
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taxplorer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seosamh Cahill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -130,7 +130,6 @@ executables:
|
|
130
130
|
extensions: []
|
131
131
|
extra_rdoc_files: []
|
132
132
|
files:
|
133
|
-
- .coveralls.yml
|
134
133
|
- .gitignore
|
135
134
|
- .travis.yml
|
136
135
|
- Gemfile
|
@@ -165,7 +164,6 @@ files:
|
|
165
164
|
- lib/taxplorer/version.rb
|
166
165
|
- lib/taxplorer/view.rb
|
167
166
|
- taxplorer.gemspec
|
168
|
-
- test/command_test.rb
|
169
167
|
- test/find_test.rb
|
170
168
|
- test/parse_test.rb
|
171
169
|
- test/taxplorer_test.rb
|
@@ -196,7 +194,6 @@ signing_key:
|
|
196
194
|
specification_version: 4
|
197
195
|
summary: XBRL taxonomy parser
|
198
196
|
test_files:
|
199
|
-
- test/command_test.rb
|
200
197
|
- test/find_test.rb
|
201
198
|
- test/parse_test.rb
|
202
199
|
- test/taxplorer_test.rb
|
data/.coveralls.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
service_name: travis-ci
|