table-for 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source :gemcutter
2
+
3
+ # Rails 3.0
4
+ gem 'rails'
5
+ gem 'rspec'
6
+ gem 'jeweler'
7
+ gem 'rcov'
8
+ gem 'building-blocks'
data/Gemfile.lock ADDED
@@ -0,0 +1,96 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ abstract (1.0.0)
5
+ actionmailer (3.0.0.beta3)
6
+ actionpack (= 3.0.0.beta3)
7
+ mail (~> 2.2.0)
8
+ text-format (~> 1.0.0)
9
+ actionpack (3.0.0.beta3)
10
+ activemodel (= 3.0.0.beta3)
11
+ activesupport (= 3.0.0.beta3)
12
+ erubis (~> 2.6.5)
13
+ rack (~> 1.1.0)
14
+ rack-mount (~> 0.6.0)
15
+ rack-test (~> 0.5.0)
16
+ activemodel (3.0.0.beta3)
17
+ activesupport (= 3.0.0.beta3)
18
+ activerecord (3.0.0.beta3)
19
+ activemodel (= 3.0.0.beta3)
20
+ activesupport (= 3.0.0.beta3)
21
+ arel (~> 0.3.3)
22
+ activeresource (3.0.0.beta3)
23
+ activemodel (= 3.0.0.beta3)
24
+ activesupport (= 3.0.0.beta3)
25
+ activesupport (3.0.0.beta3)
26
+ builder (~> 2.1.2)
27
+ i18n (~> 0.3.6)
28
+ memcache-client (>= 1.7.5)
29
+ tzinfo (~> 0.3.16)
30
+ arel (0.3.3)
31
+ activesupport (>= 3.0.0.beta)
32
+ builder (2.1.2)
33
+ building-blocks (0.0.1)
34
+ jeweler
35
+ rails
36
+ rcov
37
+ rspec
38
+ erubis (2.6.6)
39
+ abstract (>= 1.0.0)
40
+ git (1.2.5)
41
+ i18n (0.3.7)
42
+ jeweler (1.6.0)
43
+ bundler (~> 1.0.0)
44
+ git (>= 1.2.5)
45
+ rake
46
+ mail (2.2.7)
47
+ activesupport (>= 2.3.6)
48
+ mime-types
49
+ treetop (>= 1.4.5)
50
+ memcache-client (1.8.5)
51
+ mime-types (1.16)
52
+ polyglot (0.3.1)
53
+ rack (1.1.2)
54
+ rack-mount (0.6.14)
55
+ rack (>= 1.0.0)
56
+ rack-test (0.5.7)
57
+ rack (>= 1.0)
58
+ rails (3.0.0.beta3)
59
+ actionmailer (= 3.0.0.beta3)
60
+ actionpack (= 3.0.0.beta3)
61
+ activerecord (= 3.0.0.beta3)
62
+ activeresource (= 3.0.0.beta3)
63
+ activesupport (= 3.0.0.beta3)
64
+ bundler (>= 0.9.19)
65
+ railties (= 3.0.0.beta3)
66
+ railties (3.0.0.beta3)
67
+ actionpack (= 3.0.0.beta3)
68
+ activesupport (= 3.0.0.beta3)
69
+ rake (>= 0.8.3)
70
+ thor (~> 0.13.4)
71
+ rake (0.8.7)
72
+ rcov (0.9.9)
73
+ rspec (2.0.0.beta.8)
74
+ rspec-core (= 2.0.0.beta.8)
75
+ rspec-expectations (= 2.0.0.beta.8)
76
+ rspec-mocks (= 2.0.0.beta.8)
77
+ rspec-core (2.0.0.beta.8)
78
+ rspec-expectations (2.0.0.beta.8)
79
+ rspec-mocks (2.0.0.beta.8)
80
+ text-format (1.0.0)
81
+ text-hyphen (~> 1.0.0)
82
+ text-hyphen (1.0.2)
83
+ thor (0.13.8)
84
+ treetop (1.4.9)
85
+ polyglot (>= 0.3.1)
86
+ tzinfo (0.3.27)
87
+
88
+ PLATFORMS
89
+ ruby
90
+
91
+ DEPENDENCIES
92
+ building-blocks
93
+ jeweler
94
+ rails
95
+ rcov
96
+ rspec
data/README.rdoc ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,59 @@
1
+ begin
2
+ # Rspec 1.3.0
3
+ require 'spec/rake/spectask'
4
+
5
+ desc 'Default: run specs'
6
+ task :default => :spec
7
+ Spec::Rake::SpecTask.new do |t|
8
+ t.spec_files = FileList["spec/**/*_spec.rb"]
9
+ end
10
+
11
+ Spec::Rake::SpecTask.new('rcov') do |t|
12
+ t.spec_files = FileList["spec/**/*_spec.rb"]
13
+ t.rcov = true
14
+ t.rcov_opts = ['--exclude', 'spec']
15
+ end
16
+
17
+ rescue LoadError
18
+ # Rspec 2.0
19
+ require 'rspec/core/rake_task'
20
+
21
+ desc 'Default: run specs'
22
+ task :default => :spec
23
+ Rspec::Core::RakeTask.new do |t|
24
+ t.pattern = "spec/**/*_spec.rb"
25
+ end
26
+
27
+ Rspec::Core::RakeTask.new('rcov') do |t|
28
+ t.pattern = "spec/**/*_spec.rb"
29
+ t.rcov = true
30
+ t.rcov_opts = ['--exclude', 'spec']
31
+ end
32
+
33
+ rescue LoadError
34
+ puts "Rspec not available. Install it with: gem install rspec"
35
+ end
36
+
37
+ namespace 'rails2.3' do
38
+ task :spec do
39
+ gemfile = File.join(File.dirname(__FILE__), 'lib', 'has_relationship', 'compatibility', 'Gemfile')
40
+ ENV['BUNDLE_GEMFILE'] = gemfile
41
+ Rake::Task['spec'].invoke
42
+ end
43
+ end
44
+
45
+ begin
46
+ require 'jeweler'
47
+ Jeweler::Tasks.new do |gemspec|
48
+ gemspec.name = "table-for"
49
+ gemspec.summary = ""
50
+ gemspec.description = ""
51
+ gemspec.email = "hunterae@gmail.com"
52
+ gemspec.homepage = "http://github.com/hunterae/table-for"
53
+ gemspec.authors = ["Andrew Hunter"]
54
+ gemspec.files = FileList["[A-Z]*", "{lib,spec,rails}/**/*"] - FileList["**/*.log"]
55
+ end
56
+ Jeweler::GemcutterTasks.new
57
+ rescue LoadError
58
+ puts "Jeweler not available. Install it with: gem install jeweler"
59
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/lib/table-for.rb ADDED
@@ -0,0 +1,13 @@
1
+ require "action_view"
2
+
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
4
+
5
+ require "table_for/table_for"
6
+ require "table_for/helper_methods"
7
+ require "table_for/engine"
8
+
9
+ $LOAD_PATH.shift
10
+
11
+ if defined?(ActionView::Base)
12
+ ActionView::Base.send :include, TableFor::HelperMethods
13
+ end
@@ -0,0 +1,7 @@
1
+ require "rails"
2
+
3
+ module TableFor
4
+ class Engine < Rails::Engine
5
+
6
+ end
7
+ end
@@ -0,0 +1,22 @@
1
+ module TableFor
2
+ module HelperMethods
3
+ def table_for_options(options={}, parameters={})
4
+ evaluated_options = {}
5
+ options.each_pair { |k, v| evaluated_options[k] = (v.is_a?(Proc) ? v.call(parameters) : v)}
6
+ evaluated_options
7
+ end
8
+
9
+ def table_for(records, options={}, &block)
10
+ options[:view] = self
11
+ options[:records] = records
12
+ options[:block] = block
13
+ options[:row_html] = {:class => lambda { |parameters| cycle('odd', 'even')}} if options[:row_html].nil?
14
+ options[:template] = "table_for/table_for"
15
+ options[:templates_folder] = "table_for"
16
+ options[:record_variable] = "records"
17
+ options[:variable] = "table"
18
+
19
+ TableFor::Base.new(options).render
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,12 @@
1
+ require 'building-blocks'
2
+
3
+ module TableFor
4
+ class Base < BuildingBlocks::Base
5
+ alias columns block_positions
6
+ alias column use
7
+
8
+ def header(name, options={}, &block)
9
+ define("#{name.to_s}_header", options, &block)
10
+ end
11
+ end
12
+ end
data/rails/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'table-for'
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: table-for
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Andrew Hunter
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-03 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ type: :runtime
24
+ name: rails
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ prerelease: false
37
+ type: :runtime
38
+ name: rspec
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ requirement: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ prerelease: false
51
+ type: :runtime
52
+ name: jeweler
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ requirement: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ prerelease: false
65
+ type: :runtime
66
+ name: rcov
67
+ version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ requirement: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ prerelease: false
79
+ type: :runtime
80
+ name: building-blocks
81
+ version_requirements: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ requirement: *id005
91
+ description: ""
92
+ email: hunterae@gmail.com
93
+ executables: []
94
+
95
+ extensions: []
96
+
97
+ extra_rdoc_files:
98
+ - README.rdoc
99
+ files:
100
+ - Gemfile
101
+ - Gemfile.lock
102
+ - README.rdoc
103
+ - Rakefile
104
+ - VERSION
105
+ - lib/table-for.rb
106
+ - lib/table_for/engine.rb
107
+ - lib/table_for/helper_methods.rb
108
+ - lib/table_for/table_for.rb
109
+ - rails/init.rb
110
+ has_rdoc: true
111
+ homepage: http://github.com/hunterae/table-for
112
+ licenses: []
113
+
114
+ post_install_message:
115
+ rdoc_options: []
116
+
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 0
127
+ version: "0"
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ hash: 3
134
+ segments:
135
+ - 0
136
+ version: "0"
137
+ requirements: []
138
+
139
+ rubyforge_project:
140
+ rubygems_version: 1.3.7
141
+ signing_key:
142
+ specification_version: 3
143
+ summary: ""
144
+ test_files: []
145
+