develapp-tardef 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/bin/tardef +17 -13
- data/lib/tardef/connector/base.rb +1 -6
- data/lib/tardef/connector/xml.rb +4 -2
- data/lib/tardef/version.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cddf9ca825967c199ebf4723feb255ceee7a4fd
|
4
|
+
data.tar.gz: e7fafc692f3c0c52b5ed2bd4b888b3b361811a03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47d61d20565d3daf785028b25cf72822ec331674d48ebfc64d424af151898bc99843def09de184a611276aa7a45826205526aba258f76704b82f4c375a31be59
|
7
|
+
data.tar.gz: 48a5f30d5492c6cc276ee4f6b2f09572cbc9c59b1b9e6136665640cb65aee1beffe6629bb2bf7e69217a52fb33561e17fa97602107873f93b259d2a1c0376d8d
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
About
|
2
2
|
====
|
3
3
|
TARDEF is a format for saving and exchanging data for tasks and related data - like lists and tags - in an easy format. By default, YAML and JSON are supported as file formats by TARDEF, but any format that supports the same kind of structures as YAML / JSON could be used.
|
4
4
|
|
@@ -13,6 +13,7 @@ The TARDEF repository contains a Ruby library that can be used for accessing the
|
|
13
13
|
|
14
14
|
The validator can be used by calling tardef_validate -f <file> -t <type>
|
15
15
|
|
16
|
+
An up-to-date documentation of the library can be found at http://rubydoc.info/github/DevelAppUG/tardef/master/frames.
|
16
17
|
File Format Description
|
17
18
|
===
|
18
19
|
Coming soon...
|
data/bin/tardef
CHANGED
@@ -38,6 +38,7 @@ def write_file(file, type, obj)
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def derive_type(file, type)
|
41
|
+
return "" if not file
|
41
42
|
if type == ""
|
42
43
|
if file.end_with?(".yaml")
|
43
44
|
type = "yaml"
|
@@ -63,17 +64,11 @@ ARGV.each_with_index do |arg, index|
|
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
66
|
-
if input_file == ""
|
67
|
-
puts "[ERROR] Input file must be given using -if <filename>"
|
68
|
-
exit
|
69
|
-
end
|
70
|
-
|
71
|
-
input_type = derive_type(input_file, input_type)
|
72
|
-
output_type = derive_type(output_file, output_type)
|
73
|
-
check_type(input_type)
|
74
|
-
|
75
67
|
begin
|
76
68
|
if command == "validate"
|
69
|
+
raise "Input file must be given using -if <filename>" if input_file == ""
|
70
|
+
input_type = derive_type(input_file, input_type)
|
71
|
+
check_type(input_type)
|
77
72
|
obj = read_file(input_file, input_type)
|
78
73
|
chain = Tardef::Validator::Chain.new
|
79
74
|
chain.add_validator(Tardef::Validator::Links.new)
|
@@ -88,14 +83,23 @@ begin
|
|
88
83
|
puts result
|
89
84
|
end
|
90
85
|
elsif command == "transform"
|
91
|
-
if
|
92
|
-
|
93
|
-
|
94
|
-
|
86
|
+
raise "Input file must be given using -if <filename>" if input_file == ""
|
87
|
+
raise "Output file must be given using -of <filename>" if output_file == ""
|
88
|
+
input_type = derive_type(input_file, input_type)
|
89
|
+
output_type = derive_type(output_file, output_type)
|
90
|
+
check_type(input_type)
|
95
91
|
check_type(output_type)
|
96
92
|
obj = read_file(input_file, input_type)
|
97
93
|
write_file(output_file, output_type, obj)
|
98
94
|
puts "[SUCCESS] File transformed"
|
95
|
+
elsif command == "new"
|
96
|
+
raise "Output file must be given using -of <filename>" if output_file == ""
|
97
|
+
output_type = derive_type(output_file, output_type)
|
98
|
+
check_type(output_type)
|
99
|
+
obj = Tardef::File.new(output_file, Tardef::VERSION, Time.now.iso8601(0))
|
100
|
+
obj.schema = Tardef::DEFAULT_SCHEMA
|
101
|
+
write_file(output_file, output_type, obj)
|
102
|
+
puts "[SUCCESS] File generated"
|
99
103
|
else
|
100
104
|
raise "Command #{command} missing"
|
101
105
|
end
|
@@ -1,13 +1,9 @@
|
|
1
1
|
module Tardef::Connector
|
2
2
|
class Base
|
3
3
|
@filename = ""
|
4
|
-
@can_read = true
|
5
|
-
@can_write = true
|
6
|
-
|
7
4
|
attr_accessor :filename
|
8
|
-
|
5
|
+
|
9
6
|
def read
|
10
|
-
raise "Connector is write-only" if not @can_write
|
11
7
|
hash = read_file
|
12
8
|
file = Tardef::File.new(nil, nil, nil)
|
13
9
|
file.load_hash(hash["meta"])
|
@@ -50,7 +46,6 @@ module Tardef::Connector
|
|
50
46
|
end
|
51
47
|
|
52
48
|
def write(file_object)
|
53
|
-
raise "Connector is read-only" if not @can_write
|
54
49
|
hash = file_object.to_hash
|
55
50
|
write_file(hash)
|
56
51
|
end
|
data/lib/tardef/connector/xml.rb
CHANGED
data/lib/tardef/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: develapp-tardef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timo Puschkasch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|