Skip to content

Commit

Permalink
added files/directory validations.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Felipe Alvarez Saldarriaga committed Oct 6, 2010
1 parent cfa242f commit 1dd760f
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,31 @@ task :build_sdoc do
require "json"
require "lib/titanium_mobile.rb"

File.open( "dump/titanium-mobile.sdoc", "w+" ) do |f|
api = JSON.parse( File.read( "dist/api.json" ) )
data = TitaniumMobile::SDoc.process_data( api )
data.each do |d|
f.puts( TitaniumMobile::SDoc.build_block( d ) + "\n" )
if !File.directory?( "dist" )
raise "nah nah, you need a directory named 'dist' men!"
end

if !File.file?( "dist/api.json" )
raise "nah nah, you need the 'api.json' file, get it here: http://developer.appcelerator.com/apidoc/mobile/latest"
end

if !File.directory?( "dump" )
Dir.mkdir( "dump", 0700 )
end

begin
puts "=> building sdoc..."
File.open( "dump/titanium-mobile.sdoc", "w+" ) do |f|
api = JSON.parse( File.read( "dist/api.json" ) )
data = TitaniumMobile::SDoc.process_data( api )
data.each do |d|
f.puts( TitaniumMobile::SDoc.build_block( d ) + "\n" )
end
end
puts "=> done"
puts "=> copy dump/titanium-mobile.sdoc file to your project"
rescue Exception => e
raise e
end
end

Expand Down

0 comments on commit 1dd760f

Please sign in to comment.