tableasy 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Andrius Chamentauskas
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,17 @@
1
+ = tableasy
2
+
3
+ Description goes here.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Andrius Chamentauskas. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,50 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "tableasy"
8
+ gem.summary = %Q{Rails tables builder gem}
9
+ gem.description = %Q{Rails tables builder gem that makes creating tables painless. Includes ability to write custom column formatters or even customize row completely.
10
+ Includes library of predefined column formatters. Also has ability to generate "totals" row.}
11
+ gem.email = "sinsiliux@gmail.com"
12
+ gem.homepage = "http://github.com/sinsiliux/tableasy"
13
+ gem.authors = ["Andrius Chamentauskas"]
14
+ gem.add_development_dependency "rspec", ">= 1.2.9"
15
+ gem.add_development_dependency "blueprints"
16
+ gem.add_development_dependency "mocha"
17
+ gem.add_dependency "activesupport"
18
+ gem.add_dependency "actionpack"
19
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
20
+ end
21
+ Jeweler::GemcutterTasks.new
22
+ rescue LoadError
23
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
24
+ end
25
+
26
+ require 'spec/rake/spectask'
27
+ Spec::Rake::SpecTask.new(:spec) do |spec|
28
+ spec.libs << 'lib' << 'spec'
29
+ spec.spec_files = FileList['spec/**/*_spec.rb']
30
+ end
31
+
32
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
33
+ spec.libs << 'lib' << 'spec'
34
+ spec.pattern = 'spec/**/*_spec.rb'
35
+ spec.rcov = true
36
+ end
37
+
38
+ task :spec => :check_dependencies
39
+
40
+ task :default => :spec
41
+
42
+ require 'rake/rdoctask'
43
+ Rake::RDocTask.new do |rdoc|
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "tableasy #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/lib/formatters.rb ADDED
@@ -0,0 +1,44 @@
1
+ formatter(:linked) do |subject, column|
2
+ link_to(subject.send(column), subject)
3
+ end
4
+
5
+ formatter(:linked_to) do |subject, column|
6
+ object = subject.send(column)
7
+ link_to object, object
8
+ end
9
+
10
+ formatter(:tail_link, :no_header => true) do |subject, text, *args|
11
+ html_options = args.extract_options!.clone
12
+ url = args + [subject]
13
+
14
+ if html_options.delete(:ajax)
15
+ options = {:method => html_options.delete(:method), :confirm => html_options.delete(:confirm), :url => url}
16
+ link_to_remote text, options, html_options
17
+ else
18
+ link_to text, url, html_options
19
+ end
20
+ end
21
+
22
+ #def edit_link(*url)
23
+ # options = url.extract_options!
24
+ # options.merge!(:method => 'get') if options[:ajax]
25
+ # url.unshift(:edit).push(options)
26
+ # tail_link "Edit", *url
27
+ #end
28
+ #
29
+ #def destroy_link(*url)
30
+ # options = url.extract_options!
31
+ # options.reverse_merge!(:confirm => 'Are you sure?', :method => 'delete')
32
+ # url.push(options)
33
+ # tail_link "Delete", *url
34
+ #end
35
+
36
+ formatter(:with_percent) do |subject, column, total_column|
37
+ number, total = subject.send(column).to_i, subject.send(total_column).to_i
38
+ percent = total == 0 ? 0 : number.to_f / total * 100
39
+ "#{number} (#{helper.number_to_percentage(percent)})"
40
+ end
41
+
42
+ formatter(:random) do |subject, column, range|
43
+ rand(range.last - range.first) + range.first
44
+ end
@@ -0,0 +1,17 @@
1
+ module Tableasy
2
+ class Column
3
+ include HtmlAttributes
4
+ attr_reader :value
5
+
6
+ def initialize(record, value)
7
+ @record = record
8
+ self.value = value
9
+ end
10
+
11
+ def value=(value)
12
+ value = value.execute(@record) if value.is_a?(Tableasy::ColumnFormatter)
13
+ value = @record.send(value) if value.is_a?(Symbol)
14
+ @value = value
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,34 @@
1
+ module Tableasy
2
+ class ColumnFormatter
3
+ def initialize(context, formatter, *args)
4
+ @context = context
5
+ @formatter = formatter
6
+ @args = args
7
+ end
8
+
9
+ def execute(record)
10
+ @context.instance_exec(record, *@args, &@formatter.block)
11
+ end
12
+
13
+ def to_sym
14
+ @formatter.format_header(@args.first)
15
+ end
16
+ end
17
+
18
+ class Formatter
19
+ attr_reader :block
20
+
21
+ def initialize(&block)
22
+ @block = block
23
+ @format_header = Proc.new {|header| header }
24
+ end
25
+
26
+ def format_header(header = nil, &block)
27
+ if block
28
+ @format_header = block
29
+ else
30
+ @format_header.call(header)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,14 @@
1
+ module Tableasy
2
+ module HtmlAttributes
3
+ def html
4
+ @html ||= {}
5
+ end
6
+
7
+ def method_missing(method, *args)
8
+ if method.to_s =~ /(.*)=/
9
+ attr = $1.to_sym
10
+ html[attr] = args.shift
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ module Tableasy
2
+ class Row
3
+ include HtmlAttributes
4
+ attr_reader :record, :columns
5
+
6
+ def initialize(record, columns, total_row = false)
7
+ @record = record
8
+
9
+ @columns = columns.collect do |value|
10
+ Column.new(record, value)
11
+ end
12
+ @total_row = total_row
13
+ @html = {}
14
+ end
15
+
16
+ def total_row?
17
+ @total_row
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,46 @@
1
+ module Tableasy
2
+ module TablesHelper
3
+ def table_for(klass, list, *columns)
4
+ options = columns.extract_options!
5
+
6
+ content_tag('table') do
7
+ content = ''
8
+ content << content_tag('tr') do
9
+ columns.select {|column| column.to_sym }.collect do |column|
10
+ content_tag 'th', klass.human_attribute_name(column.to_sym)
11
+ end.join
12
+ end
13
+
14
+ content << list.collect do |item|
15
+ row = Row.new(item, columns)
16
+ yield row if block_given?
17
+ content_row(item, row)
18
+ end.join
19
+
20
+ if options[:total]
21
+ item = Total.new(list)
22
+ caption = I18n.t('tableasy.total', :raise => true) rescue 'Total: '
23
+ row = Row.new(item, columns[1..-1].unshift(caption), true)
24
+ row.html[:class] = 'total-row'
25
+ yield row if block_given?
26
+ content << content_row(item, row, :first_header => true)
27
+ end
28
+
29
+ content
30
+ end
31
+ end
32
+
33
+ def content_row(object, row, options = {})
34
+ content_tag_for('tr', object, :row, row.html) do
35
+ ''.tap do |result|
36
+ if options[:first_header]
37
+ column = row.columns.shift
38
+ result << content_tag('th', column.value, column.html)
39
+ end
40
+ result << row.columns.collect { |column| content_tag('td', column.value, column.html) }.join
41
+ end
42
+ end
43
+ end
44
+
45
+ end
46
+ end
@@ -0,0 +1,13 @@
1
+ module Tableasy
2
+ class Total
3
+ undef_method :id if method_defined?(:id)
4
+
5
+ def initialize(list)
6
+ @list = list
7
+ end
8
+
9
+ def method_missing(column)
10
+ @list.collect {|item| item.send(column) }.inject {|total, item| total + item }
11
+ end
12
+ end
13
+ end
data/lib/tableasy.rb ADDED
@@ -0,0 +1,32 @@
1
+ require 'active_support'
2
+ require 'action_view'
3
+ require 'action_controller'
4
+ %w{html_attributes column row total formatter tables_helper}.each {|f| require File.dirname(__FILE__) + "/tableasy/#{f}" }
5
+
6
+ module Tableasy
7
+ module FormattersHelper
8
+ end
9
+
10
+ class FormattersContext
11
+ def self.formatter(name, options = {}, &block)
12
+ Formatter.new(&block).tap do |formatter|
13
+ formatter.format_header { nil } if options[:no_header]
14
+
15
+ FormattersHelper.module_eval do
16
+ define_method(name) do |column, *args|
17
+ ColumnFormatter.new(self, formatter, column, *args)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ def self.reload_formatters(file)
25
+ FormattersContext.module_eval(File.read(file))
26
+ end
27
+ end
28
+
29
+ class ActionView::Base
30
+ include Tableasy::TablesHelper
31
+ include Tableasy::FormattersHelper
32
+ end
data/spec/blueprint.rb ADDED
@@ -0,0 +1,11 @@
1
+ blueprint :andrius do
2
+ Person.new(1, 'Andrius')
3
+ end
4
+
5
+ blueprint :admin do
6
+ Person.new(1, 'Admin')
7
+ end
8
+
9
+ blueprint :project => :andrius do
10
+ Project.new(1, 'project', @andrius)
11
+ end
@@ -0,0 +1,18 @@
1
+ module FakeModel
2
+ end
3
+
4
+ module FakeModelClass
5
+ def human_attribute_name(column)
6
+ column.to_s.humanize
7
+ end
8
+ end
9
+
10
+ class Person < Struct.new(:id, :name)
11
+ alias_method :to_s, :name
12
+ extend FakeModelClass
13
+ end
14
+
15
+ class Project < Struct.new(:id, :name, :leader)
16
+ alias_method :to_s, :name
17
+ extend FakeModelClass
18
+ end
@@ -0,0 +1,65 @@
1
+ require File.dirname(__FILE__) + "/../spec_helper"
2
+
3
+ describe 'Formatters' do
4
+ before do
5
+ build :andrius
6
+ end
7
+
8
+ it "should show linked object" do
9
+ formatter = helper.linked(:name)
10
+ formatter.to_sym.should == :name
11
+ formatter.execute(@andrius).should == '<a href="/people/Andrius">Andrius</a>'
12
+ end
13
+
14
+ it "should show object linked to itself" do
15
+ build :project
16
+ formatter = helper.linked_to(:leader)
17
+ formatter.to_sym.should == :leader
18
+ formatter.execute(@project).should == '<a href="/people/Andrius">Andrius</a>'
19
+ end
20
+
21
+ it "should show number with percent" do
22
+ @andrius.stubs(:work_hours).returns(100, 100, 13, nil)
23
+ @andrius.stubs(:remaining).returns(8, -8, 8, nil)
24
+
25
+ formatter = helper.with_percent(:remaining, :work_hours)
26
+ formatter.to_sym.should == :remaining
27
+ ["8 (8.000%)", "-8 (-8.000%)", "8 (61.538%)", "0 (0.000%)"].each do |result|
28
+ formatter.execute(@andrius).should == result
29
+ end
30
+ end
31
+
32
+ it "should return random number in range" do
33
+ helper.expects(:rand).with(30).returns(23)
34
+ formatter = helper.random(:hours, 100..130)
35
+ formatter.to_sym.should == :hours
36
+ formatter.execute(nil).should == 123
37
+ end
38
+
39
+ describe 'tail_link' do
40
+ before do
41
+ build :andrius
42
+ end
43
+
44
+ it "should allow show link with no symbol" do
45
+ formatter = helper.tail_link('hello')
46
+ formatter.execute(@andrius).should == '<a href="/people/Andrius">hello</a>'
47
+ formatter.to_sym.should == nil
48
+ end
49
+
50
+ it "should allow passing custom url" do
51
+ formatter = helper.tail_link('hello', :edit)
52
+ formatter.execute(@andrius).should == '<a href="/edit/people/Andrius">hello</a>'
53
+ end
54
+
55
+ it "should allow passing custom url and html attributes" do
56
+ formatter = helper.tail_link('hello', :edit, :method => :delete)
57
+ formatter.execute(@andrius).should == helper.link_to('hello', [:edit, @andrius], :method => :delete)
58
+ end
59
+
60
+ it "should allow creating ajax link" do
61
+ formatter = helper.tail_link('hello', :edit, :ajax => true)
62
+ formatter.execute(@andrius).should == helper.link_to_remote('hello', :url => [:edit, @andrius])
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,87 @@
1
+ require File.dirname(__FILE__) + "/../spec_helper"
2
+
3
+ describe Tableasy::TablesHelper do
4
+ it "should allow creating table for collection of models" do
5
+ build :project
6
+ output = helper.table_for(Project, [@project], :name)
7
+
8
+ output.should == "<table><tr><th>Name</th></tr><tr class=\"project\" id=\"row_project_1\"><td>project</td></tr></table>"
9
+ end
10
+
11
+ it "should yield row object with columns and record when creating table using block" do
12
+ build :project
13
+ output = helper.table_for(Project, [@project], :name, :leader) do |row|
14
+ row.columns[0].value = row.record.name
15
+ row.columns[1].value = 'xxxxx'
16
+ end
17
+
18
+ output.should == "<table><tr><th>Name</th><th>Leader</th></tr><tr class=\"project\" id=\"row_project_1\"><td>project</td><td>xxxxx</td></tr></table>"
19
+ end
20
+
21
+ it "should allow passing custom html options for row and columns" do
22
+ build :project
23
+ output = helper.table_for(Project, [@project], :name) do |row|
24
+ row.title = 'my row'
25
+ row.html[:class] = 'my-row'
26
+ row.columns[0].align = 'center'
27
+ row.columns[0].html[:class] = 'name'
28
+ end
29
+
30
+ output.should == "<table><tr><th>Name</th></tr><tr class=\"project my-row\" id=\"row_project_1\" title=\"my row\"><td align=\"center\" class=\"name\">project</td></tr></table>"
31
+ end
32
+
33
+ it "should allow creating a table with totals row" do
34
+ build :admin, :andrius
35
+ output = helper.table_for(Person, [@admin, @andrius], :name, :id, :total => true)
36
+
37
+ output.should == "<table>\
38
+ <tr><th>Name</th><th>Id</th></tr>\
39
+ <tr class=\"person\" id=\"row_person_1\"><td>Admin</td><td>1</td></tr>\
40
+ <tr class=\"person\" id=\"row_person_1\"><td>Andrius</td><td>1</td></tr>\
41
+ <tr class=\"tableasy_total total-row\" id=\"row_tableasy_total_2\"><th>Total: </th><td>2</td></tr>\
42
+ </table>"
43
+ end
44
+
45
+ it "should allow creating custom total row" do
46
+ build :admin, :andrius
47
+ output = helper.table_for(Person, [@admin, @andrius], :name, :id, :total => true) do |row|
48
+ row.columns[0].value = 'Total of:' if row.total_row?
49
+ row.columns[1].value = "@#{row.record.id}"
50
+ end
51
+
52
+ output.should == "<table>\
53
+ <tr><th>Name</th><th>Id</th></tr>\
54
+ <tr class=\"person\" id=\"row_person_1\"><td>Admin</td><td>@1</td></tr>\
55
+ <tr class=\"person\" id=\"row_person_1\"><td>Andrius</td><td>@1</td></tr>\
56
+ <tr class=\"tableasy_total total-row\" id=\"row_tableasy_total_2\"><th>Total of:</th><td>@2</td></tr>\
57
+ </table>"
58
+ end
59
+
60
+ it "should allow using formatters" do
61
+ build :andrius
62
+ output = helper.table_for(Person, [@andrius], helper.linked(:name))
63
+
64
+ output.should == "<table><tr><th>Name</th></tr><tr class=\"person\" id=\"row_person_1\"><td><a href=\"/people/Andrius\">Andrius</a></td></tr></table>"
65
+ end
66
+
67
+ it "should allow using formatters with totals" do
68
+ build :andrius, :admin
69
+ @andrius.stubs(:id2).returns(@andrius.id * 2)
70
+ @admin.stubs(:id2).returns(@admin.id * 2)
71
+ output = helper.table_for(Person, [@admin, @andrius], :name, :id2, helper.with_percent(:id, :id2), :total => true)
72
+
73
+ output.should == "<table>\
74
+ <tr><th>Name</th><th>Id2</th><th>Id</th></tr>\
75
+ <tr class=\"person\" id=\"row_person_1\"><td>Admin</td><td>2</td><td>1 (50.000%)</td></tr>\
76
+ <tr class=\"person\" id=\"row_person_1\"><td>Andrius</td><td>2</td><td>1 (50.000%)</td></tr>\
77
+ <tr class=\"tableasy_total total-row\" id=\"row_tableasy_total_2\"><th>Total: </th><td>4</td><td>2 (50.000%)</td></tr>\
78
+ </table>"
79
+ end
80
+
81
+ it "should not add nil column headers" do
82
+ build :andrius
83
+ output = helper.table_for(Person, [@andrius], helper.tail_link('show'))
84
+
85
+ output.should == "<table><tr></tr><tr class=\"person\" id=\"row_person_1\"><td><a href=\"/people/Andrius\">show</a></td></tr></table>"
86
+ end
87
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,43 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'tableasy'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+ require 'blueprints'
7
+ require 'mocha'
8
+ require 'fake_models'
9
+
10
+ Spec::Runner.configure do |config|
11
+ config.enable_blueprints :orm => :none, :root => File.dirname(__FILE__) + '/..'
12
+ config.mock_with :mocha
13
+ config.before { Tableasy.reload_formatters(File.dirname(__FILE__) + '/../lib/formatters.rb')}
14
+
15
+ Blueprints::Context.send(:include, Mocha::API)
16
+ end
17
+
18
+ class HelperObject
19
+ include ActionView::Helpers
20
+ include Tableasy::TablesHelper
21
+ include Tableasy::FormattersHelper
22
+ attr_accessor :output_buffer
23
+ # include TableHelper
24
+
25
+ def url_for(args)
26
+ args = [args] unless args.is_a?(Array)
27
+ args.collect do |object|
28
+ if object.is_a? Symbol or object.is_a? String
29
+ "/#{object}"
30
+ else
31
+ "/#{object.class.to_s.tableize}/#{object}"
32
+ end
33
+ end.join
34
+ end
35
+
36
+ def protect_against_forgery?
37
+ false
38
+ end
39
+ end
40
+
41
+ def helper
42
+ @helper ||= HelperObject.new
43
+ end
data/tableasy.gemspec ADDED
@@ -0,0 +1,81 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{tableasy}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Andrius Chamentauskas"]
12
+ s.date = %q{2010-02-22}
13
+ s.description = %q{Rails tables builder gem that makes creating tables painless. Includes ability to write custom column formatters or even customize row completely.
14
+ Includes library of predefined column formatters. Also has ability to generate "totals" row.}
15
+ s.email = %q{sinsiliux@gmail.com}
16
+ s.extra_rdoc_files = [
17
+ "LICENSE",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".gitignore",
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/formatters.rb",
28
+ "lib/tableasy.rb",
29
+ "lib/tableasy/column.rb",
30
+ "lib/tableasy/formatter.rb",
31
+ "lib/tableasy/html_attributes.rb",
32
+ "lib/tableasy/row.rb",
33
+ "lib/tableasy/tables_helper.rb",
34
+ "lib/tableasy/total.rb",
35
+ "spec/blueprint.rb",
36
+ "spec/fake_models.rb",
37
+ "spec/helpers/formatting_helper_spec.rb",
38
+ "spec/helpers/tables_helper_spec.rb",
39
+ "spec/spec.opts",
40
+ "spec/spec_helper.rb",
41
+ "tableasy.gemspec"
42
+ ]
43
+ s.homepage = %q{http://github.com/sinsiliux/tableasy}
44
+ s.rdoc_options = ["--charset=UTF-8"]
45
+ s.require_paths = ["lib"]
46
+ s.rubygems_version = %q{1.3.5}
47
+ s.summary = %q{Rails tables builder gem}
48
+ s.test_files = [
49
+ "spec/helpers/tables_helper_spec.rb",
50
+ "spec/helpers/formatting_helper_spec.rb",
51
+ "spec/spec_helper.rb",
52
+ "spec/fake_models.rb",
53
+ "spec/blueprint.rb"
54
+ ]
55
+
56
+ if s.respond_to? :specification_version then
57
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
58
+ s.specification_version = 3
59
+
60
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
61
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
62
+ s.add_development_dependency(%q<blueprints>, [">= 0"])
63
+ s.add_development_dependency(%q<mocha>, [">= 0"])
64
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
65
+ s.add_runtime_dependency(%q<actionpack>, [">= 0"])
66
+ else
67
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
68
+ s.add_dependency(%q<blueprints>, [">= 0"])
69
+ s.add_dependency(%q<mocha>, [">= 0"])
70
+ s.add_dependency(%q<activesupport>, [">= 0"])
71
+ s.add_dependency(%q<actionpack>, [">= 0"])
72
+ end
73
+ else
74
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
75
+ s.add_dependency(%q<blueprints>, [">= 0"])
76
+ s.add_dependency(%q<mocha>, [">= 0"])
77
+ s.add_dependency(%q<activesupport>, [">= 0"])
78
+ s.add_dependency(%q<actionpack>, [">= 0"])
79
+ end
80
+ end
81
+
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tableasy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrius Chamentauskas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-22 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.9
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: blueprints
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: mocha
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: activesupport
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: actionpack
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ description: |-
66
+ Rails tables builder gem that makes creating tables painless. Includes ability to write custom column formatters or even customize row completely.
67
+ Includes library of predefined column formatters. Also has ability to generate "totals" row.
68
+ email: sinsiliux@gmail.com
69
+ executables: []
70
+
71
+ extensions: []
72
+
73
+ extra_rdoc_files:
74
+ - LICENSE
75
+ - README.rdoc
76
+ files:
77
+ - .document
78
+ - .gitignore
79
+ - LICENSE
80
+ - README.rdoc
81
+ - Rakefile
82
+ - VERSION
83
+ - lib/formatters.rb
84
+ - lib/tableasy.rb
85
+ - lib/tableasy/column.rb
86
+ - lib/tableasy/formatter.rb
87
+ - lib/tableasy/html_attributes.rb
88
+ - lib/tableasy/row.rb
89
+ - lib/tableasy/tables_helper.rb
90
+ - lib/tableasy/total.rb
91
+ - spec/blueprint.rb
92
+ - spec/fake_models.rb
93
+ - spec/helpers/formatting_helper_spec.rb
94
+ - spec/helpers/tables_helper_spec.rb
95
+ - spec/spec.opts
96
+ - spec/spec_helper.rb
97
+ - tableasy.gemspec
98
+ has_rdoc: true
99
+ homepage: http://github.com/sinsiliux/tableasy
100
+ licenses: []
101
+
102
+ post_install_message:
103
+ rdoc_options:
104
+ - --charset=UTF-8
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: "0"
112
+ version:
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: "0"
118
+ version:
119
+ requirements: []
120
+
121
+ rubyforge_project:
122
+ rubygems_version: 1.3.5
123
+ signing_key:
124
+ specification_version: 3
125
+ summary: Rails tables builder gem
126
+ test_files:
127
+ - spec/helpers/tables_helper_spec.rb
128
+ - spec/helpers/formatting_helper_spec.rb
129
+ - spec/spec_helper.rb
130
+ - spec/fake_models.rb
131
+ - spec/blueprint.rb