acts_as_xlsx 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md ADDED
File without changes
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "http://rubygems.org"
2
+ gem 'axlsx', '>= 1.0.10'
3
+ gem 'activerecord', '>= 2.3.9'
4
+ gem 'i18n', '>= 0.6.0'
5
+ gem 'rake', '>= 0.9.2'
6
+ gem 'yard'
7
+ gem 'rdiscount'
8
+ gem 'sqlite3'
data/Gemfile.lock ADDED
@@ -0,0 +1,32 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activerecord (2.3.9)
5
+ activesupport (= 2.3.9)
6
+ activesupport (2.3.9)
7
+ axlsx (1.0.10)
8
+ activesupport (>= 2.3.9)
9
+ i18n (>= 0.6.0)
10
+ nokogiri (>= 1.4.1)
11
+ rmagick (>= 2.12.2)
12
+ zip (>= 2.0.2)
13
+ i18n (0.6.0)
14
+ nokogiri (1.5.0)
15
+ rake (0.9.2)
16
+ rdiscount (1.6.8)
17
+ rmagick (2.13.1)
18
+ sqlite3 (1.3.4)
19
+ yard (0.7.3)
20
+ zip (2.0.2)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ activerecord (>= 2.3.9)
27
+ axlsx (>= 1.0.10)
28
+ i18n (>= 0.6.0)
29
+ rake (>= 0.9.2)
30
+ rdiscount
31
+ sqlite3
32
+ yard
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2011 Randy Morgan
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,95 @@
1
+ Acts as xlsx: Office Open XML Spreadsheet Generation plugin for active record
2
+ ====================================
3
+ [![Build Status](https://secure.travis-ci.org/randym/acts_as_xlsx.png)](http://travis-ci.org/randym/acts_as_xlsx/)
4
+
5
+ **IRC**: [irc.freenode.net / #axlsx](irc://irc.freenode.net/axlsx)
6
+ **Git**: [http://github.com/randym/acts_as_xlsx](http://github.com/randym/acts_as_xlsx)
7
+ **Author**: Randy Morgan
8
+ **Copyright**: 2011
9
+ **License**: MIT License
10
+ **Latest Version**: 1.0.0
11
+ **Ruby Version**: 1.8.7 - 1.9.3
12
+ **Release Date**: November 30th 2011
13
+
14
+ Synopsis
15
+ --------
16
+
17
+ Acts_as_xlsx is an active record plugin for Axlsx. It makes generating excel spreadsheets from any subclass of ActiveRecord::Base as simple as a couple of lines of code.
18
+
19
+ Feature List
20
+ ------------
21
+
22
+ **1. Mixes into active record base to provide to_xlsx methods on both class and instance active record inheritors.
23
+
24
+ **2. Can work at the end of any series of finder methods.
25
+
26
+ **3. Can accept any set of find options
27
+
28
+ **4. Automates localization of column heading with i18n support
29
+
30
+ **5. Lets you specify columns to exclude from the report.
31
+
32
+ **6. Gives you access to the axlsx package so you can add styles, charts and pictures to satisfy those flashy sales guys.
33
+
34
+ **7. Plays nicely with both ruby 1.8.7 + rails 2.3 as well as ruby 1.9.3 + rails 3
35
+
36
+ Installing
37
+ ----------
38
+
39
+ To install, use the following command:
40
+
41
+ $ gem install acts_as_xlsx
42
+
43
+ Usage
44
+ -----
45
+
46
+ ###Examples
47
+
48
+ A trivial rails example
49
+
50
+ #Add the gem to your Gemfile and bundle install
51
+ gem 'acts_as_xlsx'
52
+
53
+ # app/models/post.rb
54
+ class Post < ActiveRecord::Base
55
+ acts_as_xlsx
56
+ end
57
+
58
+ # app/controllers/posts_controller.rb
59
+ class PostsController < ApplicationController
60
+ # GET posts/xlsx
61
+ def xlsx
62
+ p = Post.to_xlsx
63
+ p.serialize('public/downloads/posts.xlsx')
64
+ send_file 'public/downloads/posts.xlsx', :type=>"application/xlsx"
65
+ end
66
+ end
67
+
68
+ Specify columns and methods and i18n chain
69
+ p = Post.to_xlsx :columns => [:name, :title, :ranking], :i18n => 'activerecord.attributes'
70
+
71
+ ###Documentation
72
+
73
+ This gem is 100% documented with YARD, an exceptional documentation library. To see documentation for this, and all the gems installed on your system use:
74
+
75
+ gem install yard
76
+ yard server -g
77
+
78
+
79
+ ###Specs
80
+
81
+ This gem has 100% coverage using Test::Unit
82
+
83
+ Changelog
84
+ ---------
85
+ - **October.30.11**: 1.0.0a release
86
+ - First pre release
87
+
88
+ Please see the {file:CHANGELOG.md} document for past release information.
89
+
90
+
91
+ Copyright
92
+ ---------
93
+
94
+ Acts_as_xlsx &copy; 2011 by [Randy Morgan](mailto:digial.ipseity@gmail.com). Acts_as_xlsx is
95
+ licensed under the MIT license. Please see the {file:LICENSE} document for more information.
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ task :build => :gendoc do
2
+ system "gem build acts_as_xlsx.gemspec"
3
+ end
4
+
5
+ task :gendoc do
6
+ system "yardoc"
7
+ end
8
+
9
+ task :test do
10
+ require 'rake/testtask'
11
+ Rake::TestTask.new do |t|
12
+ t.libs << 'test'
13
+ t.test_files = FileList['test/**/tc_*.rb']
14
+ t.verbose = true
15
+ end
16
+ end
17
+
18
+ task :default => :test
@@ -0,0 +1,38 @@
1
+ require 'rake'
2
+ acts_as_xlsx_version = "1.0.0"
3
+ Gem::Specification.new do |s|
4
+ s.name = 'acts_as_xlsx'
5
+ s.version = acts_as_xlsx_version
6
+ s.author = "Randy Morgan"
7
+ s.email = 'digital.ipseity@gmail.com'
8
+ s.homepage = 'https://github.com/randym/acts_as_xlsx'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.date = Time.now.strftime('%Y-%m-%d')
11
+ s.summary = "ActiveRecord support for Axlsx"
12
+ s.has_rdoc = 'acts_as_xlsx'
13
+ s.description = <<-eof
14
+ acts_as_xlsx lets you turn any ActiveRecord::Base inheriting class into an excel spreadsheet.
15
+ eof
16
+ # s.files = Dir.glob("{doc,lib,test,schema,examples}/**/*") + %w{ LICENSE README.md Rakefile CHANGELOG.md }
17
+
18
+ s.files = FileList.new('*', 'lib/**/*', 'doc/**/*', 'test/**/*', 'examples/**/*') do |fl|
19
+ fl.exclude("*.*~")
20
+ fl.exclude(".*")
21
+ fl.exclude("todo")
22
+ fl.exclude("*.gem")
23
+ fl.exclude("*.xlsx")
24
+ end
25
+
26
+ s.add_runtime_dependency 'axlsx', '>= 1.0.10'
27
+ s.add_runtime_dependency 'activerecord', '>= 2.3.9'
28
+ s.add_runtime_dependency 'i18n', '>=0.6.0'
29
+
30
+ # required for yard documentation generation
31
+ s.add_runtime_dependency 'yard'
32
+ s.add_runtime_dependency 'rdiscount'
33
+
34
+ # required for running tests
35
+ s.add_development_dependency 'sqlite3'
36
+ s.add_development_dependency 'rake', '>= 0.9.2'
37
+
38
+ end
data/doc/Axlsx.html ADDED
@@ -0,0 +1,124 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Axlsx
8
+
9
+ &mdash; Acts As Xlsx (Axlsx)
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html">Index (A)</a> &raquo;
37
+
38
+
39
+ <span class="title">Axlsx</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Module: Axlsx
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dt class="r1 last">Defined in:</dt>
75
+ <dd class="r1 last">lib/axlsx/acts_as_xlsx.rb</dd>
76
+
77
+ </dl>
78
+ <div class="clear"></div>
79
+
80
+ <h2>Overview</h2><div class="docstring">
81
+ <div class="discussion">
82
+
83
+ <p>Adding to the Axlsx module</p>
84
+
85
+
86
+ </div>
87
+ </div>
88
+ <div class="tags">
89
+
90
+
91
+ <h3>See Also:</h3>
92
+ <ul class="see">
93
+
94
+ <li><a href="http://github.com/randym/axlsx" target="_parent" title="http://github.com/randym/axlsx">http://github.com/randym/axlsx</a></li>
95
+
96
+ </ul>
97
+
98
+ </div><h2>Defined Under Namespace</h2>
99
+ <p class="children">
100
+
101
+
102
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Axlsx/Ar.html" title="Axlsx::Ar (module)">Ar</a></span>
103
+
104
+
105
+
106
+
107
+ </p>
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ </div>
116
+
117
+ <div id="footer">
118
+ Generated on Thu Dec 1 00:04:39 2011 by
119
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
120
+ 0.7.3 (ruby-1.9.3).
121
+ </div>
122
+
123
+ </body>
124
+ </html>
data/doc/Axlsx/Ar.html ADDED
@@ -0,0 +1,199 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Axlsx::Ar
8
+
9
+ &mdash; Acts As Xlsx (Axlsx)
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '..';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="../_index.html">Index (A)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../Axlsx.html" title="Axlsx (module)">Axlsx</a></span></span>
38
+ &raquo;
39
+ <span class="title">Ar</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Module: Axlsx::Ar
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dt class="r1 last">Defined in:</dt>
75
+ <dd class="r1 last">lib/axlsx/acts_as_xlsx.rb</dd>
76
+
77
+ </dl>
78
+ <div class="clear"></div>
79
+
80
+ <h2>Overview</h2><div class="docstring">
81
+ <div class="discussion">
82
+
83
+ <h3>Overview</h3>
84
+
85
+ <p>This module defines the acts_as_xlsx class method and provides to_xlsx
86
+ support to both AR classes and instances</p>
87
+
88
+
89
+ </div>
90
+ </div>
91
+ <div class="tags">
92
+
93
+
94
+ </div><h2>Defined Under Namespace</h2>
95
+ <p class="children">
96
+
97
+
98
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Ar/ClassMethods.html" title="Axlsx::Ar::ClassMethods (module)">ClassMethods</a></span>, <span class='object_link'><a href="Ar/SingletonMethods.html" title="Axlsx::Ar::SingletonMethods (module)">SingletonMethods</a></span>
99
+
100
+
101
+
102
+
103
+ </p>
104
+
105
+
106
+
107
+
108
+
109
+
110
+ <h2>
111
+ Class Method Summary
112
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
113
+ </h2>
114
+
115
+ <ul class="summary">
116
+
117
+ <li class="public ">
118
+ <span class="summary_signature">
119
+
120
+ <a href="#included-class_method" title="included (class method)">+ (Object) <strong>included</strong>(base) </a>
121
+
122
+
123
+
124
+ </span>
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+ <span class="summary_desc"><div class='inline'>
134
+ <p>:nodoc:.</p>
135
+ </div></span>
136
+
137
+ </li>
138
+
139
+
140
+ </ul>
141
+
142
+
143
+
144
+
145
+ <div id="class_method_details" class="method_details_list">
146
+ <h2>Class Method Details</h2>
147
+
148
+
149
+ <div class="method_details first">
150
+ <p class="signature first" id="included-class_method">
151
+
152
+ + (<tt>Object</tt>) <strong>included</strong>(base)
153
+
154
+
155
+
156
+ </p><div class="docstring">
157
+ <div class="discussion">
158
+
159
+ <p>:nodoc:</p>
160
+
161
+
162
+ </div>
163
+ </div>
164
+ <div class="tags">
165
+
166
+
167
+ </div><table class="source_code">
168
+ <tr>
169
+ <td>
170
+ <pre class="lines">
171
+
172
+
173
+ 14
174
+ 15
175
+ 16</pre>
176
+ </td>
177
+ <td>
178
+ <pre class="code"><span class="info file"># File 'lib/axlsx/acts_as_xlsx.rb', line 14</span>
179
+
180
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id included'>included</span><span class='lparen'>(</span><span class='id base'>base</span><span class='rparen'>)</span> <span class='comment'># :nodoc:
181
+ </span> <span class='id base'>base</span><span class='period'>.</span><span class='id send'>send</span> <span class='symbol'>:extend</span><span class='comma'>,</span> <span class='const'>ClassMethods</span>
182
+ <span class='kw'>end</span></pre>
183
+ </td>
184
+ </tr>
185
+ </table>
186
+ </div>
187
+
188
+ </div>
189
+
190
+ </div>
191
+
192
+ <div id="footer">
193
+ Generated on Thu Dec 1 00:04:39 2011 by
194
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
195
+ 0.7.3 (ruby-1.9.3).
196
+ </div>
197
+
198
+ </body>
199
+ </html>