Skip to content

Commit

Permalink
Gemified.
Browse files Browse the repository at this point in the history
  • Loading branch information
bringhurst committed Apr 22, 2011
1 parent 00d6bd2 commit fa4842a
Show file tree
Hide file tree
Showing 15 changed files with 179 additions and 52 deletions.
5 changes: 5 additions & 0 deletions .document
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
lib/**/*.rb
bin/*
-
features/**/*.feature
LICENSE.txt
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# rcov generated
coverage

# rdoc generated
rdoc

# yard generated
doc
.yardoc

# bundler
.bundle

# jeweler generated
pkg
13 changes: 13 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
source "http://rubygems.org"
# Add dependencies required to use your gem here.
# Example:
# gem "activesupport", ">= 2.3.5"

# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "shoulda", ">= 0"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.5.2"
gem "rcov", ">= 0"
end
20 changes: 20 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
GEM
remote: http://rubygems.org/
specs:
git (1.2.5)
jeweler (1.5.2)
bundler (~> 1.0.0)
git (>= 1.2.5)
rake
rake (0.8.7)
rcov (0.9.9)
shoulda (2.11.3)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.0.0)
jeweler (~> 1.5.2)
rcov
shoulda
3 changes: 2 additions & 1 deletion MIT-LICENSE → LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (c) 2009 [name of plugin creator]
Copyright (c) 2010 [Phronos](http://phronos.com)
Copyright (c) 2011 Jon Bringhurst <jon@bringhurst.org>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,4 @@ There is a more functionality offered by DataTables than this plugin currently p
### Credits

Copyright (c) 2009 [Phronos](http://phronos.com), released under the MIT license
Copyright (c) 2011 Jon Bringhurst <jon@bringhurst.org>, released under the MIT license
53 changes: 39 additions & 14 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,48 @@
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'

require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "rails_datatables"
gem.homepage = "http://github.com/fintler/rails_datatables"
gem.license = "MIT"
gem.summary = %Q{Rails plugin for the jQuery Datatables library }
gem.description = %Q{A simpler, Rails-friendly interface to using the DataTables jQuery library.}
gem.email = "jon@bringhurst.org"
gem.authors = ["Jon Bringhurst"]
end
Jeweler::RubygemsDotOrgTasks.new

require 'rake/testtask'
require 'rake/rdoctask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
end

require 'rcov/rcovtask'
Rcov::RcovTask.new do |test|
test.libs << 'test'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
end

desc 'Default: run unit tests.'
task :default => :test

desc 'Test the rails_datatables plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""

desc 'Generate documentation for the rails_datatables plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'RailsDatatables'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.title = "rails_datatables #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
1 change: 0 additions & 1 deletion init.rb

This file was deleted.

1 change: 0 additions & 1 deletion install.rb

This file was deleted.

54 changes: 28 additions & 26 deletions lib/rails_datatables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,33 @@ def datatable(columns, opts={})
<script type="text/javascript">
$(function() {
$('#{table_dom_id}').dataTable({
"oLanguage": {
"sSearch": "#{search_label}",
#{"'sZeroRecords': '#{no_records_message}'," if no_records_message}
"sProcessing": '#{processing}'
},
"sPaginationType": "full_numbers",
"iDisplayLength": #{per_page},
"bProcessing": true,
"bServerSide": #{server_side},
"bLengthChange": false,
"bStateSave": #{persist_state},
"bFilter": #{search},
"bAutoWidth": #{auto_width},
#{"'aaSorting': [#{sort_by}]," if sort_by}
#{"'sAjaxSource': '#{ajax_source}'," if ajax_source}
"aoColumns": [
#{formatted_columns(columns)}
],
#{"'fnRowCallback': function( nRow, aData, iDisplayIndex ) { #{row_callback} }," if row_callback}
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( #{additional_data_string} );
$.getJSON( sSource, aoData, function (json) {
fnCallback(json);
} );
}
"oLanguage": {
"sSearch": "#{search_label}",
#{"'sZeroRecords': '#{no_records_message}'," if no_records_message}
"sProcessing": '#{processing}'
},
"sPaginationType": "full_numbers",
"iDisplayLength": #{per_page},
"bProcessing": true,
"bServerSide": #{server_side},
"bLengthChange": false,
"bStateSave": #{persist_state},
"bFilter": #{search},
"bAutoWidth": #{auto_width},
#{"'aaSorting': [#{sort_by}]," if sort_by}
#{"'sAjaxSource': '#{ajax_source}'," if ajax_source}
"aoColumns": [
#{formatted_columns(columns)}
],
#{"'fnRowCallback': function( nRow, aData, iDisplayIndex ) {
#{row_callback}
}," if row_callback}
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( #{additional_data_string} );
$.getJSON( sSource, aoData, function (json) {
fnCallback(json);
});
}
})#{append};
});
</script>
Expand All @@ -78,4 +80,4 @@ def formatted_columns(columns)
end
}.join(",")
end
end
end
56 changes: 56 additions & 0 deletions rails_datatables.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{rails_datatables}
s.version = "0.0.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jon Bringhurst"]
s.date = %q{2011-04-22}
s.description = %q{A simpler, Rails-friendly interface to using the DataTables jQuery library.}
s.email = %q{jon@bringhurst.org}
s.extra_rdoc_files = [
"LICENSE.txt",
"README.md"
]
s.files = [
"README.md",
"Rakefile",
"VERSION",
"lib/rails_datatables.rb"
]
s.homepage = %q{http://github.com/fintler/rails_datatables}
s.licenses = ["MIT"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.6.2}
s.summary = %q{Rails plugin for the jQuery Datatables library}
s.test_files = [
"test/helper.rb",
"test/test_rails_datatables.rb"
]

if s.respond_to? :specification_version then
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<shoulda>, [">= 0"])
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
s.add_development_dependency(%q<rcov>, [">= 0"])
else
s.add_dependency(%q<shoulda>, [">= 0"])
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
s.add_dependency(%q<rcov>, [">= 0"])
end
else
s.add_dependency(%q<shoulda>, [">= 0"])
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
s.add_dependency(%q<rcov>, [">= 0"])
end
end

File renamed without changes.
8 changes: 0 additions & 8 deletions test/rails_datatables_test.rb

This file was deleted.

Empty file added test/test_rails_datatables.rb
Empty file.
1 change: 0 additions & 1 deletion uninstall.rb

This file was deleted.

0 comments on commit fa4842a

Please sign in to comment.