xamplr-gen 1.9.4 → 1.9.5
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 -1
- data/VERSION +1 -1
- data/lib/xamplr-gen/xampl-cl-gen.rb +68 -61
- data/lib/xamplr-gen/xampl-generator.rb +24 -5
- data/xamplr-gen.gemspec +5 -5
- metadata +3 -3
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ begin
|
|
13
13
|
gem.add_development_dependency "cucumber", ">= 0"
|
14
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
15
|
|
16
|
-
gem.add_dependency('xamplr', '>=1.9.
|
16
|
+
gem.add_dependency('xamplr', '>=1.9.3')
|
17
17
|
end
|
18
18
|
Jeweler::GemcutterTasks.new
|
19
19
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.5
|
@@ -98,7 +98,7 @@ _EOF_
|
|
98
98
|
mappings << [ ns, module_name, "ns#{ count }" ]
|
99
99
|
end
|
100
100
|
|
101
|
-
text = @@specialisation_file_content.gsub(/{{MAPPING}}/) do
|
101
|
+
text = @@specialisation_file_content.gsub(/{{MAPPING}}/) do
|
102
102
|
insert = []
|
103
103
|
mappings.each do | ns, module_name, prefix |
|
104
104
|
insert << " ['#{ ns }', '#{ module_name }', '#{ prefix }'],"
|
@@ -132,9 +132,12 @@ _EOF_
|
|
132
132
|
# Xampl.set_default_persister_format(:xml_format)
|
133
133
|
|
134
134
|
dirname = self.directory
|
135
|
+
|
136
|
+
=begin
|
137
|
+
|
135
138
|
if File.directory? dirname then
|
136
139
|
begin
|
137
|
-
|
140
|
+
FileUtils.rm_rf([ dirname ])
|
138
141
|
rescue => e
|
139
142
|
puts "could not clean up #{ dirname } -- #{ e }"
|
140
143
|
return
|
@@ -144,6 +147,8 @@ _EOF_
|
|
144
147
|
return
|
145
148
|
end
|
146
149
|
|
150
|
+
=end
|
151
|
+
|
147
152
|
Xampl.transaction("project-generation") do
|
148
153
|
|
149
154
|
options = Options.new do | opts |
|
@@ -162,80 +167,82 @@ _EOF_
|
|
162
167
|
end
|
163
168
|
|
164
169
|
generator = Generator.new('generator')
|
165
|
-
generator.go(:options => options,
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
170
|
+
okay = generator.go(:options => options,
|
171
|
+
:filenames => filenames,
|
172
|
+
:directory => directory)
|
173
|
+
|
174
|
+
if okay
|
175
|
+
puts generator.print_elements(print_base_filename, print_options)
|
176
|
+
self.write_specialisation_file(generator.elements_map)
|
177
|
+
|
178
|
+
generated_files = Dir.glob("#{ self.directory }/*.rb")
|
179
|
+
if 0 < generated_files.size then
|
180
|
+
all = []
|
181
|
+
#abs = []
|
182
|
+
generated_files.each do | filename |
|
183
|
+
all << "require \"\#\{ File.dirname __FILE__ \}/#{ File.basename(filename, '.rb') }\""
|
184
|
+
#all << "require '#{ File.dirname(filename)[2..-1] }/#{ File.basename(filename, '.rb') }'"
|
185
|
+
#abs_filename = File.expand_path(filename)
|
186
|
+
#abs << "require '#{ File.dirname(abs_filename) }/#{ File.basename(abs_filename, '.rb') }'"
|
187
|
+
end
|
182
188
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
189
|
+
out_filename = "#{ self.directory }/all.rb"
|
190
|
+
File.open(out_filename, 'w') do | out |
|
191
|
+
out.puts all.join("\n")
|
192
|
+
end
|
193
|
+
puts "WRITE TO FILE: #{ out_filename }"
|
194
|
+
|
195
|
+
#out_filename = "#{ self.directory }/all-absolute.rb"
|
196
|
+
#File.open(out_filename, 'w') do | out |
|
197
|
+
# out.puts abs.join("\n")
|
198
|
+
#end
|
199
|
+
#puts "WRITE TO FILE: #{ out_filename }"
|
200
|
+
|
201
|
+
if File.exists?('./generated.yuml') && (cl_options[:download_yuml_png] || cl_options[:download_yuml_pdf]) then
|
202
|
+
diagram = ""
|
203
|
+
File.open("./generated.yuml") do | f |
|
204
|
+
f.each do | line |
|
199
205
|
diagram << line.chomp
|
206
|
+
end
|
200
207
|
end
|
201
|
-
end
|
202
208
|
|
203
209
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
210
|
+
okay = false
|
211
|
+
if cl_options[:download_yuml_png] then
|
212
|
+
begin
|
213
|
+
filename = (true == cl_options[:download_yuml_png]) ? 'generated.png' : cl_options[:download_yuml_png]
|
214
|
+
wget = "wget 'http://yuml.me/diagram/scruffy/class/#{diagram}' -O '#{filename}'"
|
215
|
+
okay = system(wget)
|
216
|
+
if okay then
|
217
|
+
puts "downloaded yuml png"
|
218
|
+
else
|
219
|
+
puts "could not get the yuml png file -- #{ $? }"
|
220
|
+
end
|
221
|
+
rescue => e
|
222
|
+
puts "could not get the yuml png file -- #{ e }"
|
214
223
|
end
|
215
|
-
rescue => e
|
216
|
-
puts "could not get the yuml png file -- #{ e }"
|
217
224
|
end
|
218
|
-
end
|
219
225
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
puts "downloaded yuml pdf"
|
226
|
-
if okay then
|
226
|
+
if cl_options[:download_yuml_pdf] then
|
227
|
+
begin
|
228
|
+
filename = (true == cl_options[:download_yuml_png]) ? 'generated.png' : cl_options[:download_yuml_png]
|
229
|
+
wget = "wget 'http://yuml.me/diagram/scruffy/class/#{diagram}.pdf' -O '#{filename}'"
|
230
|
+
okay = system(wget)
|
227
231
|
puts "downloaded yuml pdf"
|
228
|
-
|
229
|
-
|
232
|
+
if okay then
|
233
|
+
puts "downloaded yuml pdf"
|
234
|
+
else
|
235
|
+
puts "could not get the yuml pdf file -- #{ $? }"
|
236
|
+
end
|
237
|
+
rescue => e
|
238
|
+
puts "could not get the yuml pdf file -- #{ e }"
|
230
239
|
end
|
231
|
-
rescue => e
|
232
|
-
puts "could not get the yuml pdf file -- #{ e }"
|
233
240
|
end
|
234
241
|
end
|
235
242
|
end
|
236
243
|
end
|
237
|
-
|
238
244
|
Xampl.rollback
|
245
|
+
|
239
246
|
end
|
240
247
|
end
|
241
248
|
end
|
@@ -211,10 +211,6 @@ module XamplGenerator
|
|
211
211
|
end
|
212
212
|
|
213
213
|
def generate(directory_name, params={:verbose => false}, &eval_context)
|
214
|
-
if directory_name then
|
215
|
-
FileUtils.mkdir_p(directory_name) unless File.exist?(directory_name)
|
216
|
-
end
|
217
|
-
|
218
214
|
ensure_templates
|
219
215
|
|
220
216
|
module_names = Set.new
|
@@ -244,13 +240,35 @@ module XamplGenerator
|
|
244
240
|
if element.class_name == element.package then
|
245
241
|
puts "ERROR: Class #{ element.package } is in a module with the same name -- this NOT going to work"
|
246
242
|
elsif module_names.member?(element.class_name)
|
247
|
-
puts "WARNING: a Class and a Module have the same name (#{ element.package }) -- this is highly unlikely to work"
|
243
|
+
puts "WARNING: a Class and a Module have the same name (#{ element.package } or maybe #{ element.class_name }) -- this is highly unlikely to work"
|
248
244
|
end
|
249
245
|
|
250
246
|
@templates.child_modules(place)
|
251
247
|
end
|
252
248
|
end
|
253
249
|
|
250
|
+
unless @generated_package_map then
|
251
|
+
puts "Nothing to do. That is, NOTHING is generated. (Are you where you think you are?)"
|
252
|
+
return false
|
253
|
+
end
|
254
|
+
|
255
|
+
if File.directory? directory_name then
|
256
|
+
begin
|
257
|
+
FileUtils.rm_rf([ directory_name ])
|
258
|
+
rescue => e
|
259
|
+
puts "could not clean up #{ directory_name } -- #{ e }"
|
260
|
+
return
|
261
|
+
end
|
262
|
+
elsif File.exists? directory_name then
|
263
|
+
puts "please move #{ directory_name } out of the way of xampl-gen"
|
264
|
+
return
|
265
|
+
end
|
266
|
+
|
267
|
+
if directory_name then
|
268
|
+
FileUtils.mkdir_p(directory_name) unless File.exist?(directory_name)
|
269
|
+
end
|
270
|
+
|
271
|
+
|
254
272
|
@elements_map.each do |ns, elements|
|
255
273
|
elements.element_child.each do |element|
|
256
274
|
place = find_place(directory_name, element.package)
|
@@ -290,6 +308,7 @@ module XamplGenerator
|
|
290
308
|
end
|
291
309
|
|
292
310
|
report_elements if params[:verbose]
|
311
|
+
return true
|
293
312
|
end
|
294
313
|
|
295
314
|
def report_elements
|
data/xamplr-gen.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{xamplr-gen}
|
8
|
-
s.version = "1.9.
|
8
|
+
s.version = "1.9.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Bob Hutchison"]
|
12
|
-
s.date = %q{2010-01
|
12
|
+
s.date = %q{2010-02-01}
|
13
13
|
s.default_executable = %q{xampl-gen}
|
14
14
|
s.description = %q{This is the xampl code generator for Ruby.}
|
15
15
|
s.email = %q{hutch@xampl.com}
|
@@ -85,14 +85,14 @@ Gem::Specification.new do |s|
|
|
85
85
|
|
86
86
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
87
87
|
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
88
|
-
s.add_runtime_dependency(%q<xamplr>, [">= 1.9.
|
88
|
+
s.add_runtime_dependency(%q<xamplr>, [">= 1.9.3"])
|
89
89
|
else
|
90
90
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
91
|
-
s.add_dependency(%q<xamplr>, [">= 1.9.
|
91
|
+
s.add_dependency(%q<xamplr>, [">= 1.9.3"])
|
92
92
|
end
|
93
93
|
else
|
94
94
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
95
|
-
s.add_dependency(%q<xamplr>, [">= 1.9.
|
95
|
+
s.add_dependency(%q<xamplr>, [">= 1.9.3"])
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xamplr-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Hutchison
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01
|
12
|
+
date: 2010-02-01 00:00:00 -05:00
|
13
13
|
default_executable: xampl-gen
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.9.
|
33
|
+
version: 1.9.3
|
34
34
|
version:
|
35
35
|
description: This is the xampl code generator for Ruby.
|
36
36
|
email: hutch@xampl.com
|