maml 0.1.5 → 0.2.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.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/bin/maml +1 -1
- data/lib/maml/maml.rb +30 -2
- data/lib/maml/maml.yml +80 -0
- data/maml.gemspec +2 -3
- data/maml.yml +1 -1
- metadata +2 -3
- data/maml-0.1.1.gem +0 -0
- data/maml-0.1.2.gem +0 -0
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/bin/maml
CHANGED
data/lib/maml/maml.rb
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
# todo:
|
10
10
|
require "yaml"
|
11
11
|
require "logger"
|
12
|
+
require "ftools"
|
12
13
|
|
13
14
|
# mechanism to get current method name..don't really need for current implementation..was for writing handlers that could write their own name
|
14
15
|
module CurrentMethodName
|
@@ -37,6 +38,12 @@ module Maml
|
|
37
38
|
def test
|
38
39
|
string_arg
|
39
40
|
end
|
41
|
+
|
42
|
+
def create_sample
|
43
|
+
pwd=Dir.pwd
|
44
|
+
sample= File.join File.dirname(__FILE__), "maml.yml"
|
45
|
+
File.copy sample, pwd, true
|
46
|
+
end
|
40
47
|
|
41
48
|
def extract_arg maml_field
|
42
49
|
maml_arg=nil
|
@@ -159,6 +166,7 @@ module Maml
|
|
159
166
|
puts "use ---haml or similar for adding extra commands. -<anything> is passed to the command-line minus the -"
|
160
167
|
puts "maml supports one file at time"
|
161
168
|
puts "generated files are in <rails_root>/maml"
|
169
|
+
puts "Run 'maml.rb create_sample' to generate a sample maml.yml file for a starting point. Note: this will overwrite any existing maml.yml."
|
162
170
|
puts "\nSpecify field type by symbol prefix as follows:"
|
163
171
|
puts "no prefix=string ; no prefix and _id suffix = integer ; override _id by adding prefix"
|
164
172
|
puts "examples: string, integer_id, .integer, ..float, %date, %%datetime, @time, @@timestamp, :string, ::text, =boolean, &binary"
|
@@ -173,6 +181,23 @@ module Maml
|
|
173
181
|
file="maml.yml" unless file
|
174
182
|
generate_command="model" unless generate_command
|
175
183
|
puts "generate_command=#{generate_command}, file=#{file}"
|
184
|
+
|
185
|
+
# allow copy_sample via file (e.g. maml.rb copy_sample) or via command (e.g. maml.rb -copy_sample)
|
186
|
+
case file
|
187
|
+
when "create_sample"
|
188
|
+
create_sample
|
189
|
+
exit
|
190
|
+
else
|
191
|
+
# continue on
|
192
|
+
end
|
193
|
+
|
194
|
+
case generate_command
|
195
|
+
when "create_sample"
|
196
|
+
create_sample
|
197
|
+
exit
|
198
|
+
else
|
199
|
+
# continue on
|
200
|
+
end
|
176
201
|
|
177
202
|
maml=nil
|
178
203
|
begin
|
@@ -234,14 +259,17 @@ module Maml
|
|
234
259
|
|
235
260
|
puts "\n\nDONE! Look at maml.log for script results, and in app/models, db/migrations, test/fixtures and test/unit for generated code (if you ran maml.rb with a command line arg)"
|
236
261
|
unless ARGV[0]
|
237
|
-
puts "\n\nUse 'maml.rb maml.yml' (or other file arg) to actuallly run generators. Running with default maml.yml does
|
262
|
+
puts "\n\nUse 'maml.rb maml.yml' (or other file arg) to actuallly run generators. Running with default maml.yml does trial run only."
|
238
263
|
end
|
264
|
+
ensure
|
265
|
+
puts "Thanks for being a Lazy MAML!"
|
266
|
+
return 0
|
239
267
|
end
|
240
268
|
end
|
241
269
|
|
242
270
|
# only run main if run standalone (e.g. not via ruby require)
|
243
271
|
if __FILE__ == $0
|
244
|
-
|
272
|
+
puts "***** #{File.basename($0)} ran from file *****"
|
245
273
|
|
246
274
|
Maml.main
|
247
275
|
end
|
data/lib/maml/maml.yml
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# maml- migration apathy markup lanaguage
|
2
|
+
# integer, float, date, datetime, timestamp, time, text, string, binary, boolean
|
3
|
+
#
|
4
|
+
# specify field type by symbol prefix as follows
|
5
|
+
# default type is string, except where field has _id suffice- then it's integer (override by adding prefix as shown below)
|
6
|
+
# .integer, ..float, %date, %%datetime, @time, @@timestamp, :string, ::text, =boolean, &binary
|
7
|
+
#
|
8
|
+
# level 1: module, level 2: class, level 3: field
|
9
|
+
# maml.yml is a sample file for a starting point. maml sample copies it to current directory.
|
10
|
+
innerplate:
|
11
|
+
Plate:
|
12
|
+
- day_id # any _id defaults to integer
|
13
|
+
- meal_id 50 true
|
14
|
+
- notes
|
15
|
+
- status
|
16
|
+
- completeness
|
17
|
+
- .calories
|
18
|
+
- title
|
19
|
+
|
20
|
+
Plate_Item:
|
21
|
+
- plate_id
|
22
|
+
- item_id
|
23
|
+
- uofm_id
|
24
|
+
- .units
|
25
|
+
- .calories
|
26
|
+
- notes
|
27
|
+
|
28
|
+
Conversion:
|
29
|
+
- item_id
|
30
|
+
- base_uofm_id
|
31
|
+
- uofm_id
|
32
|
+
- ratio
|
33
|
+
|
34
|
+
UnitOfMeasure:
|
35
|
+
- name
|
36
|
+
- system
|
37
|
+
- .related_measures
|
38
|
+
- ..ratio
|
39
|
+
- =is_base
|
40
|
+
|
41
|
+
Meal:
|
42
|
+
- name
|
43
|
+
- .proportion
|
44
|
+
- type %w[Meal Snack]
|
45
|
+
|
46
|
+
# loaded as my test case...
|
47
|
+
# Commitment:
|
48
|
+
# - %start_date
|
49
|
+
# - %end_date
|
50
|
+
# - ..goal_weight
|
51
|
+
# - ..start_weight
|
52
|
+
# - ..end_weight
|
53
|
+
# - ..current_weight
|
54
|
+
# - .stable_daily_calories
|
55
|
+
# - .goal_daily_calories
|
56
|
+
# - .calorie_margin
|
57
|
+
|
58
|
+
Item:
|
59
|
+
- =in_library
|
60
|
+
- =is_abstract
|
61
|
+
- .level
|
62
|
+
- name
|
63
|
+
- description
|
64
|
+
- category_id
|
65
|
+
- .calories
|
66
|
+
- uofm_id
|
67
|
+
- information_source
|
68
|
+
- accuracy %w[Draft Good Certain]
|
69
|
+
- category %w[Grains Protein Dairy Fruit Vegetables]
|
70
|
+
|
71
|
+
Day:
|
72
|
+
- %date
|
73
|
+
- plan
|
74
|
+
- .goal_calories
|
75
|
+
- .meals_expected
|
76
|
+
- .meals_completed
|
77
|
+
- .current_calories
|
78
|
+
- =is_complete
|
79
|
+
- summary
|
80
|
+
|
data/maml.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{maml}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nick Van Weerdenburg"]
|
@@ -30,8 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"init.rb",
|
31
31
|
"lib/maml.rb",
|
32
32
|
"lib/maml/maml.rb",
|
33
|
-
"maml
|
34
|
-
"maml-0.1.2.gem",
|
33
|
+
"lib/maml/maml.yml",
|
35
34
|
"maml.gemspec",
|
36
35
|
"maml.yml",
|
37
36
|
"maml_spec.txt"
|
data/maml.yml
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# .integer, ..float, %date, %%datetime, @time, @@timestamp, :string, ::text, =boolean, &binary
|
7
7
|
#
|
8
8
|
# level 1: module, level 2: class, level 3: field
|
9
|
-
|
9
|
+
# maml.yml is a sample file for a starting point. maml sample copies it to current directory.
|
10
10
|
innerplate:
|
11
11
|
Plate:
|
12
12
|
- day_id # any _id defaults to integer
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Van Weerdenburg
|
@@ -34,8 +34,7 @@ files:
|
|
34
34
|
- init.rb
|
35
35
|
- lib/maml.rb
|
36
36
|
- lib/maml/maml.rb
|
37
|
-
- maml
|
38
|
-
- maml-0.1.2.gem
|
37
|
+
- lib/maml/maml.yml
|
39
38
|
- maml.gemspec
|
40
39
|
- maml.yml
|
41
40
|
- maml_spec.txt
|
data/maml-0.1.1.gem
DELETED
Binary file
|
data/maml-0.1.2.gem
DELETED
Binary file
|