dumpster 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -15,5 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
- spec/integration/csv/output/
19
- spec/integration/excel/output/
18
+ spec/integration/csv/output/*.csv
19
+ spec/integration/excel/output/*.xlsx
@@ -0,0 +1 @@
1
+ 1.9.3-p374
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - 1.9.3
@@ -0,0 +1,5 @@
1
+ 1. Fork dumpster
2
+ 2. Create a topic branch - `git checkout -b my_branch`
3
+ 3. Push to your branch - `git push origin my_branch`
4
+ 4. Send me a pull-request for your topic branch
5
+ 5. That's it!
data/README.md CHANGED
@@ -1,13 +1,17 @@
1
1
  # Dumpster
2
2
 
3
- Abstraktion für den Export von Daten in Tabellenform. Momentan werden die Formate
4
- CSV und XLSX unterstützt.
3
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/garaio/dumpster)
4
+ [![Build Status](https://travis-ci.org/senny/dumpster.png?branch=master)](https://travis-ci.org/senny/dumpster)
5
+
6
+ Abstraction layer to export tabular data. Currently dumpster supports XLSX and CSV exports.
5
7
 
6
8
  ## Installation
7
9
 
8
10
  Add this line to your application's Gemfile:
9
11
 
10
- gem 'dumpster'
12
+ ```ruby
13
+ gem 'dumpster'
14
+ ```
11
15
 
12
16
  Or install it yourself as:
13
17
 
@@ -26,10 +30,24 @@ writer = Dumpster.excel_writer(model)
26
30
  writer.write_to_file('/some/directory/some.file')
27
31
  ```
28
32
 
33
+ ### ActiveRecord
34
+
35
+ Dumpster ships with a `Dumpster::Model::ActiveRecordSql`. This model
36
+ allows you to execute arbitrary SQL through ActiveRecord to export the
37
+ result.
38
+
39
+ ```ruby
40
+ model = Dumpster::Model::ActiveRecordSql.new('SELECT * from users')
41
+
42
+ writer = Dumpster.csv_writer(model) # for CSV output
43
+ writer = Dumpster.excel_writer(model) # for Excel output
44
+
45
+ writer.write_to_file('/some/directory/some.file')
46
+ ```
47
+
29
48
  ## Contributing
30
49
 
31
- 1. Fork it
32
- 2. Create your feature branch (`git checkout -b my-new-feature`)
33
- 3. Commit your changes (`git commit -am 'Added some feature'`)
34
- 4. Push to the branch (`git push origin my-new-feature`)
35
- 5. Create new Pull Request
50
+ Please read the [contribution guidelines](CONTRIBUTING.md) before
51
+ submitting code.
52
+
53
+ [![githalytics.com alpha](https://cruel-carlota.pagodabox.com/3c3b77c78cbf66e966eb68440c8a992d "githalytics.com")](http://githalytics.com/senny/dumpster)
@@ -1,10 +1,10 @@
1
1
  module Dumpster
2
2
  module Model
3
- class Sql
3
+ class ActiveRecordSql
4
4
 
5
- def initialize(connection, sql)
6
- @connection = connection
5
+ def initialize(sql, connection = ActiveRecord::Base.connection)
7
6
  @sql = sql
7
+ @connection = connection
8
8
  end
9
9
 
10
10
  def each(&block)
@@ -1,3 +1,3 @@
1
1
  module Dumpster
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
File without changes
File without changes
@@ -3,7 +3,7 @@ require 'dumpster'
3
3
 
4
4
  describe Dumpster do
5
5
 
6
- let(:model) { stub }
6
+ let(:model) { double }
7
7
 
8
8
  context 'CSV' do
9
9
  it '#csv_writer erstellt einen CSV-Writer für das Model' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dumpster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-26 00:00:00.000000000 Z
12
+ date: 2013-10-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -67,6 +67,9 @@ extensions: []
67
67
  extra_rdoc_files: []
68
68
  files:
69
69
  - .gitignore
70
+ - .ruby-version
71
+ - .travis.yml
72
+ - CONTRIBUTING.md
70
73
  - Gemfile
71
74
  - LICENSE
72
75
  - README.md
@@ -78,7 +81,9 @@ files:
78
81
  - lib/dumpster/model/generic.rb
79
82
  - lib/dumpster/model/sql.rb
80
83
  - lib/dumpster/version.rb
84
+ - spec/integration/csv/output/.gitkeep
81
85
  - spec/integration/csv/writer_spec.rb
86
+ - spec/integration/excel/output/.gitkeep
82
87
  - spec/integration/excel/writer_spec.rb
83
88
  - spec/integration/spec_helper.rb
84
89
  - spec/unit/dumpster_spec.rb
@@ -97,20 +102,28 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
102
  - - ! '>='
98
103
  - !ruby/object:Gem::Version
99
104
  version: '0'
105
+ segments:
106
+ - 0
107
+ hash: 3773141393368528094
100
108
  required_rubygems_version: !ruby/object:Gem::Requirement
101
109
  none: false
102
110
  requirements:
103
111
  - - ! '>='
104
112
  - !ruby/object:Gem::Version
105
113
  version: '0'
114
+ segments:
115
+ - 0
116
+ hash: 3773141393368528094
106
117
  requirements: []
107
118
  rubyforge_project:
108
- rubygems_version: 1.8.21
119
+ rubygems_version: 1.8.23
109
120
  signing_key:
110
121
  specification_version: 3
111
122
  summary: Dumpster kann aufbereitete Daten in verschiedenen Formaten ausgeben
112
123
  test_files:
124
+ - spec/integration/csv/output/.gitkeep
113
125
  - spec/integration/csv/writer_spec.rb
126
+ - spec/integration/excel/output/.gitkeep
114
127
  - spec/integration/excel/writer_spec.rb
115
128
  - spec/integration/spec_helper.rb
116
129
  - spec/unit/dumpster_spec.rb