cesar 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +44 -0
- data/cesar.gemspec +24 -0
- data/lib/cesar.rb +100 -0
- data/makefile +4 -0
- data/utils/jasperc.jar +0 -0
- data/utils/lib/barbecue-1.5-beta1.jar +0 -0
- data/utils/lib/barcode4j-2.0.jar +0 -0
- data/utils/lib/batik-all-1.7.jar +0 -0
- data/utils/lib/batik-bridge-1.7.jar +0 -0
- data/utils/lib/commons-beanutils-1.9.1.jar +0 -0
- data/utils/lib/commons-collections-3.2.1.jar +0 -0
- data/utils/lib/commons-digester-2.1.jar +0 -0
- data/utils/lib/commons-io-2.4.jar +0 -0
- data/utils/lib/commons-logging-1.1.3.jar +0 -0
- data/utils/lib/groovy-all-2.3.0.jar +0 -0
- data/utils/lib/itext-2.1.7.jar +0 -0
- data/utils/lib/jasperreports-5.5.0.jar +0 -0
- data/utils/lib/org.w3c.css.sac-1.3.0.jar +0 -0
- data/utils/lib/poi-3.7.jar +0 -0
- data/utils/lib/postgresql-9.2-1002.jdbc4.jar +0 -0
- data/utils/lib/serializer.jar +0 -0
- data/utils/lib/servlet-api-3.0-alpha-1.jar +0 -0
- data/utils/lib/w3c.jar +0 -0
- data/utils/lib/xalan-2.7.1.jar +0 -0
- data/utils/lib/xml-apis-2.0.2.jar +0 -0
- data/utils/properties.properties +0 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b97efc3f95dd348444160d1e4a258eb21a564ae1
|
4
|
+
data.tar.gz: c158b75a6f4fba8d8bed5e42f66997ad63a19630
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e2834758b2636a345ea0c8cc7072f18842fa3ef3aa3436f6cb89054a1e7818d2a5ab9fec4a47aece5a26479d5e0874952019661333e7c8a60f6a8f362f41edd9
|
7
|
+
data.tar.gz: b1b49f35532ed8f2a39264823dd8413ceb2c806c705f318ce8a54188096c60a327e3507fbe955591eefb655a8edcd751798d8bda1b29245bea1759ec030f297d
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# cesar
|
2
|
+
|
3
|
+
JasperReport for ruby MRI enviroments
|
4
|
+
|
5
|
+
# Instalation
|
6
|
+
|
7
|
+
gem install cesar
|
8
|
+
|
9
|
+
# Use
|
10
|
+
|
11
|
+
*cesar* provide four methods for generate or print reports through JasperReport
|
12
|
+
|
13
|
+
Cesar.generate
|
14
|
+
Cesar.pdf_export
|
15
|
+
Cesar.excel_export
|
16
|
+
Cesar.print
|
17
|
+
|
18
|
+
With the next options
|
19
|
+
|
20
|
+
:export_to => :pdf || :excel
|
21
|
+
:datasource => :xml || :csv || :sql
|
22
|
+
:datasource_path => String # with path of datasource (csv, xml, or properties file)
|
23
|
+
:export_path => String # with path for export the report (Rails.root + "/tmp/pdf.pdf" for example)
|
24
|
+
:print => true # for print the report on default printer
|
25
|
+
|
26
|
+
pdf_export, excel_export and print methods are short way for pdf export, excel export and print reports, respectly
|
27
|
+
|
28
|
+
# Examples
|
29
|
+
|
30
|
+
Generate pdf report
|
31
|
+
|
32
|
+
Cesar.pdf_export 'report_path',
|
33
|
+
datasource: :sql,
|
34
|
+
datasource_path: 'properties_file',
|
35
|
+
export_path: 'pdf_file'
|
36
|
+
|
37
|
+
Generate excel report
|
38
|
+
|
39
|
+
Cesar.excel_export 'report_path',
|
40
|
+
datasource: :sql,
|
41
|
+
datasource_path: 'properties_file',
|
42
|
+
export_path: 'pdf_file'
|
43
|
+
|
44
|
+
more examples in test folder
|
data/cesar.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path("../lib/cesar", __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'cesar'
|
5
|
+
s.version = Cesar::VERSION
|
6
|
+
s.date = Date.today.to_s
|
7
|
+
s.summary = 'Integrate JasperReport in ruby MRI apps'
|
8
|
+
s.description = 'JasperReport for ruby MRI enviroments'
|
9
|
+
s.authors = ["Emanuel Friedrich"]
|
10
|
+
s.email = 'aemanuelfriedrich@gmail.com'
|
11
|
+
s.homepage = 'https://github.com/emafriedrich/cesar'
|
12
|
+
s.files = Dir[
|
13
|
+
# "LICENSE",
|
14
|
+
# "AUTHORS",
|
15
|
+
"README.md",
|
16
|
+
"lib/**/*.rb",
|
17
|
+
"utils/*",
|
18
|
+
"utils/lib/*",
|
19
|
+
"*.gemspec",
|
20
|
+
"test/**/*.rb",
|
21
|
+
"makefile"
|
22
|
+
]
|
23
|
+
s.add_development_dependency "cutest"
|
24
|
+
end
|
data/lib/cesar.rb
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
module Cesar
|
2
|
+
|
3
|
+
VERSION = '0.0.1'
|
4
|
+
|
5
|
+
DEFAULT_DATASOURCE = :sql
|
6
|
+
VALID_DATASOURCE_OPTIONS = [:sql, :xml, :csv]
|
7
|
+
DEFAULT_EXPORT_TO_OPTION = " pdf "
|
8
|
+
VALID_EXPORT_TO_OPTIONS = [:excel, :pdf]
|
9
|
+
|
10
|
+
def Cesar.generate(report_path, options)
|
11
|
+
raise_arg_error_if_nil_or_empty report_path
|
12
|
+
arguments = "-n #{wrap_with_double_quotes(report_path)} "
|
13
|
+
arguments << string_options(options)
|
14
|
+
system "java -jar \"#{File.expand_path("../../utils/jasperc.jar", __FILE__)}\" #{arguments}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def Cesar.pdf_export(report_path, options)
|
18
|
+
options[:export_to] = :pdf
|
19
|
+
generate report_path, options
|
20
|
+
end
|
21
|
+
|
22
|
+
def Cesar.excel_export(report_path, options)
|
23
|
+
options[:export_to] = :excel
|
24
|
+
generate report_path, options
|
25
|
+
end
|
26
|
+
|
27
|
+
def Cesar.print(report_path, options)
|
28
|
+
options[:print] = true
|
29
|
+
generate report_path, options
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def Cesar.string_options(options)
|
35
|
+
return_string = export_to(options[:export_to])
|
36
|
+
return_string << export_path(options[:export_path])
|
37
|
+
return_string << datasource_path(options[:datasource_path])
|
38
|
+
return_string << datasource(options[:datasource])
|
39
|
+
|
40
|
+
if options[:print]
|
41
|
+
return_string << ' pred '
|
42
|
+
end
|
43
|
+
|
44
|
+
if options[:child_node]
|
45
|
+
return_string << " -m #{options[:child_node]} "
|
46
|
+
end
|
47
|
+
|
48
|
+
return_string
|
49
|
+
end
|
50
|
+
|
51
|
+
def Cesar.export_path(export_path)
|
52
|
+
return_string = ' -e '
|
53
|
+
if export_path
|
54
|
+
return_string << wrap_with_double_quotes(export_path)
|
55
|
+
else
|
56
|
+
raise ArgumentError, 'You must provide the export_path'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def Cesar.datasource_path(datasource_path)
|
61
|
+
return_string = ' -d '
|
62
|
+
if datasource_path
|
63
|
+
return_string << wrap_with_double_quotes(datasource_path)
|
64
|
+
else
|
65
|
+
raise ArgumentError, 'Yout must provide the datasource_path'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def Cesar.datasource(datasource)
|
70
|
+
return DEFAULT_DATASOURCE.to_s if datasource.nil?
|
71
|
+
raise_arg_error_on_invalid_datasource_options datasource
|
72
|
+
datasource.to_s
|
73
|
+
end
|
74
|
+
|
75
|
+
def Cesar.wrap_with_double_quotes(string)
|
76
|
+
' "' + string + '" '
|
77
|
+
end
|
78
|
+
|
79
|
+
def Cesar.export_to(export_to)
|
80
|
+
return DEFAULT_EXPORT_TO_OPTION.to_s if export_to.nil?
|
81
|
+
raise_arg_error_on_invalids_export_to_options export_to
|
82
|
+
export_to.to_s
|
83
|
+
end
|
84
|
+
|
85
|
+
def Cesar.raise_arg_error_if_nil_or_empty(report_path)
|
86
|
+
raise ArgumentError, 'I need the report_path' if report_path.nil? || report_path.empty?
|
87
|
+
end
|
88
|
+
|
89
|
+
def Cesar.raise_arg_error_on_invalids_export_to_options(export_to)
|
90
|
+
if !VALID_EXPORT_TO_OPTIONS.include? export_to
|
91
|
+
raise ArgumentError, "export_to option #{export_to} is invalid. Only #{VALID_EXPORT_TO_OPTIONS} is available"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def Cesar.raise_arg_error_on_invalid_datasource_options(datasource)
|
96
|
+
if !VALID_DATASOURCE_OPTIONS.include? datasource
|
97
|
+
raise ArgumentError, "Datasource option #{datasource} is invalid. Only #{VALID_DATASOURCE_OPTIONS} are available"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
data/makefile
ADDED
data/utils/jasperc.jar
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/utils/lib/w3c.jar
ADDED
Binary file
|
Binary file
|
Binary file
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cesar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Emanuel Friedrich
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cutest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: JasperReport for ruby MRI enviroments
|
28
|
+
email: aemanuelfriedrich@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- README.md
|
34
|
+
- cesar.gemspec
|
35
|
+
- lib/cesar.rb
|
36
|
+
- makefile
|
37
|
+
- utils/jasperc.jar
|
38
|
+
- utils/lib/barbecue-1.5-beta1.jar
|
39
|
+
- utils/lib/barcode4j-2.0.jar
|
40
|
+
- utils/lib/batik-all-1.7.jar
|
41
|
+
- utils/lib/batik-bridge-1.7.jar
|
42
|
+
- utils/lib/commons-beanutils-1.9.1.jar
|
43
|
+
- utils/lib/commons-collections-3.2.1.jar
|
44
|
+
- utils/lib/commons-digester-2.1.jar
|
45
|
+
- utils/lib/commons-io-2.4.jar
|
46
|
+
- utils/lib/commons-logging-1.1.3.jar
|
47
|
+
- utils/lib/groovy-all-2.3.0.jar
|
48
|
+
- utils/lib/itext-2.1.7.jar
|
49
|
+
- utils/lib/jasperreports-5.5.0.jar
|
50
|
+
- utils/lib/org.w3c.css.sac-1.3.0.jar
|
51
|
+
- utils/lib/poi-3.7.jar
|
52
|
+
- utils/lib/postgresql-9.2-1002.jdbc4.jar
|
53
|
+
- utils/lib/serializer.jar
|
54
|
+
- utils/lib/servlet-api-3.0-alpha-1.jar
|
55
|
+
- utils/lib/w3c.jar
|
56
|
+
- utils/lib/xalan-2.7.1.jar
|
57
|
+
- utils/lib/xml-apis-2.0.2.jar
|
58
|
+
- utils/properties.properties
|
59
|
+
homepage: https://github.com/emafriedrich/cesar
|
60
|
+
licenses: []
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.4.8
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: Integrate JasperReport in ruby MRI apps
|
82
|
+
test_files: []
|