Rakefile in ios-checkboxes-0.1.0 vs Rakefile in ios-checkboxes-0.1.2

- old
+ new

@@ -1,22 +1,37 @@ -require 'rake' -require 'bundler/gem_tasks' +#!/usr/bin/env rake +begin + require 'bundler/setup' +rescue LoadError + puts 'You must `gem install bundler` and `bundle install` to run rake tasks' +end +begin + require 'rdoc/task' +rescue LoadError + require 'rdoc/rdoc' + require 'rake/rdoctask' + RDoc::Task = Rake::RDocTask +end -desc "Update the gem with the latest files" -task :update do - # Copy the js file and require jQuery - js_content = File.read "../jquery/iphone-style-checkboxes.js" - f = File.new("vendor/assets/javascripts/ios-checkboxes.js", "w") - f.write("//= require jquery\n\n#{js_content}") - f.close +RDoc::Task.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'rdoc' + rdoc.title = 'IosCheckboxes' + rdoc.options << '--line-numbers' + rdoc.rdoc_files.include('README.rdoc') + rdoc.rdoc_files.include('lib/**/*.rb') +end - # Copy the images - cp_r "../images/", "vendor/assets/" - # Copy CSS and make sure it references the images via assets pipeline - css_content = File.read "../style.css" - pattern = /url\('images\/([^']+)'\)/ - css_processed = css_content.gsub(pattern) {|m| "url('<%= image_path \"#{$1.sub(/\?.*/, '')}\" %>')" } - f2 = File.new("vendor/assets/stylesheets/ios-checkboxes.css.erb", "w") - f2.write(css_processed) - f2.close + +Bundler::GemHelper.install_tasks + +require 'rake/testtask' + +Rake::TestTask.new(:test) do |t| + t.libs << 'lib' + t.libs << 'test' + t.pattern = 'test/**/*_test.rb' + t.verbose = false end + + +task :default => :test