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 +5 -2
- data/lib/acts_as_xlsx.rb +4 -3
- data/lib/acts_as_xlsx/ar.rb +1 -1
- data/lib/acts_as_xlsx/version.rb +1 -1
- data/test/acts_as_xlsx.sqlite3.db +0 -0
- data/test/tc_acts_as_xlsx.rb +11 -0
- metadata +131 -143
- data/lib/acts_as_xlsx.rb~ +0 -0
- data/lib/acts_as_xlsx/version.rb~ +0 -5
- data/test/helper.rb~ +0 -9
- data/test/tc_acts_as_xlsx.rb~ +0 -0
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.
|
10
|
+
**Latest Version**: 1.0.6
|
11
11
|
**Ruby Version**: 1.8.7 - 1.9.3
|
12
|
-
**Release Date**:
|
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
|
|
data/lib/acts_as_xlsx.rb
CHANGED
@@ -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::
|
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
|
8
|
+
puts "Mime module not defined. Skipping registration of xlsx"
|
7
9
|
end
|
8
|
-
#app.middleware.use ::ActionDispatch::Static, "#{root}/public"
|
data/lib/acts_as_xlsx/ar.rb
CHANGED
@@ -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
|
|
data/lib/acts_as_xlsx/version.rb
CHANGED
Binary file
|
data/test/tc_acts_as_xlsx.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
19
|
-
|
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
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
-
|
40
|
-
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
56
|
-
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
87
|
-
none: false
|
88
|
-
requirements:
|
89
|
-
- -
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
-
|
101
|
-
none: false
|
102
|
-
requirements:
|
103
|
-
- -
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
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
|
-
|
115
|
-
none: false
|
116
|
-
requirements:
|
117
|
-
- -
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
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
|
-
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
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
|
-
|
139
|
-
|
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
|
-
|
189
|
-
segments:
|
176
|
+
requirements:
|
177
|
+
- - ! '>='
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
segments:
|
190
181
|
- 0
|
191
|
-
|
182
|
+
hash: 2121336211924629954
|
192
183
|
requirements: []
|
193
|
-
|
194
184
|
rubyforge_project:
|
195
|
-
rubygems_version: 1.8.
|
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
|
data/lib/acts_as_xlsx.rb~
DELETED
File without changes
|
data/test/helper.rb~
DELETED
@@ -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
|
data/test/tc_acts_as_xlsx.rb~
DELETED
File without changes
|