comma-heaven 0.6.1 → 0.7.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/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "activerecord", "< 3.0.0"
4
+ gem "actionpack", "< 3.0.0"
5
+ gem "fastercsv" unless RUBY_VERSION > "1.9"
6
+
7
+ group :development do
8
+ gem "rspec", ">= 1.2.9"
9
+ gem "rdoc", "~> 3.12"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.8.3"
12
+ gem 'simplecov', :require => false
13
+ gem 'sqlite3'
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,48 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionpack (2.3.14)
5
+ activesupport (= 2.3.14)
6
+ rack (~> 1.1.0)
7
+ activerecord (2.3.14)
8
+ activesupport (= 2.3.14)
9
+ activesupport (2.3.14)
10
+ diff-lcs (1.1.3)
11
+ git (1.2.5)
12
+ jeweler (1.8.3)
13
+ bundler (~> 1.0)
14
+ git (>= 1.2.5)
15
+ rake
16
+ rdoc
17
+ json (1.6.6)
18
+ multi_json (1.3.1)
19
+ rack (1.1.2)
20
+ rake (0.9.2.2)
21
+ rdoc (3.12)
22
+ json (~> 1.4)
23
+ rspec (2.9.0)
24
+ rspec-core (~> 2.9.0)
25
+ rspec-expectations (~> 2.9.0)
26
+ rspec-mocks (~> 2.9.0)
27
+ rspec-core (2.9.0)
28
+ rspec-expectations (2.9.1)
29
+ diff-lcs (~> 1.1.3)
30
+ rspec-mocks (2.9.0)
31
+ simplecov (0.6.1)
32
+ multi_json (~> 1.0)
33
+ simplecov-html (~> 0.5.3)
34
+ simplecov-html (0.5.3)
35
+ sqlite3 (1.3.5)
36
+
37
+ PLATFORMS
38
+ ruby
39
+
40
+ DEPENDENCIES
41
+ actionpack (< 3.0.0)
42
+ activerecord (< 3.0.0)
43
+ bundler (~> 1.0.0)
44
+ jeweler (~> 1.8.3)
45
+ rdoc (~> 3.12)
46
+ rspec (>= 1.2.9)
47
+ simplecov
48
+ sqlite3
data/Rakefile ADDED
@@ -0,0 +1,66 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "comma-heaven"
18
+ gem.summary = %Q{CSV exporter for Rails}
19
+ gem.description = %Q{CommaHeaven permits easy exports of Rails models to CSV}
20
+ gem.email = "silvano.stralla@sistrall.it"
21
+ gem.homepage = "http://github.com/sistrall/comma-heaven"
22
+ gem.authors = ["Silvano Stralla"]
23
+ gem.license = "MIT"
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ # gem 'rspec', '1.3.1'
29
+
30
+ require 'rdoc/task'
31
+ Rake::RDocTask.new do |rdoc|
32
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
33
+
34
+ rdoc.rdoc_dir = 'rdoc'
35
+ rdoc.title = "test #{version}"
36
+ rdoc.rdoc_files.include('README*')
37
+ rdoc.rdoc_files.include('lib/**/*.rb')
38
+ end
39
+
40
+ require 'rspec/core'
41
+ require 'rspec/core/rake_task'
42
+ RSpec::Core::RakeTask.new(:spec) do |spec|
43
+ spec.pattern = FileList['spec/**/*_spec.rb']
44
+ end
45
+
46
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
47
+ spec.pattern = 'spec/**/*_spec.rb'
48
+ spec.rcov = true
49
+ end
50
+
51
+ task :default => :spec
52
+
53
+ # require 'spec/rake/spectask'
54
+ # Spec::Rake::SpecTask.new(:spec) do |spec|
55
+ # spec.libs << 'lib' << 'spec'
56
+ # spec.spec_files = FileList['spec/**/*_spec.rb']
57
+ # end
58
+
59
+ # Spec::Rake::SpecTask.new(:rcov) do |spec|
60
+ # spec.libs << 'lib' << 'spec'
61
+ # spec.pattern = 'spec/**/*_spec.rb'
62
+ # spec.rcov = true
63
+ # end
64
+
65
+ # task :spec => :check_dependencies
66
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.7.0
@@ -0,0 +1,88 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "comma-heaven"
8
+ s.version = "0.7.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Silvano Stralla"]
12
+ s.date = "2012-04-17"
13
+ s.description = "CommaHeaven permits easy exports of Rails models to CSV"
14
+ s.email = "silvano.stralla@sistrall.it"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "comma-heaven.gemspec",
28
+ "init.rb",
29
+ "lib/comma-heaven.rb",
30
+ "lib/comma-heaven/active_record/to_comma_heaven.rb",
31
+ "lib/comma-heaven/export.rb",
32
+ "lib/comma-heaven/sqler.rb",
33
+ "lib/comma-heaven/sqler/association_columns.rb",
34
+ "lib/comma-heaven/sqler/belongs_to_columns.rb",
35
+ "lib/comma-heaven/sqler/column.rb",
36
+ "lib/comma-heaven/sqler/columns.rb",
37
+ "lib/comma-heaven/sqler/has_many_columns.rb",
38
+ "lib/comma-heaven/sqler/has_one_columns.rb",
39
+ "spec/active_record/to_comma_heaven_spec.rb",
40
+ "spec/export_spec.rb",
41
+ "spec/spec.opts",
42
+ "spec/spec_helper.rb",
43
+ "spec/sqler/belongs_to_association_spec.rb",
44
+ "spec/sqler/column_spec.rb",
45
+ "spec/sqler/columns_spec.rb",
46
+ "spec/sqler/has_many_columns_spec.rb",
47
+ "spec/sqler/has_one_association_spec.rb"
48
+ ]
49
+ s.homepage = "http://github.com/sistrall/comma-heaven"
50
+ s.licenses = ["MIT"]
51
+ s.require_paths = ["lib"]
52
+ s.rubygems_version = "1.8.13"
53
+ s.summary = "CSV exporter for Rails"
54
+
55
+ if s.respond_to? :specification_version then
56
+ s.specification_version = 3
57
+
58
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
59
+ s.add_runtime_dependency(%q<activerecord>, ["< 3.0.0"])
60
+ s.add_runtime_dependency(%q<actionpack>, ["< 3.0.0"])
61
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
62
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
63
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
64
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
65
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
66
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
67
+ else
68
+ s.add_dependency(%q<activerecord>, ["< 3.0.0"])
69
+ s.add_dependency(%q<actionpack>, ["< 3.0.0"])
70
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
71
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
72
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
73
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
74
+ s.add_dependency(%q<simplecov>, [">= 0"])
75
+ s.add_dependency(%q<sqlite3>, [">= 0"])
76
+ end
77
+ else
78
+ s.add_dependency(%q<activerecord>, ["< 3.0.0"])
79
+ s.add_dependency(%q<actionpack>, ["< 3.0.0"])
80
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
81
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
82
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
83
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
84
+ s.add_dependency(%q<simplecov>, [">= 0"])
85
+ s.add_dependency(%q<sqlite3>, [">= 0"])
86
+ end
87
+ end
88
+
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require "comma-heaven"
@@ -1,3 +1,5 @@
1
+ require 'ostruct'
2
+
1
3
  module CommaHeaven
