Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a gemspec and tasks for installation.
Added gemspec that loads installation rake tasks via require 'tasks/ajax_resource'
- Loading branch information
Showing
4 changed files
with
66 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1 @@ | ||
require 'rake' | ||
|
||
desc "Cleans up the javascript build." | ||
task :clean do | ||
FileUtils.rm_r(File.dirname(__FILE__) + '/build') | ||
end | ||
|
||
desc "Runs jslint on all files in the src directory" | ||
task :jslint do | ||
puts "Running jslint..." | ||
with_errors = [] | ||
Dir.glob("src/**/*js").each do |file| | ||
unless (report = `cat #{file} | jslint`) =~ /No problems found/ | ||
with_errors << file | ||
puts <<-REPORT_END | ||
---------------- | ||
#{file} problems: | ||
#{report} | ||
REPORT_END | ||
end | ||
end | ||
|
||
unless with_errors.size == 0 | ||
puts "Following files had problems:" | ||
with_errors.each { |file| puts " - #{file}" } | ||
else | ||
puts "All good." | ||
end | ||
end | ||
|
||
desc "Builds the javascript library." | ||
task :build do | ||
puts `jake --force` | ||
puts "Done building." | ||
end | ||
|
||
task :default => [ :jslint, :build ] | ||
require 'tasks/ajax_resource' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
require 'tasks/build' | ||
|
||
AJAX_RESOURCE_VERSION = '0.01' | ||
|
||
# first build the library | ||
Rake::Task["ajax_resource:build"].execute | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "ajax_resource" | ||
s.version = "0.01" | ||
s.version = AJAX_RESOURCE_VERSION | ||
s.authors = [ "Dmitry Ratnikov" ] | ||
s.date = Time.now.to_s | ||
s.email = 'ratnikov@gmail.com' | ||
s.date = Time.now | ||
s.email = 'dmitryr@webitects.com' | ||
s.has_rdoc = false | ||
s.summary = "Javascript implementation of REST interface" | ||
|
||
s.files = [ 'build/ajax_resource-min.js', 'build/ajax_resource-src.js', 'tasks/ajax_resource.rb' ] | ||
s.require_path = '.' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
namespace :ajax_resource do | ||
namespace :rails do | ||
desc "Installs ajax_resource javascript in the public/javascripts directory. Set COMPRESS=true to install the compressed version." | ||
task :install do | ||
extension = ENV["COMPRESS"] == "true" ? "min" : "src" | ||
from = File.join File.dirname(__FILE__), '..', 'build', "ajax_resource-#{extension}.js" | ||
to = File.join Rails.root, 'public', 'javascripts', 'ajax_resource.js' | ||
FileUtils.cp(from, to, :verbose => true); | ||
puts "Done installing." | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require 'rake' | ||
|
||
namespace :ajax_resource do | ||
desc "Cleans up the javascript build." | ||
task :clean do | ||
FileUtils.rm_r(File.dirname(__FILE__) + '/build') | ||
end | ||
|
||
desc "Runs jslint on all files in the src directory" | ||
task :jslint do | ||
puts "Running jslint..." | ||
with_errors = [] | ||
Dir.glob("src/**/*js").each do |file| | ||
unless (report = `cat #{file} | jslint`) =~ /No problems found/ | ||
with_errors << file | ||
puts <<-REPORT_END | ||
---------------- | ||
#{file} problems: | ||
#{report} | ||
REPORT_END | ||
end | ||
end | ||
|
||
unless with_errors.size == 0 | ||
puts "Following files had problems:" | ||
with_errors.each { |file| puts " - #{file}" } | ||
else | ||
puts "All good." | ||
end | ||
end | ||
|
||
desc "Builds the javascript library." | ||
task :build do | ||
puts `jake --force` | ||
puts "Done building." | ||
end | ||
|
||
task :default => [ :jslint, :build ] | ||
end |