lib/tasks/spectifly.rake in spectifly-0.0.10 vs lib/tasks/spectifly.rake in spectifly-0.0.11
- old
+ new
@@ -6,13 +6,12 @@
File.open(File.join(path, "#{entity.name}.xsd"), 'w') do |f|
f.write Spectifly::Xsd::Builder.new(entity).build
end
end
- Spectifly::Task.new('generate_from_entities', [:destination_path]) do |spectifly, args|
+ Spectifly::Task.new('generate_from_entities', [:destination_path, :presenter_path]) do |spectifly, args|
options = File.exist?(spectifly.presenter_path) ? { :presenter_path => spectifly.presenter_path } : {}
-
Spectifly::Entity.from_directory(spectifly.entity_path, options).each do |name, entity|
if entity.is_a? Spectifly::Entity
write_entity(entity, args[:destination_path])
else
presenter_path = File.join(args[:destination_path], name)
@@ -22,11 +21,11 @@
end
end
end
end
- Spectifly::Task.new('generate_extended_types', [:destination_path]) do |spectifly, args|
+ Spectifly::Task.new('generate_extended_types', [:destination_path, :presenter_path]) do |spectifly, args|
extended = File.join(args[:destination_path], 'extended.xsd')
File.open(extended, 'w') do |f|
f.write Spectifly::Xsd::Types.build_extended
end
Dir.glob(File.join(args[:destination_path], '*/')).each do |path|
@@ -34,8 +33,8 @@
FileUtils.cp extended, path
end
end
desc 'Generate all XSDs for the configured entity directory, including extended type definitions'
- task :generate_all, [:destination_path] => [:generate_from_entities, :generate_extended_types]
+ task :generate_all, [:destination_path, :presenter_path] => [:generate_from_entities, :generate_extended_types]
end
end