2
4
  class Export
3
5
  module Implementation
@@ -1,6 +1,12 @@
1
1
  module CommaHeaven
2
2
  module Sqler
3
3
  class BelongsToColumns < AssociationColumns
4
+ def join_clause
5
+ <<-EOS
6
+ LEFT JOIN #{quote(table)} AS #{table_alias}
7
+ ON #{table_alias}.#{model.primary_key} = #{parent.table_alias}.#{association.primary_key_name}
8
+ EOS
9
+ end
4
10
  end
5
11
  end
6
12
  end
@@ -1,42 +1,17 @@
1
+ require 'active_support/core_ext'
2
+
1
3
  module CommaHeaven
2
4
  module Sqler
3
5
  class Column < Struct.new(:parent, :position, :attribute, :as)
4
- delegate :association, :model, :table, :table_alias, :index, :to => :parent
6
+ delegate :association, :model, :table, :table_alias, :index, :join_clause, :to => :parent
5
7
 
6
8
  def select
7
9
  "#{table_alias}.#{attribute} AS #{quote(sql_as)}"
8
10
  end
9
11
 
10
12
  def joins
11
- sql = case parent
12
- when HasManyColumns
13
- if parent.options[:by] == 'row'
14
- <<-EOS
15
- LEFT JOIN #{quote(table)} AS #{table_alias}
16
- ON #{parent.parent.table_alias}.#{model.primary_key} = #{table_alias}.#{association.primary_key_name}
17
- EOS
18
- else
19
- <<-EOS
20
- LEFT JOIN #{quote(table)} AS #{table_alias}
21
- ON #{parent.parent.table_alias}.#{model.primary_key} = #{table_alias}.#{association.primary_key_name}
22
- AND #{table_alias}.#{association.klass.primary_key} = (SELECT #{association.klass.primary_key} FROM #{association.quoted_table_name} WHERE #{association.primary_key_name} = #{parent.parent.table_alias}.#{model.primary_key} LIMIT #{index}, 1)
23
- EOS
24
- end
25
- when BelongsToColumns
26
- <<-EOS
27
- LEFT JOIN #{quote(table)} AS #{table_alias}
28
- ON #{table_alias}.#{model.primary_key} = #{parent.parent.table_alias}.#{association.primary_key_name}
29
- EOS
30
- when HasOneColumns
31
- <<-EOS
32
- LEFT JOIN #{quote(table)} AS #{table_alias}
33
- ON #{parent.parent.table_alias}.#{model.primary_key} = #{table_alias}.#{association.primary_key_name}
34
- EOS
35
- else ''
36
- end
37
-
13
+ sql = join_clause
38
14
  sql << " AND #{table_alias}.#{association.klass.primary_key} IN (SELECT #{association.klass.primary_key} FROM #{association.quoted_table_name} WHERE #{model.send(:sanitize_sql, association.options[:conditions])})" if parent.respond_to?(:association) && association.options[:conditions]
