Module: RestKat
- Defined in:
- lib/rest_kat.rb,
lib/rest_kat.rb,
lib/rest_kat/validator.rb
Defined Under Namespace
Classes: IosMapping, MySugrIphone, ObjCMapType, ObjCPrimitiveType, ObjCProperty, ObjCSequence, ObjCSequenceOfMap, ObjCSequenceOfPrimitve, ObjCType, Resource, Validator
Class Method Summary collapse
- .generate_api(api_location, schema_location) ⇒ Object
- .generate_item(api_location, schema_location, ext) ⇒ Object
Class Method Details
.generate_api(api_location, schema_location) ⇒ Object
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
# File 'lib/rest_kat.rb', line 462 def self.generate_api(api_location, schema_location) api_src = File.join api_location, "MSRestApiAutoGen" m_file_task = generate_item(api_src, schema_location, "h") h_file_task = generate_item(api_src, schema_location, "m") src_path = File. "../../src", __FILE__ src_h = File.join src_path, "MSRestSerializable.h" src_m = File.join src_path, "MSRestSerializable.m" tgt_h = File.join api_location, "MSRestSerializable.h" tgt_m = File.join api_location, "MSRestSerializable.m" t0 = file tgt_h => src_h do cp src_h, tgt_h, :verbose => true end t1 = file tgt_m => src_m do cp src_m, tgt_m, :verbose => true end Rake::Task.define_task :type => [m_file_task, h_file_task, t0, t1] end |
.generate_item(api_location, schema_location, ext) ⇒ Object
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/rest_kat.rb', line 441 def self.generate_item(api_location, schema_location, ext) deps = %w[ model.h.erb model.m.erb rest_kat.rb ].collect do |d| File. "../#{d}", __FILE__ end deps << schema_location file = "#{api_location}.#{ext}" file_task = Rake::FileTask.define_task file => deps do File.open file, 'w' do |f| puts "Generating #{file}" f.write RestKat::IosMapping.new(schema_location).send("to_#{ext}", file) end end end |