acts_as_xlsx 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,9 +7,9 @@ Acts as xlsx: Office Open XML Spreadsheet Generation plugin for active record
7
7
  **Author**: Randy Morgan
8
8
  **Copyright**: 2011
9
9
  **License**: MIT License
10
- **Latest Version**: 1.0.5
10
+ **Latest Version**: 1.0.6
11
11
  **Ruby Version**: 1.8.7 - 1.9.3
12
- **Release Date**: February 12th 2012
12
+ **Release Date**: July 27th 2012
13
13
 
14
14
  Synopsis
15
15
  --------
@@ -71,6 +71,9 @@ This gem has 100% coverage using Test::Unit
71
71
 
72
72
  Changelog
73
73
  ---------
74
+ - **July.27.12**: 1.0.6 release
75
+ - conditionaly register XLSX mime type
76
+
74
77
  - **February.14.12**: 1.0.5 release
75
78
  - acts_as_xlsx propery declares it's dependancy on i18n instead of relying on the parent gem.
76
79
 
@@ -1,8 +1,9 @@
1
1
  require 'acts_as_xlsx/ar.rb'
2
2
  begin
3
3
  # The mime type to be used in respond_to |format| style web-services in rails
4
- Mime::Type.register "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", :xlsx
4
+ unless defined? Mime::XLSX
5
+ Mime::Type.register "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", :xlsx
6
+ end
5
7
  rescue NameError
6
- puts "Mime module not defines. Skipping registration of xlsx"
8
+ puts "Mime module not defined. Skipping registration of xlsx"
7
9
  end
8
- #app.middleware.use ::ActionDispatch::Static, "#{root}/public"
@@ -59,7 +59,7 @@ module Axlsx
59
59
  header_style = p.workbook.styles.add_style(header_style) unless header_style.nil?
60
60
  i18n = self.xlsx_i18n == true ? 'activerecord.attributes' : i18n
61
61
  sheet_name = options.delete(:name) || (i18n ? I18n.t("#{i18n}.#{table_name.underscore}") : table_name.humanize)
62
- data = [*find(:all, options)]
62
+ data = options.delete(:data) || [*find(:all, options)]
63
63
  data.compact!
64
64
  data.flatten!
65
65
 
@@ -1,6 +1,6 @@
1
1
  module Axlsx
2
2
  module Ar
3
3
  # The current version of the gem
4
- VERSION = "1.0.5"
4
+ VERSION = "1.0.6"
5
5
  end
6
6
  end
Binary file
@@ -39,6 +39,14 @@ class TestToXlsx < Test::Unit::TestCase
39
39
  assert_equal("Id",p.workbook.worksheets.first.rows.first.cells.first.value)
40
40
  assert_equal(2,p.workbook.worksheets.first.rows.last.cells.first.value)
41
41
  end
42
+
43
+
44
+ def test_to_xslx_with_provided_data
45
+ p = Post.to_xlsx :data => Post.where(:title => "This is the first post").all
46
+ assert_equal("Id",p.workbook.worksheets.first.rows.first.cells.first.value)
47
+ assert_equal(1,p.workbook.worksheets.first.rows.last.cells.first.value)
48
+ end
49
+
42
50
 
43
51
  def test_columns
44
52
  p = Post.to_xlsx :columns => [:name, :title, :content, :votes]
@@ -61,6 +69,9 @@ class TestToXlsx < Test::Unit::TestCase
61
69
  assert_equal("Name", sheet.rows.first.cells.first.value)
62
70
  assert_equal(Post.last.comments.last.author.name, sheet.rows.last.cells.last.value)
63
71
  end
72
+
73
+
74
+
64
75
  end
65
76
 
66
77
 
metadata CHANGED
@@ -1,155 +1,155 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: acts_as_xlsx
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.6
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 5
10
- version: 1.0.5
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Randy Morgan
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-02-14 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-07-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: axlsx
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 13
29
- segments:
30
- - 1
31
- - 0
32
- - 13
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
33
21
  version: 1.0.13
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: activerecord
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 17
45
- segments:
46
- - 2
47
- - 3
48
- - 9
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.13
30
+ - !ruby/object:Gem::Dependency
31
+ name: activerecord
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
49
37
  version: 2.3.9
50
38
  type: :runtime
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: i18n
54
39
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
56
- none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 13
61
- segments:
62
- - 0
63
- - 4
64
- - 1
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 2.3.9
46
+ - !ruby/object:Gem::Dependency
47
+ name: i18n
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
65
53
  version: 0.4.1
66
54
  type: :runtime
67
- version_requirements: *id003
68
- - !ruby/object:Gem::Dependency
69
- name: rake
70
55
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
72
57
  none: false
73
- requirements:
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.4.1
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
74
67
  - - ~>
75
- - !ruby/object:Gem::Version
76
- hash: 25
77
- segments:
78
- - 0
79
- - 9
80
- version: "0.9"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.9'
81
70
  type: :development