39
-
40
15
  sql.gsub(/\n/, '').squeeze(' ').strip
41
16
  end
42
17
 
@@ -47,7 +47,15 @@ module CommaHeaven
47
47
  end
48
48
  end
49
49
 
50
+ def join_clause
51
+ ''
52
+ end
53
+
50
54
  protected
55
+ def quote(string)
56
+ ::ActiveRecord::Base.connection.quote_column_name(string)
57
+ end
58
+
51
59
  def limit
52
60
  (options[:limit] || 1).to_i
53
61
  end
@@ -1,6 +1,42 @@
1
1
  module CommaHeaven
2
2
  module Sqler
3
- class HasManyColumns < AssociationColumns
3
+ class HasManyColumns < AssociationColumns
4
+ def join_clause
5
+ # @:through@ relantionships requires special treatment:
6
+ # the JOIN must walk through 2 table
7
+ join = if association.options[:through]
8
+ <<-EOS
9
+ LEFT JOIN #{association.through_reflection.table_name} AS _#{association.through_reflection.table_name}#{table_alias}
10
+ ON #{parent.table_alias}.#{model.primary_key} = _#{association.through_reflection.table_name}#{table_alias}.#{association.primary_key_name}
11
+ LEFT JOIN #{quote(table)} AS #{table_alias}
12
+ ON _#{association.through_reflection.table_name}#{table_alias}.#{model.primary_key} = #{table_alias}.#{association.through_reflection.association_foreign_key}
13
+ EOS
14
+ else
15
+ <<-EOS
16
+ LEFT JOIN #{quote(table)} AS #{table_alias}
17
+ ON #{parent.table_alias}.#{model.primary_key} = #{table_alias}.#{association.primary_key_name}
18
+ EOS
19
+ end
20
+
21
+ unless options[:by] == 'row'
22
+ join += ' ' + if association.options[:through]
23
+ <<-EOS
24
+ AND #{table_alias}.#{association.klass.primary_key} =
25
+ ( SELECT #{association.quoted_table_name}.#{association.klass.primary_key}
26
+ FROM #{association.quoted_table_name}
27
+ JOIN #{association.through_reflection.table_name} ON #{association.quoted_table_name}.#{association.through_reflection.association_foreign_key} = #{association.through_reflection.table_name}.#{association.through_reflection.klass.primary_key}
28
+ WHERE #{association.primary_key_name} = #{parent.table_alias}.#{model.primary_key}
29
+ LIMIT #{index}, 1 )
30
+ EOS
31
+ else
32
+ <<-EOS
33
+ AND #{table_alias}.#{association.klass.primary_key} = (SELECT #{association.klass.primary_key} FROM #{association.quoted_table_name} WHERE #{association.primary_key_name} = #{parent.table_alias}.#{model.primary_key} LIMIT #{index}, 1)
34
+ EOS
35
+ end
36
+ end
37
+
38
+ join
39
+ end
4
40
  end
5
41
  end
6
42
  end
@@ -1,6 +1,12 @@
1
1
  module CommaHeaven
2
2
  module Sqler
3
3
  class HasOneColumns < AssociationColumns
4
+ def join_clause
5
+ <<-EOS
6
+ LEFT JOIN #{quote(table)} AS #{table_alias}
7
+ ON #{parent.table_alias}.#{model.primary_key} = #{table_alias}.#{association.primary_key_name}
8
+ EOS
9
+ end
4
10
  end
5
11
  end
6
12
  end
data/lib/comma-heaven.rb CHANGED
@@ -4,6 +4,8 @@ if RUBY_VERSION > "1.9"
4
4
  FasterCSV = CSV
5
5
  end
6
6
 
7
+ require 'active_record'
8
+
7
9
  require 'comma-heaven/active_record/to_comma_heaven'
8
10
  require 'comma-heaven/sqler'
9
11
  require 'comma-heaven/sqler/column'
@@ -165,7 +165,9 @@ EOS
165
165
  end
166
166
 
167
167
  it "should manage nested associations" do
168
- Leaf.to_comma_heaven(:export => {:position => {0 => {}}, :tree => {1 => {:export => {:name => {2 => {}}, :gardener => {3 => {:export => {:name => {4 => {}}}}}}}}}).to_csv.should == <<-EOS
168
+ Leaf.to_comma_heaven(:export => { :position => {0 => {}},
169
+ :tree => {1 => {:export => { :name => {2 => {}},
170
+ :gardener => {3 => {:export => {:name => {4 => {}}}}}}}}}).to_csv.should == <<-EOS
169
171
  leaf_position,tree_name,tree_gardener_name
170
172
  top,Olmo,Alice
171
173
  middle,Olmo,Alice
@@ -175,6 +177,32 @@ bottom,Olmo,Alice
175
177
  EOS
176
178
  end
177
179
 
180
+ it 'should manage has_many :through associations (exporting by row)' do
181
+ Gardener.to_comma_heaven(:export => { :name => {0 => {}},
182
+ :leafs => {1 => { :by => 'row',
183
+ :limit => 10,
184
+ :export => { :position => {0 => {}},
185
+ :height_from_ground => {1 => {}}}}}}).to_csv.should == <<-EOS
186
+ gardener_name,leaf_position,leaf_height_from_ground
187
+ Alice,bottom,
188
+ Alice,middle,
189
+ Alice,top,
190
+ Bob,0,1.0
191
+ Bob,5,2.0
192
+ EOS
193
+ end
194
+
195
+ it 'should manage has_many :through associations (exporting by row)' do
196
+ Gardener.to_comma_heaven(:export => { :name => {0 => {}},
197
+ :leafs => {1 => { :limit => 3,
198
+ :export => { :position => {0 => {}},
199
+ :height_from_ground => {1 => {}}}}}}).to_csv.should == <<-EOS
200
+ gardener_name,leaf_0_position,leaf_0_height_from_ground,leaf_1_position,leaf_1_height_from_ground,leaf_2_position,leaf_2_height_from_ground
201
+ Alice,top,,middle,,bottom,
202
+ Bob,0,1.0,5,2.0,,
203
+ EOS
204
+ end
205
+
178
206
  it "should allow to rename column on export" do
179
207
  Tree.to_comma_heaven(:export => {:name => {0 => {:as => 'Name'}}, :age => {1 => {:as => 'Age'}}, :leafs => {2 => {:export => {:position => {3 => {:as => 'Position %i'}}}, :limit => 2}}}).to_csv.should == <<-EOS
180
208
  Name,Age,Position 0,Position 1
@@ -204,9 +232,9 @@ EOS
204
232
  it "should allow denormalized export (also called 'by row')" do
205
233
  Tree.to_comma_heaven(:export => {:name => {0 => {:include => '1', :as => ''}}, :age => {1 => {:include => '0', :as => ''}}, :leafs => {2 => {:export => {:position => {4 => {:include => '1', :as => ''}}}, :by => 'row', :limit => 3}}}).to_csv.should == <<-EOS
206
234
  tree_name,leaf_position
207
- Olmo,top
208
- Olmo,middle
209
235
  Olmo,bottom
236
+ Olmo,middle
237
+ Olmo,top
210
238
  Ulivo,0
211
239
  Ulivo,5
212
240
  EOS
@@ -215,18 +243,18 @@ EOS
215
243
  it "should allow denormalized export (also called 'by row')" do
216
244
  Tree.to_comma_heaven(:export => {:name => {0 => {:include => '1', :as => ''}}, :age => {1 => {:include => '0', :as => ''}}, :leafs => {2 => {:export => {:position => {4 => {:include => '1', :as => ''}}}, :by => 'row', :limit => 3}}}).to_csv.should == <<-EOS
217
245
  tree_name,leaf_position
218
- Olmo,top
219
- Olmo,middle
220
246
  Olmo,bottom
247
+ Olmo,middle
248
+ Olmo,top
221
249
  Ulivo,0
222
250
  Ulivo,5
223
251
  EOS
224
252
 
225
253
  Tree.to_comma_heaven(:export => {:name => {0 => {}}, :gardener => {1 => {:export => {:name => {2 => {}}, :surname => {3 => {}}}}}, :leafs => {4 => {:export => {:position => {5 => {}}}, :by => 'row', :limit => 2}}}).to_csv.should == <<-EOS
226
254
  tree_name,gardener_name,gardener_surname,leaf_position
227
- Olmo,Alice,,top
228
- Olmo,Alice,,middle
229
255
  Olmo,Alice,,bottom
256
+ Olmo,Alice,,middle
257
+ Olmo,Alice,,top
230
258
  Ulivo,Bob,,0
231
259
  Ulivo,Bob,,5
232
260
  EOS
data/spec/spec_helper.rb CHANGED
@@ -1,25 +1,16 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+
1
4
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
5
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
- require 'rubygems'
4
- require RUBY_VERSION > "1.9" ? "csv" : 'fastercsv'
5
-
6
- require 'activerecord'
7
-
8
- require 'active_support'
9
- require 'actionpack'
10
- require 'action_controller'
11
- require 'action_view'
12
6
 
7
+ require 'rspec'
13
8
  require 'comma-heaven'
14
9
 
15
- require 'spec'
16
- require 'spec/autorun'
17
-
18
10
  ENV['TZ'] = 'UTC'
19
11
  Time.zone = 'Eastern Time (US & Canada)'
20
12
 
21
13
  ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
22
- # ActiveRecord::Base.establish_connection(:adapter => 'mysql', :database => 'comma_heaven_dev', :encoding => 'utf8', :username => 'root', :password => '')
23
14
  ActiveRecord::Base.configurations = true
24
15
 
25
16
  ActiveRecord::Schema.verbose = false
@@ -57,10 +48,11 @@ ActiveRecord::Schema.define(:version => 1) do
57
48
  end
58
49
  end
59
50
 
60
- Spec::Runner.configure do |config|
51
+ RSpec.configure do |config|
61
52
  config.before(:each) do
62
53
  class Gardener < ActiveRecord::Base
63
54
  has_many :trees
55
+ has_many :leafs, :through => :trees
64
56
  has_one :gardener_clone
65
57
  end
66
58
 
@@ -22,6 +22,25 @@ describe "HasManyColumns" do
22
22
  LEFT JOIN "leafs" AS _leafs_1
23
23
  ON trees.id = _leafs_1.tree_id
24
24
  AND _leafs_1.id = (SELECT id FROM "leafs" WHERE tree_id = trees.id LIMIT 1, 1)
25
+ EOS
26
+ end
27
+
28
+ it 'should build correct SQL joins clause for has_many :through relationship' do
29
+ @gardener = CommaHeaven::Sqler::Columns.new(Gardener, { :name => {0 => {}},
30
+ :leafs => {1 => {:export => {
31
+ :position => {0 => {}},
32
+ :height_from_ground => {1 => {}} } } } })
33
+ column = CommaHeaven::Sqler::HasManyColumns.new(Gardener.reflect_on_association(:leafs), {:position => {4 => {:include => '1', :as => ''}}}, 1, @gardener, 0, :limit => '3')
34
+ column.joins.should == <<-EOS.gsub(/\n/, ' ').squeeze(' ').strip
35
+ LEFT JOIN trees AS _trees_leafs_0
36
+ ON gardeners.id = _trees_leafs_0.gardener_id
37
+ LEFT JOIN "leafs" AS _leafs_0
38
+ ON _trees_leafs_0.id = _leafs_0.tree_id
39
+ AND _leafs_0.id =
40
+ ( SELECT "leafs".id
41
+ FROM "leafs"
42
+ JOIN trees ON "leafs".tree_id = trees.id
43
+ WHERE gardener_id = gardeners.id LIMIT 0, 1 )
25
44
  EOS
26
45
  end
27
46
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: comma-heaven
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.6.1
5
+ version: 0.7.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Silvano Stralla
@@ -10,42 +10,96 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-17 00:00:00 +02:00
14
- default_executable:
13
+ date: 2012-04-17 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
- name: rspec
18
- prerelease: false
16
+ name: activerecord
19
17
  requirement: &id001 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: actionpack
28
+ requirement: &id002 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - <
32
+ - !ruby/object:Gem::Version
33
+ version: 3.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: rspec
39
+ requirement: &id003 !ruby/object:Gem::Requirement
20
40
  none: false
21
41
  requirements:
22
42
  - - ">="
23
43
  - !ruby/object:Gem::Version
24
44
  version: 1.2.9
25
45
  type: :development
26
- version_requirements: *id001
46
+ prerelease: false
47
+ version_requirements: *id003
27
48
  - !ruby/object:Gem::Dependency
28
- name: activerecord
49
+ name: rdoc
50
+ requirement: &id004 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: "3.12"
56
+ type: :development
29
57
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
58
+ version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: bundler
61
+ requirement: &id005 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: 1.0.0
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: *id005
70
+ - !ruby/object:Gem::Dependency
71
+ name: jeweler
72
+ requirement: &id006 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.8.3
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *id006
81
+ - !ruby/object:Gem::Dependency
82
+ name: simplecov
83
+ requirement: &id007 !ruby/object:Gem::Requirement
31
84
  none: false
32
85
  requirements:
33
86
  - - ">="
34
87
  - !ruby/object:Gem::Version
35
88
  version: "0"
36
- type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: actionpack
89
+ type: :development
40
90
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
91
+ version_requirements: *id007
92
+ - !ruby/object:Gem::Dependency
93
+ name: sqlite3
94
+ requirement: &id008 !ruby/object:Gem::Requirement
42
95
  none: false
43
96
  requirements:
44
97
  - - ">="
45
98
  - !ruby/object:Gem::Version
46
99
  version: "0"
47
- type: :runtime
48
- version_requirements: *id003
100
+ type: :development
101
+ prerelease: false
102
+ version_requirements: *id008
49
103
  description: CommaHeaven permits easy exports of Rails models to CSV
50
104
  email: silvano.stralla@sistrall.it
51
105
  executables: []
@@ -56,6 +110,15 @@ extra_rdoc_files:
56
110
  - LICENSE
57
111
  - README.rdoc
58
112
  files:
113
+ - .document
114
+ - Gemfile
115
+ - Gemfile.lock
116
+ - LICENSE
117
+ - README.rdoc
118
+ - Rakefile
119
+ - VERSION
120
+ - comma-heaven.gemspec
121
+ - init.rb
59
122
  - lib/comma-heaven.rb
60
123
  - lib/comma-heaven/active_record/to_comma_heaven.rb
61
124
  - lib/comma-heaven/export.rb
@@ -75,12 +138,9 @@ files:
75
138
  - spec/sqler/columns_spec.rb
76
139
  - spec/sqler/has_many_columns_spec.rb
77
140
  - spec/sqler/has_one_association_spec.rb
78
- - LICENSE
79
- - README.rdoc
80
- has_rdoc: true
81
141
  homepage: http://github.com/sistrall/comma-heaven
82
- licenses: []
83
-
142
+ licenses:
143
+ - MIT
84
144
  post_install_message:
85
145
  rdoc_options: []
86
146
 
@@ -91,6 +151,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
151
  requirements:
92
152
  - - ">="
93
153
  - !ruby/object:Gem::Version
154
+ hash: 1320719460774893281
155
+ segments:
156
+ - 0
94
157
  version: "0"
95
158
  required_rubygems_version: !ruby/object:Gem::Requirement
96
159
  none: false
@@ -101,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
164
  requirements: []
102
165
 
103
166
  rubyforge_project:
104
- rubygems_version: 1.6.1
167
+ rubygems_version: 1.8.13
105
168
  signing_key:
106
169
  specification_version: 3
107
170
  summary: CSV exporter for Rails