Class: RestKat::MySugrIphone
- Inherits:
-
Object
- Object
- RestKat::MySugrIphone
- Includes:
- Rake::DSL
- Defined in:
- lib/rest_kat.rb
Instance Method Summary collapse
- #generate_api(api_location, schema_location) ⇒ Object
- #generate_item(api_location, schema_location, ext) ⇒ Object
Instance Method Details
#generate_api(api_location, schema_location) ⇒ Object
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
# File 'lib/rest_kat.rb', line 469 def 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
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'lib/rest_kat.rb', line 447 def 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 |