activefacts-compositions 1.9.22 → 1.9.23
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 +5 -5
- data/README.md +1 -1
- data/activefacts-compositions.gemspec +1 -1
- data/bin/schema_compositor +71 -27
- data/lib/activefacts/compositions/binary.rb +4 -0
- data/lib/activefacts/compositions/datavault.rb +4 -0
- data/lib/activefacts/compositions/relational.rb +4 -0
- data/lib/activefacts/compositions/staging.rb +4 -0
- data/lib/activefacts/compositions/version.rb +1 -1
- data/lib/activefacts/generator/doc/css/glossary-print.css +72 -0
- data/lib/activefacts/generator/doc/css/glossary.css +194 -0
- data/lib/activefacts/generator/doc/css/ldm.css +12 -17
- data/lib/activefacts/generator/doc/css/orm2-print.css +19 -0
- data/lib/activefacts/generator/doc/css/orm2.css +28 -0
- data/lib/activefacts/generator/doc/css/reset.css +18 -0
- data/lib/activefacts/generator/doc/css/treetable.css +83 -0
- data/lib/activefacts/generator/doc/cwm.rb +60 -54
- data/lib/activefacts/generator/doc/glossary.rb +261 -137
- data/lib/activefacts/generator/doc/graphviz.rb +6 -2
- data/lib/activefacts/generator/doc/ldm.rb +7 -3
- data/lib/activefacts/generator/etl/unidex.rb +7 -2
- data/lib/activefacts/generator/oo.rb +2 -1
- data/lib/activefacts/generator/population.rb +174 -0
- data/lib/activefacts/generator/rails/active_admin.rb +81 -0
- data/lib/activefacts/generator/rails/application_record_shell.rb +78 -0
- data/lib/activefacts/generator/rails/models.rb +31 -72
- data/lib/activefacts/generator/rails/ruby_folder_generator.rb +87 -0
- data/lib/activefacts/generator/rails/schema.rb +12 -4
- data/lib/activefacts/generator/ruby.rb +7 -3
- data/lib/activefacts/generator/sql.rb +2 -1
- data/lib/activefacts/generator/summary.rb +24 -19
- data/lib/activefacts/generator/traits/sql.rb +4 -0
- data/lib/activefacts/generator/transgen.rb +7 -1
- data/lib/activefacts/generator/validate.rb +10 -2
- metadata +15 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3e35af2337e08f47fa7bbd7fcf24b3f56872aca5941ef5e7613a214cdc0957e8
|
4
|
+
data.tar.gz: 1952c7f7199348bf3c6a41496edca9103b37379ed63a0d6ec34c6978f23b5fc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c15889850396034caa48eb039f858dddf8217101a6ef1e0049e6d17db628448c00353e5f518cd73cfca3448c1885cc9599629fb93091a88a6257c6e91827e726
|
7
|
+
data.tar.gz: ce9ec2671c7a4826d747c67c580bf9507561b7e1a3db98f30e06fb169a812225b7ffa554af2a2147db8430916572e486c4b1b73eb6f63003ab44df0e1aa32ca5
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ And then execute:
|
|
29
29
|
|
30
30
|
## Development
|
31
31
|
|
32
|
-
After checking out the repo, run `bundle` to install dependencies. Then, run `rake
|
32
|
+
After checking out the repo, run `bundle` to install dependencies. Then, run `rake spec` to run the tests.
|
33
33
|
|
34
34
|
To install this gem onto your local machine from local source code, run `rake install`.
|
35
35
|
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler", ">= 1.11"
|
23
|
-
spec.add_development_dependency "rake", "
|
23
|
+
spec.add_development_dependency "rake", ">= 10"
|
24
24
|
spec.add_development_dependency "rspec", "~> 3.3"
|
25
25
|
|
26
26
|
spec.add_runtime_dependency "activesupport", ">= 4.2.7"
|
data/bin/schema_compositor
CHANGED
@@ -22,9 +22,10 @@ class SchemaCompositor
|
|
22
22
|
|
23
23
|
# Parse options into a hash, and values for each option into a hash
|
24
24
|
def initialize argv
|
25
|
+
@argv = argv.dup
|
25
26
|
@options = {}
|
26
|
-
while argv[0] =~ /^-/
|
27
|
-
option, value = argv.shift.split(/[=:]/, 2)
|
27
|
+
while @argv[0] =~ /^-/
|
28
|
+
option, value = @argv.shift.split(/[=:]/, 2)
|
28
29
|
csv = (value =~ /,/ ? value.split(',') : Array(value))
|
29
30
|
modes = csv.inject({}){|h,s| k, v = s.split(/=/, 2); h[k] = v || true; h }
|
30
31
|
@options[option.sub(/^-*/,'')] = modes
|
@@ -40,13 +41,13 @@ class SchemaCompositor
|
|
40
41
|
begin
|
41
42
|
require(pathname = path+"/"+filename)
|
42
43
|
trace :loading, "Loaded #{pathname}"
|
43
|
-
|
44
|
+
filename
|
44
45
|
rescue LoadError => e
|
45
46
|
trace :loading, "Can't load #{pathname}: #{e.class}: #{e.message} #{e.backtrace[0]}"
|
46
|
-
|
47
|
+
nil
|
47
48
|
rescue Exception => e
|
48
49
|
$stderr.puts "Can't load #{pathname}: #{e.class}: #{e.message} #{e.backtrace[0]}"
|
49
|
-
|
50
|
+
nil
|
50
51
|
end
|
51
52
|
end.compact
|
52
53
|
end
|
@@ -65,16 +66,26 @@ class SchemaCompositor
|
|
65
66
|
option = compositor
|
66
67
|
end
|
67
68
|
|
68
|
-
|
69
|
+
# Is it a compositor?
|
70
|
+
action, helptext = ActiveFacts::Compositions.compositors[option]
|
71
|
+
if action
|
69
72
|
options.delete(option)
|
70
73
|
check_options(action, modes)
|
71
74
|
@compositors << [action, modes, option]
|
72
|
-
|
75
|
+
next
|
76
|
+
end
|
77
|
+
|
78
|
+
# Is it a generator?
|
79
|
+
action, helptext = ActiveFacts::Generators.generators[option]
|
80
|
+
if action
|
73
81
|
options.delete(option)
|
74
82
|
check_options(action, modes)
|
75
83
|
@generators << [action, modes, option]
|
76
|
-
|
77
|
-
|
84
|
+
next
|
85
|
+
end
|
86
|
+
|
87
|
+
if option == 'help'
|
88
|
+
# Finish, then help
|
78
89
|
else
|
79
90
|
$stderr.puts "Action --#{option} is not recognised"
|
80
91
|
exit 1
|
@@ -85,9 +96,9 @@ class SchemaCompositor
|
|
85
96
|
end
|
86
97
|
end
|
87
98
|
|
88
|
-
def process_files
|
99
|
+
def process_files
|
89
100
|
# Process each input file:
|
90
|
-
argv.each do |arg|
|
101
|
+
@argv.each do |arg|
|
91
102
|
filename, input_options = *arg.split(/=/, 2)
|
92
103
|
|
93
104
|
# Load the correct file type input method
|
@@ -119,20 +130,53 @@ class SchemaCompositor
|
|
119
130
|
end
|
120
131
|
exit 0 unless vocabulary
|
121
132
|
vocabulary.finalise unless vocabulary == true
|
133
|
+
constellation = vocabulary.constellation
|
122
134
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
compositor = compositor_klass.new(vocabulary.constellation, basename, modes)
|
130
|
-
compositor.generate
|
135
|
+
compositions =
|
136
|
+
@compositors.map do |compositor_klass, modes, option|
|
137
|
+
compositor = compositor_klass.new(constellation, basename, modes)
|
138
|
+
compositor.generate
|
139
|
+
[compositor_klass, compositor.composition]
|
140
|
+
end
|
131
141
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
142
|
+
begin
|
143
|
+
# Run each generator
|
144
|
+
@generators.each do |generator_klass, modes|
|
145
|
+
arity, composition_types = generator_klass.compatibility
|
146
|
+
type_list = composition_types ? composition_types.map(&:to_s)*' or ' : nil
|
147
|
+
compatible_compositions =
|
148
|
+
compositions.
|
149
|
+
select{|k, c| composition_types ? (composition_types&k.compatibility).size > 0 : true}
|
150
|
+
|
151
|
+
if arity == 0
|
152
|
+
# No composition is required
|
153
|
+
output = generator_klass.new(constellation, compositions.map{|k,c| c}, modes).generate
|
154
|
+
puts output if output
|
155
|
+
elsif arity == 1
|
156
|
+
# This generator processes each composition in turn
|
157
|
+
if compatible_compositions.size == 0
|
158
|
+
raise "#{generator_klass.basename} expects a #{type_list} compositor; use --help for a list"
|
159
|
+
end
|
160
|
+
compatible_compositions.
|
161
|
+
each do |k, c|
|
162
|
+
output = generator_klass.new(constellation, c, modes).generate
|
163
|
+
puts output if output
|
164
|
+
end
|
165
|
+
else
|
166
|
+
# This generator either accepts "arity" compositions or any number
|
167
|
+
if arity && compositions.size != arity
|
168
|
+
raise "#{generator_klass.basename} expects #{arity} #{type_list} compositions; use --help for a list"
|
169
|
+
end
|
170
|
+
# Pass all compositions:
|
171
|
+
output = generator_klass.new(constellation, compositions.map{|k,c| c}, modes).generate
|
172
|
+
puts output if output
|
173
|
+
end
|
174
|
+
end
|
175
|
+
rescue => e
|
176
|
+
$stderr.puts "#{e.message}"
|
177
|
+
if trace :exception
|
178
|
+
$stderr.puts "\t#{e.backtrace*"\n\t"}"
|
179
|
+
end
|
136
180
|
end
|
137
181
|
end
|
138
182
|
end
|
@@ -159,13 +203,13 @@ class SchemaCompositor
|
|
159
203
|
' num'
|
160
204
|
when Pathname
|
161
205
|
' file'
|
162
|
-
|
163
|
-
|
206
|
+
when Array
|
207
|
+
" { #{type.map(&:to_s)*' | '} }"
|
164
208
|
else
|
165
209
|
' str'
|
166
210
|
end
|
167
211
|
|
168
|
-
|
212
|
+
spaces = (s = 24-tag.size) < 2 ? 2 : s
|
169
213
|
stream.puts "\t#{tag}#{' '*spaces}#{description}"
|
170
214
|
end
|
171
215
|
end
|
@@ -203,4 +247,4 @@ if sc.options['help'] || (sc.generators.empty? && sc.compositors.empty?)
|
|
203
247
|
exit
|
204
248
|
end
|
205
249
|
|
206
|
-
sc.process_files
|
250
|
+
sc.process_files
|
@@ -0,0 +1,72 @@
|
|
1
|
+
.glossary-toc {
|
2
|
+
display: none;
|
3
|
+
}
|
4
|
+
|
5
|
+
.glossary-doc h1 {
|
6
|
+
margin-bottom: 1em;
|
7
|
+
}
|
8
|
+
|
9
|
+
.glossary-doc dt,
|
10
|
+
.glossary-facttype > .glossary-reading,
|
11
|
+
.glossary-objectification {
|
12
|
+
margin-left: 20px;
|
13
|
+
text-indent: -20px;
|
14
|
+
}
|
15
|
+
|
16
|
+
.glossary-alternates {
|
17
|
+
font-size: smaller;
|
18
|
+
text-indent: -10px;
|
19
|
+
padding-left: 10px;
|
20
|
+
}
|
21
|
+
|
22
|
+
.glossary-doc dd .glossary-constraints {
|
23
|
+
margin-left: -40px; /* Extend the highlight further left */
|
24
|
+
text-indent: 40px;
|
25
|
+
}
|
26
|
+
|
27
|
+
.glossary-alternates .glossary-reading,
|
28
|
+
.glossary-objectification .glossary-reading {
|
29
|
+
display: inline;
|
30
|
+
}
|
31
|
+
|
32
|
+
.screenheight {
|
33
|
+
margin-bottom: 0px;
|
34
|
+
}
|
35
|
+
|
36
|
+
.glossary-controls {
|
37
|
+
display:none;
|
38
|
+
}
|
39
|
+
|
40
|
+
.glossary-doc dd {
|
41
|
+
margin-bottom: 30px;
|
42
|
+
max-height: auto;
|
43
|
+
margin-left: 40px; /* Indent it from the head term */
|
44
|
+
}
|
45
|
+
|
46
|
+
.glossary-constraints {
|
47
|
+
/* a block of constraints */
|
48
|
+
margin: 0px 0px 0px 2em;
|
49
|
+
padding: 0px;
|
50
|
+
}
|
51
|
+
|
52
|
+
.glossary-constraint {
|
53
|
+
text-indent: 2em;
|
54
|
+
font-size: smaller;
|
55
|
+
}
|
56
|
+
|
57
|
+
.glossary-alternates {
|
58
|
+
font-size: smaller;
|
59
|
+
}
|
60
|
+
|
61
|
+
.glossary-constraint .constraint {
|
62
|
+
font-style: italic;
|
63
|
+
}
|
64
|
+
|
65
|
+
.glossary-doc dd .glossary-constraints {
|
66
|
+
margin-left: 0px;
|
67
|
+
text-indent: 0px;
|
68
|
+
}
|
69
|
+
|
70
|
+
a {
|
71
|
+
text-decoration: none;
|
72
|
+
}
|
@@ -0,0 +1,194 @@
|
|
1
|
+
body {
|
2
|
+
margin: 0px;
|
3
|
+
padding: 0px;
|
4
|
+
}
|
5
|
+
|
6
|
+
/* Size of sections when dynamically hidden by controls (incl with a transition) */
|
7
|
+
.glossary-doc.hide-facts dd { max-height: 0px; margin-bottom: 0px; }
|
8
|
+
.glossary-doc.hide-alternates .glossary-alternates { max-height: 0px; }
|
9
|
+
.glossary-doc.hide-constraints .glossary-constraints { max-height: 0px; }
|
10
|
+
.glossary-doc.hide-examples .glossary-example { max-height: 0px; }
|
11
|
+
|
12
|
+
.glossary {
|
13
|
+
position: relative;
|
14
|
+
height: 100%;
|
15
|
+
font-family: "Helvetica Neue", Helvetica, "Arial Unicode MS", Arial, sans-serif;
|
16
|
+
}
|
17
|
+
|
18
|
+
.glossary-compositions {
|
19
|
+
position: absolute;
|
20
|
+
left: 0px; right: 456px; /* as main item with glossary on right */
|
21
|
+
margin-right: 0px;
|
22
|
+
overflow: auto;
|
23
|
+
height: 100%;
|
24
|
+
}
|
25
|
+
|
26
|
+
.glossary-doc {
|
27
|
+
position: absolute;
|
28
|
+
display: block;
|
29
|
+
background: #FFF;
|
30
|
+
overflow: auto;
|
31
|
+
top: 0px;
|
32
|
+
bottom: 0px;
|
33
|
+
}
|
34
|
+
|
35
|
+
.glossary-doc > * {
|
36
|
+
padding-left: 20px;
|
37
|
+
}
|
38
|
+
|
39
|
+
.glossary-doc.glossary-toc-right {
|
40
|
+
/* Table of contents at right */
|
41
|
+
left: 0px; right: 450px;
|
42
|
+
border-right: solid #EEE 3px;
|
43
|
+
}
|
44
|
+
|
45
|
+
.glossary-doc.glossary-toc-left {
|
46
|
+
/* Table of contents at right */
|
47
|
+
left: 450px; right: 0px;
|
48
|
+
}
|
49
|
+
|
50
|
+
.glossary-controls
|
51
|
+
{
|
52
|
+
/* the glossary is the table of contents for something else */
|
53
|
+
width: 450px; right: 0px;
|
54
|
+
border-left: solid #DDD 3px;
|
55
|
+
border-right: solid #DDD 3px; /* To here */
|
56
|
+
}
|
57
|
+
|
58
|
+
.glossary-doc.glossary-is-toc
|
59
|
+
{
|
60
|
+
/* the glossary is the table of contents for something else */
|
61
|
+
width: 450px; right: 0px;
|
62
|
+
border-left: solid #DDD 3px;
|
63
|
+
border-right: solid #DDD 3px; /* To here */
|
64
|
+
bottom: 25px; /* Leave room for the controls */
|
65
|
+
}
|
66
|
+
|
67
|
+
.glossary-toc {
|
68
|
+
position: absolute;
|
69
|
+
display: block;
|
70
|
+
height: 100%;
|
71
|
+
margin: 0;
|
72
|
+
border-left: solid #DDD 3px;
|
73
|
+
border-right: solid #DDD 3px;
|
74
|
+
background: #EEE;
|
75
|
+
font-family: "Helvetica Neue", Helvetica, "Arial Unicode MS", Arial, sans-serif;
|
76
|
+
}
|
77
|
+
|
78
|
+
.glossary-toc.glossary-toc-right {
|
79
|
+
right: 0px; width: 450px; /* Sidebar at right */
|
80
|
+
}
|
81
|
+
|
82
|
+
.glossary-toc.glossary-toc-left {
|
83
|
+
left: 0px; width: 450px; /* Sidebar at left */
|
84
|
+
}
|
85
|
+
|
86
|
+
.glossary-toc.glossary-is-toc {
|
87
|
+
right: 0px; width: 0px; /* Hidden */
|
88
|
+
}
|
89
|
+
|
90
|
+
.glossary-toc-list {
|
91
|
+
position: absolute;
|
92
|
+
top: 0px;
|
93
|
+
bottom: 24px;
|
94
|
+
width: 100%;
|
95
|
+
overflow: auto;
|
96
|
+
margin: 0;
|
97
|
+
padding: 0 0;
|
98
|
+
list-style: none;
|
99
|
+
}
|
100
|
+
|
101
|
+
.glossary-controls {
|
102
|
+
position: absolute; bottom: 0px;
|
103
|
+
border: solid #DDD 3px;
|
104
|
+
background: #DDD;
|
105
|
+
}
|
106
|
+
|
107
|
+
.glossary-controls > * {
|
108
|
+
width: 24%;
|
109
|
+
padding: 0px;
|
110
|
+
}
|
111
|
+
|
112
|
+
.glossary-toc-list li {
|
113
|
+
padding: 0px 1em 0px 1em;
|
114
|
+
}
|
115
|
+
|
116
|
+
.glossary-toc-list li:hover {
|
117
|
+
background: #DDD;
|
118
|
+
}
|
119
|
+
|
120
|
+
.glossary-doc dl,
|
121
|
+
.screenheight {
|
122
|
+
margin-bottom: 2400px; /* ensure we can scroll any item to the top of the screen */
|
123
|
+
}
|
124
|
+
|
125
|
+
/* Hover controls: comment out to leave it under toggle button control */
|
126
|
+
.glossary-doc dt:hover + dd, /* When hovering over the head, show the contents */
|
127
|
+
.glossary-doc dd:hover, /* Keep showing the contents when we slide into it */
|
128
|
+
/* .glossary-doc dt:hover + dd .glossary-alternates, /* Show the alternates when you hover over the head */
|
129
|
+
/* .glossary-doc dt:hover + dd .glossary-constraints, /* Show the constraints when you hover over the head */
|
130
|
+
.glossary-doc dt:hover + dd .glossary-example, /* Show the examples when hovering over the head */
|
131
|
+
.glossary-doc dd:hover .glossary-example /* Keep showing the examples when we slide into the body */
|
132
|
+
{ max-height: 2000px;
|
133
|
+
XXmargin-bottom: 30px; /* ease-out works both ways if animating this :( */
|
134
|
+
background: #DDD;
|
135
|
+
}
|
136
|
+
|
137
|
+
/* After the hover moves away, wait a while before hiding */
|
138
|
+
.glossary-doc dd {
|
139
|
+
transition: max-height 1s;
|
140
|
+
transition-timing-function: ease-out;
|
141
|
+
overflow: hidden;
|
142
|
+
max-height: 2000px; /* Animate this to zero to hide */
|
143
|
+
margin-bottom: 30px; /* Some clearance from the next term */
|
144
|
+
margin-left: 40px; /* Indent it from the head term */
|
145
|
+
}
|
146
|
+
|
147
|
+
.glossary-doc dd > * {
|
148
|
+
font-size: smaller;
|
149
|
+
}
|
150
|
+
|
151
|
+
.glossary-doc dt,
|
152
|
+
.glossary-facttype > .glossary-reading,
|
153
|
+
.glossary-objectification {
|
154
|
+
margin-left: 20px;
|
155
|
+
text-indent: -20px;
|
156
|
+
}
|
157
|
+
|
158
|
+
.glossary-alternates .glossary-reading,
|
159
|
+
.glossary-objectification .glossary-reading
|
160
|
+
{
|
161
|
+
display: inline;
|
162
|
+
}
|
163
|
+
|
164
|
+
.glossary-alternates {
|
165
|
+
font-size: smaller;
|
166
|
+
overflow: hidden;
|
167
|
+
text-indent: -10px;
|
168
|
+
padding-left: 10px;
|
169
|
+
}
|
170
|
+
|
171
|
+
.glossary-example {
|
172
|
+
overflow: hidden;
|
173
|
+
}
|
174
|
+
|
175
|
+
.glossary-doc dd .glossary-constraints {
|
176
|
+
margin-left: -40px; /* Extend the highlight further left */
|
177
|
+
text-indent: 40px;
|
178
|
+
}
|
179
|
+
|
180
|
+
.glossary-constraints {
|
181
|
+
/* a block of constraints */
|
182
|
+
background: #EDC;
|
183
|
+
padding: 0px;
|
184
|
+
overflow: hidden;
|
185
|
+
}
|
186
|
+
.glossary-constraint {
|
187
|
+
margin-left: 70px; /* 30 added to the 40 from above */
|
188
|
+
text-indent: -10px; /* Ensure that wrap is indented */
|
189
|
+
font-size: smaller;
|
190
|
+
}
|
191
|
+
.glossary-constraint .keyword {
|
192
|
+
background: #EDC;
|
193
|
+
font-style: italic;
|
194
|
+
}
|