excel_builder 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -0
- data/excel_builder.gemspec +44 -0
- data/ext/Gemfile +6 -0
- data/ext/Gemfile.lock +29 -0
- data/ext/app.rb +25 -0
- data/ext/favicon.ico +0 -0
- data/lib/excel_builder.rb +30 -0
- data/lib/excel_builder/version.rb +3 -0
- metadata +105 -0
data/README
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
TODO
|
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
$:.push('lib')
|
4
|
+
require "excel_builder/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "excel_builder"
|
8
|
+
s.version = ExcelBuilder::VERSION.dup
|
9
|
+
s.date = "2012-01-06"
|
10
|
+
s.summary = "connector and jruby sinatra app to generate excel spreadsheets"
|
11
|
+
s.email = "tim@galeckas.com"
|
12
|
+
s.homepage = "https://github.com/timgaleckas/excel_builder"
|
13
|
+
s.authors = ['Tim Galeckas']
|
14
|
+
|
15
|
+
s.description = <<-EOF
|
16
|
+
connector and jruby sinatra app to generate excel spreadsheets
|
17
|
+
EOF
|
18
|
+
|
19
|
+
dependencies = [
|
20
|
+
# Examples:
|
21
|
+
[:runtime, "command_recorder", "~> 0.0.1"],
|
22
|
+
[:runtime, "rest-client", "~> 1.6.6"]
|
23
|
+
# [:development, "rspec", "~> 2.1"],
|
24
|
+
]
|
25
|
+
|
26
|
+
s.files = Dir['**/*']
|
27
|
+
s.test_files = Dir['test/**/*'] + Dir['spec/**/*']
|
28
|
+
s.executables = Dir['bin/*'].map { |f| File.basename(f) }
|
29
|
+
s.require_paths = ["lib"]
|
30
|
+
|
31
|
+
|
32
|
+
## Make sure you can build the gem on older versions of RubyGems too:
|
33
|
+
s.rubygems_version = "1.8.9"
|
34
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
35
|
+
s.specification_version = 3 if s.respond_to? :specification_version
|
36
|
+
|
37
|
+
dependencies.each do |type, name, version|
|
38
|
+
if s.respond_to?("add_#{type}_dependency")
|
39
|
+
s.send("add_#{type}_dependency", name, version)
|
40
|
+
else
|
41
|
+
s.add_dependency(name, version)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/ext/Gemfile
ADDED
data/ext/Gemfile.lock
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
jruby-poi (0.8.2)
|
5
|
+
jruby-rack (1.1.2)
|
6
|
+
rack (1.4.0)
|
7
|
+
rack-protection (1.2.0)
|
8
|
+
rack
|
9
|
+
rack-test (0.6.1)
|
10
|
+
rack (>= 1.0)
|
11
|
+
sinatra (1.3.2)
|
12
|
+
rack (~> 1.3, >= 1.3.6)
|
13
|
+
rack-protection (~> 1.2)
|
14
|
+
tilt (~> 1.3, >= 1.3.3)
|
15
|
+
tilt (1.3.3)
|
16
|
+
trinidad (1.3.0)
|
17
|
+
jruby-rack (>= 1.1.2)
|
18
|
+
rack
|
19
|
+
trinidad_jars (>= 1.0.1)
|
20
|
+
trinidad_jars (1.0.2)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
java
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
jruby-poi
|
27
|
+
rack-test
|
28
|
+
sinatra
|
29
|
+
trinidad
|
data/ext/app.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
Bundler.require
|
5
|
+
|
6
|
+
require 'sinatra'
|
7
|
+
|
8
|
+
post '/:filename.xlsx' do
|
9
|
+
begin
|
10
|
+
workbook = POI::Workbook.new("#{params[:filename]}.xlsx",nil)
|
11
|
+
CommandRecorder.playback_from_json(params[:invocation_json],workbook)
|
12
|
+
send_workbook(workbook)
|
13
|
+
rescue Exception => e
|
14
|
+
puts e.inspect
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def send_workbook(workbook)
|
19
|
+
os = java.io.ByteArrayOutputStream.new
|
20
|
+
workbook.instance_variable_get('@workbook').write(os)
|
21
|
+
headers['Content-Type'] = "application/vnd.ms-excel"
|
22
|
+
headers['Content-Disposition'] = 'attachment; filename="' + params[:filename] + '.xlsx"'
|
23
|
+
headers['Cache-Control'] = ''
|
24
|
+
String.from_java_bytes(os.toByteArray)
|
25
|
+
end
|
data/ext/favicon.ico
ADDED
File without changes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'command_recorder'
|
3
|
+
require 'rest_client'
|
4
|
+
|
5
|
+
module ExcelBuilder
|
6
|
+
class Connector
|
7
|
+
def self.site
|
8
|
+
@@site
|
9
|
+
end
|
10
|
+
def self.site=(site)
|
11
|
+
@@site=site
|
12
|
+
end
|
13
|
+
def self.user
|
14
|
+
@@user
|
15
|
+
end
|
16
|
+
def self.user=(user)
|
17
|
+
@@user=user
|
18
|
+
end
|
19
|
+
def self.password
|
20
|
+
@@password
|
21
|
+
end
|
22
|
+
def self.password=(password)
|
23
|
+
@@password=password
|
24
|
+
end
|
25
|
+
def self.generate_xlsx(filename, &block)
|
26
|
+
cr = CommandRecorder.record &block
|
27
|
+
RestClient.post self.site + filename, :invocation_json => cr.invocation_json
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: excel_builder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Tim Galeckas
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-01-06 00:00:00 -06:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: command_recorder
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 29
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 0
|
33
|
+
- 1
|
34
|
+
version: 0.0.1
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rest-client
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 6
|
49
|
+
- 6
|
50
|
+
version: 1.6.6
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
description: " connector and jruby sinatra app to generate excel spreadsheets\n"
|
54
|
+
email: tim@galeckas.com
|
55
|
+
executables: []
|
56
|
+
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files: []
|
60
|
+
|
61
|
+
files:
|
62
|
+
- excel_builder.gemspec
|
63
|
+
- ext/app.rb
|
64
|
+
- ext/favicon.ico
|
65
|
+
- ext/Gemfile
|
66
|
+
- ext/Gemfile.lock
|
67
|
+
- lib/excel_builder/version.rb
|
68
|
+
- lib/excel_builder.rb
|
69
|
+
- README
|
70
|
+
has_rdoc: true
|
71
|
+
homepage: https://github.com/timgaleckas/excel_builder
|
72
|
+
licenses: []
|
73
|
+
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 3
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
version: "0"
|
97
|
+
requirements: []
|
98
|
+
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 1.6.2
|
101
|
+
signing_key:
|
102
|
+
specification_version: 3
|
103
|
+
summary: connector and jruby sinatra app to generate excel spreadsheets
|
104
|
+
test_files: []
|
105
|
+
|