82
- version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
- name: bundler
85
71
  prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
87
- none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 3
92
- segments:
93
- - 0
94
- version: "0"
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '0.9'
78
+ - !ruby/object:Gem::Dependency
79
+ name: bundler
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
95
86
  type: :development
96
- version_requirements: *id005
97
- - !ruby/object:Gem::Dependency
98
- name: sqlite3
99
87
  prerelease: false
100
- requirement: &id006 !ruby/object:Gem::Requirement
101
- none: false
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- hash: 3
106
- segments:
107
- - 0
108
- version: "0"
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: sqlite3
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 1.3.5
109
102
  type: :development
110
- version_requirements: *id006
111
- - !ruby/object:Gem::Dependency
112
- name: yard
113
103
  prerelease: false
114
- requirement: &id007 !ruby/object:Gem::Requirement
115
- none: false
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- hash: 3
120
- segments:
121
- - 0
122
- version: "0"
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.3.5
110
+ - !ruby/object:Gem::Dependency
111
+ name: yard
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
123
118
  type: :development
124
- version_requirements: *id007
125
- - !ruby/object:Gem::Dependency
126
- name: rdiscount
127
119
  prerelease: false
128
- requirement: &id008 !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"
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rdiscount
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
137
134
  type: :development
138
- version_requirements: *id008
139
- description: " acts_as_xlsx lets you turn any ActiveRecord::Base inheriting class into an excel spreadsheet.\n It can be added to any finder method or scope chain and can use localized column and sheet names with I18n.\n"
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ description: ! " acts_as_xlsx lets you turn any ActiveRecord::Base inheriting class
143
+ into an excel spreadsheet.\n It can be added to any finder method or scope chain
144
+ and can use localized column and sheet names with I18n.\n"
140
145
  email: digital.ipseity@gmail.com
141
146
  executables: []
142
-
143
147
  extensions: []
144
-
145
148
  extra_rdoc_files: []
146
-
147
- files:
149
+ files:
148
150
  - lib/acts_as_xlsx/ar.rb
149
151
  - lib/acts_as_xlsx/version.rb
150
- - lib/acts_as_xlsx/version.rb~
151
152
  - lib/acts_as_xlsx.rb
152
- - lib/acts_as_xlsx.rb~
153
153
  - LICENSE
154
154
  - README.md
155
155
  - Rakefile
@@ -158,49 +158,37 @@ files:
158
158
  - test/acts_as_xlsx.sqlite3.db
159
159
  - test/database.yml
160
160
  - test/helper.rb
161
- - test/helper.rb~
162
161
  - test/tc_acts_as_xlsx.rb
163
- - test/tc_acts_as_xlsx.rb~
164
162
  homepage: https://github.com/randym/acts_as_xlsx
165
163
  licenses: []
166
-
167
164
  post_install_message:
168
165
  rdoc_options: []
169
-
170
- require_paths:
166
+ require_paths:
171
167
  - lib
172
- required_ruby_version: !ruby/object:Gem::Requirement
168
+ required_ruby_version: !ruby/object:Gem::Requirement
173
169
  none: false
174
- requirements:
175
- - - ">="
176
- - !ruby/object:Gem::Version
177
- hash: 57
178
- segments:
179
- - 1
180
- - 8
181
- - 7
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
182
173
  version: 1.8.7
183
- required_rubygems_version: !ruby/object:Gem::Requirement
174
+ required_rubygems_version: !ruby/object:Gem::Requirement
184
175
  none: false
185
- requirements:
186
- - - ">="
187
- - !ruby/object:Gem::Version
188
- hash: 3
189
- segments:
176
+ requirements:
177
+ - - ! '>='
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ segments:
190
181
  - 0
191
- version: "0"
182
+ hash: 2121336211924629954
192
183
  requirements: []
193
-
194
184
  rubyforge_project:
195
- rubygems_version: 1.8.15
185
+ rubygems_version: 1.8.24
196
186
  signing_key:
197
187
  specification_version: 3
198
188
  summary: ActiveRecord support for Axlsx
199
- test_files:
189
+ test_files:
200
190
  - test/acts_as_xlsx.sqlite3.db
201
191
  - test/database.yml
202
192
  - test/helper.rb
203
- - test/helper.rb~
204
193
  - test/tc_acts_as_xlsx.rb
205
- - test/tc_acts_as_xlsx.rb~
206
194
  has_rdoc: acts_as_xlsx
File without changes
@@ -1,5 +0,0 @@
1
- module Axlsx
2
- module Ar
3
- version = "1.0.2"
4
- end
5
- end
@@ -1,9 +0,0 @@
1
- require 'acts_as_xlsx'
2
-
3
-
4
- def load_schema
5
- config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
6
- ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
7
- ActiveRecord::Base.establish_connection(config['sqlite3'])
8
- load(File.dirname(__FILE__) + "/schema.rb")
9
- end
File without changes