mixItRuby 0.0.0 → 0.0.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/lib/mixer.rb +1 -1
- data/mixItRuby.gemspec +2 -2
- data/readme.md +36 -33
- metadata +3 -3
data/lib/mixer.rb
CHANGED
data/mixItRuby.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'mixItRuby'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.date = '2015-01-08'
|
5
5
|
s.summary = "MixItRuby! mixes json in erb + CLI"
|
6
6
|
s.description = "A gem for mixing a nested json structure in erb files"
|
7
7
|
s.authors = ["Erhard Karger"]
|
data/readme.md
CHANGED
@@ -1,56 +1,58 @@
|
|
1
|
-
|
1
|
+
mixItRuby
|
2
2
|
===
|
3
3
|
|
4
|
-
What is
|
4
|
+
What is mixItRuby ?
|
5
5
|
-------------
|
6
|
-
|
6
|
+
MixItRuby is a gem for mixing data (in form of a nested Hash) with templatefiles.
|
7
7
|
|
8
8
|
Example Use Case
|
9
9
|
----------------
|
10
10
|
You have to print bills for a list of items/products.
|
11
11
|
What you do :
|
12
|
-
|
13
|
-
Run
|
14
|
-
|
12
|
+
Transform the data to a hash which lasts a specific form
|
13
|
+
Run mixit with an erb template. The output is (depending on the template)
|
14
|
+
ready to be formatted in latex of whatever.
|
15
15
|
|
16
|
-
But whatever......
|
17
16
|
|
17
|
+
Install
|
18
|
+
-------
|
19
|
+
gem install mixItRuby
|
18
20
|
|
21
|
+
run (from commandline)
|
22
|
+
-----------------------
|
23
|
+
mixit -i inputfile < -t templateDir -o outputfile >
|
19
24
|
|
20
|
-
Install
|
21
|
-
-------
|
22
|
-
gem mix
|
23
25
|
|
24
|
-
run
|
25
|
-
|
26
|
-
|
26
|
+
run withing a programm
|
27
|
+
----------------------
|
28
|
+
|
29
|
+
require "mixer"
|
30
|
+
mixer = MIX::Mixer.new
|
31
|
+
mixer.mixItRuby(inputdata_hash)
|
32
|
+
mixer.writeResult2File(outputfile)
|
27
33
|
|
28
34
|
|
29
|
-
|
30
|
-
|
35
|
+
current project status
|
36
|
+
----------------------
|
37
|
+
Work in progress just started
|
31
38
|
|
32
39
|
|
33
|
-
|
34
|
-
|
35
|
-
|
40
|
+
You want to contributes ?
|
41
|
+
==========================
|
42
|
+
Contact erhard@kargers.org
|
36
43
|
|
37
44
|
|
38
|
-
You want to contributes ?
|
39
|
-
==========================
|
40
|
-
Contact erhard@kargers.org
|
41
45
|
|
42
46
|
|
47
|
+
Structure of the data
|
48
|
+
=====================
|
43
49
|
|
44
|
-
|
45
|
-
Structure of the data
|
46
|
-
=====================
|
47
|
-
|
48
|
-
json Format recursive, selfcontained.
|
50
|
+
json, recursive, selfcontained.
|
49
51
|
|
50
52
|
recursive : substructures possible (nodes)
|
51
|
-
|
53
|
+
selfcontained : The name of the erb (id, for DB or File or whatever) is within the data
|
52
54
|
|
53
|
-
|
55
|
+
Here an example:
|
54
56
|
|
55
57
|
{"id":"adress.erb","name":"Bond","prename":"James",
|
56
58
|
"items":
|
@@ -60,11 +62,11 @@ recursive : substructures possible (nodes)
|
|
60
62
|
]
|
61
63
|
}
|
62
64
|
|
63
|
-
A building block consists of an id and other key value
|
65
|
+
A building block consists of an id and other key value pairs.
|
64
66
|
|
65
|
-
id: is a must. It represents the
|
67
|
+
id: is a must. It represents the identifier under which the template is accesible.
|
66
68
|
At the moment it is a filename. The other attributes on the same level, which are no array or hash are
|
67
|
-
the key value
|
69
|
+
the key value pairs which fill the erb.
|
68
70
|
The adress.erb looks like this
|
69
71
|
<%=name%>, <%=prename%>
|
70
72
|
Then an array follow. An Array must be build of hashes, which can have subarrays or like in the example building blocks again.
|
@@ -72,13 +74,14 @@ Then an array follow. An Array must be build of hashes, which can have subarrays
|
|
72
74
|
|
73
75
|
What is mixItRuby needed for ?
|
74
76
|
==============================
|
75
|
-
With that little gem you can build up personalized letters or emails or html pages.
|
77
|
+
With that little gem you can build up personalized letters or emails or html pages, with nested data.
|
76
78
|
Just imagine the erb file are tex files or xml-fo or html files or they are files with are ruby file again, which produce some output.
|
77
79
|
|
78
80
|
Another possibility is create other json files. Imagine the template erbs are templates for json. Then for example in SOA business objects can be chained and enriched from services.
|
79
81
|
|
80
82
|
There are a lot of posibilities.
|
81
|
-
|
83
|
+
Post some it would be nice to hear what is possible.
|
84
|
+
|
82
85
|
|
83
86
|
|
84
87
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixItRuby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A gem for mixing a nested json structure in erb files
|
15
15
|
email: erhard@kargers.org
|
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
58
|
version: '0'
|
59
59
|
requirements: []
|
60
60
|
rubyforge_project:
|
61
|
-
rubygems_version: 1.8.
|
61
|
+
rubygems_version: 1.8.23.2
|
62
62
|
signing_key:
|
63
63
|
specification_version: 3
|
64
64
|
summary: MixItRuby! mixes json in erb + CLI
|