excel_rails 0.1.1 → 0.1.2

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/README CHANGED
@@ -65,6 +65,13 @@ In the above file excel_document yields a new Spreadsheet:Workbook object to the
65
65
  If you provide a :filename option to the excel_document method, a filename will be provided to the downloaded file.
66
66
  If your browser supports it you can inline the excel document as well.
67
67
 
68
+ If you provide :template_path - path to existed xls file, workbook will be loaded from the file.
69
+
70
+ excel_document(:filename => "report.xls", :template_path => "/tmp/report_template.xls") do |workbook|
71
+ sheet = workbook.worksheet 0
72
+ ... # any staff form previous example
73
+ end
74
+
68
75
  -- in the controller
69
76
 
70
77
  def index
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -1,47 +1,44 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{excel_rails}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aditya Sanghi"]
12
- s.date = %q{2010-11-15}
12
+ s.date = %q{2011-02-22}
13
13
  s.description = %q{Allows you to program spreadsheets using .rxls views}
14
14
  s.email = %q{asanghi@me.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README"
17
+ "README"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README",
24
- "Rakefile",
25
- "VERSION",
26
- "excel_rails.gemspec",
27
- "init.rb",
28
- "lib/excel_rails.rb",
29
- "rails/init.rb",
30
- "test/helper.rb",
31
- "test/test_excel_rails.rb"
21
+ "LICENSE",
22
+ "README",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "excel_rails.gemspec",
26
+ "init.rb",
27
+ "lib/excel_rails.rb",
28
+ "rails/init.rb",
29
+ "test/helper.rb",
30
+ "test/test_excel_rails.rb"
32
31
  ]
33
32
  s.homepage = %q{http://github.com/asanghi/excel_rails}
34
- s.rdoc_options = ["--charset=UTF-8"]
35
33
  s.require_paths = ["lib"]
36
- s.rubygems_version = %q{1.3.7}
34
+ s.rubygems_version = %q{1.5.0}
37
35
  s.summary = %q{Hook rxls to generate Excel documents in Rails 3}
38
36
  s.test_files = [
39
37
  "test/helper.rb",
40
- "test/test_excel_rails.rb"
38
+ "test/test_excel_rails.rb"
41
39
  ]
42
40
 
43
41
  if s.respond_to? :specification_version then
44
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
42
  s.specification_version = 3
46
43
 
47
44
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -7,7 +7,8 @@ module Spreadsheet
7
7
  def excel_document(opts={})
8
8
  download = opts.delete(:force_download)
9
9
  filename = opts.delete(:filename)
10
- workbook = Spreadsheet::Workbook.new
10
+ template_path = opts.delete(:template_path)
11
+ workbook = template_path ? Spreadsheet.open(template_path) : Spreadsheet::Workbook.new
11
12
  yield(workbook)
12
13
  disposition(download, filename) if (download || filename)
13
14
  workbook
@@ -17,7 +18,7 @@ module Spreadsheet
17
18
  download = true if (filename && download == nil)
18
19
  disposition = download ? "attachment;" : "inline;"
19
20
  disposition += " filename=#{filename}" if filename
20
- headers["Content-Disposition"]=disposition
21
+ headers["Content-Disposition"] = disposition
21
22
  end
22
23
  end
23
24
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excel_rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease: false
4
+ hash: 31
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aditya Sanghi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-15 00:00:00 +05:30
18
+ date: 2011-02-22 00:00:00 +05:30
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -30,7 +30,6 @@ extra_rdoc_files:
30
30
  - README
31
31
  files:
32
32
  - .document
33
- - .gitignore
34
33
  - LICENSE
35
34
  - README
36
35
  - Rakefile
@@ -46,8 +45,8 @@ homepage: http://github.com/asanghi/excel_rails
46
45
  licenses: []
47
46
 
48
47
  post_install_message:
49
- rdoc_options:
50
- - --charset=UTF-8
48
+ rdoc_options: []
49
+
51
50
  require_paths:
52
51
  - lib
53
52
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -71,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
70
  requirements: []
72
71
 
73
72
  rubyforge_project:
74
- rubygems_version: 1.3.7
73
+ rubygems_version: 1.5.0
75
74
  signing_key:
76
75
  specification_version: 3
77
76
  summary: Hook rxls to generate Excel documents in Rails 3
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC