birt 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.travis.yml +3 -0
- data/Gemfile +42 -0
- data/Gemfile.lock +159 -0
- data/README.md +39 -0
- data/README.rdoc +28 -0
- data/Rakefile +6 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/javascripts/application.js +16 -0
- data/app/assets/stylesheets/application.css +15 -0
- data/app/controllers/application_controller.rb +5 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/models/concerns/.keep +0 -0
- data/app/views/layouts/application.html.erb +14 -0
- data/bin/bundle +3 -0
- data/bin/console +14 -0
- data/bin/rails +8 -0
- data/bin/rake +8 -0
- data/bin/setup +29 -0
- data/bin/spring +15 -0
- data/birt.gemspec +37 -0
- data/config.ru +4 -0
- data/lib/assets/.keep +0 -0
- data/lib/birt/data_set.rb +27 -0
- data/lib/birt/data_source.rb +27 -0
- data/lib/birt/mysql.rb +19 -0
- data/lib/birt/report/table_report.rb +2 -0
- data/lib/birt/rpt_design.rb +36 -0
- data/lib/birt/version.rb +3 -0
- data/lib/birt.rb +12 -0
- data/lib/tasks/.keep +0 -0
- metadata +95 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f74178f39a900366f8f2d07380ed80ac3c21b39
|
4
|
+
data.tar.gz: c4dbc272cb313ee974f2b41a652a11d44ff482e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b291b2f2504701a9e15b38524d998a191a46345d12dd24fa08ceab2fbfa04ee7affece5f70195a4053ec2535d6ac7f3b6501a72458bb98d9f87497f61571f9b
|
7
|
+
data.tar.gz: 4d8ba4127d44f8e9bc2c7751954c88b0757e80d3c5f8c1bfbeb8062c3815a168bbf1c2af6e2c7ed210191cf6752056efef00b35e7edad8a5815ebee2f0e28ac8
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
source 'https://ruby.taobao.org'
|
2
|
+
|
3
|
+
|
4
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
5
|
+
gem 'rails', '4.2.3'
|
6
|
+
gem "rake", "~> 10.4.2"
|
7
|
+
gem 'mysql2'
|
8
|
+
# Use SCSS for stylesheets
|
9
|
+
gem 'sass-rails', '~> 5.0'
|
10
|
+
# Use Uglifier as compressor for JavaScript assets
|
11
|
+
gem 'uglifier', '>= 1.3.0'
|
12
|
+
# Use CoffeeScript for .coffee assets and views
|
13
|
+
gem 'coffee-rails', '~> 4.1.0'
|
14
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
15
|
+
# gem 'therubyracer', platforms: :ruby
|
16
|
+
|
17
|
+
# Use jquery as the JavaScript library
|
18
|
+
gem 'jquery-rails'
|
19
|
+
|
20
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
21
|
+
gem 'jbuilder', '~> 2.0'
|
22
|
+
# Use ActiveModel has_secure_password
|
23
|
+
# gem 'bcrypt', '~> 3.1.7'
|
24
|
+
|
25
|
+
# Use Unicorn as the app server
|
26
|
+
# gem 'unicorn'
|
27
|
+
|
28
|
+
# Use Capistrano for deployment
|
29
|
+
# gem 'capistrano-rails', group: :development
|
30
|
+
|
31
|
+
group :development, :test do
|
32
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
33
|
+
gem 'byebug'
|
34
|
+
gem 'pry'
|
35
|
+
gem 'pry-nav'
|
36
|
+
# Access an IRB console on exception pages or by using <%= console %> in views
|
37
|
+
gem 'web-console', '~> 2.0'
|
38
|
+
|
39
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
40
|
+
gem 'spring'
|
41
|
+
end
|
42
|
+
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://ruby.taobao.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (4.2.3)
|
5
|
+
actionpack (= 4.2.3)
|
6
|
+
actionview (= 4.2.3)
|
7
|
+
activejob (= 4.2.3)
|
8
|
+
mail (~> 2.5, >= 2.5.4)
|
9
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
10
|
+
actionpack (4.2.3)
|
11
|
+
actionview (= 4.2.3)
|
12
|
+
activesupport (= 4.2.3)
|
13
|
+
rack (~> 1.6)
|
14
|
+
rack-test (~> 0.6.2)
|
15
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
17
|
+
actionview (4.2.3)
|
18
|
+
activesupport (= 4.2.3)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubis (~> 2.7.0)
|
21
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
23
|
+
activejob (4.2.3)
|
24
|
+
activesupport (= 4.2.3)
|
25
|
+
globalid (>= 0.3.0)
|
26
|
+
activemodel (4.2.3)
|
27
|
+
activesupport (= 4.2.3)
|
28
|
+
builder (~> 3.1)
|
29
|
+
activerecord (4.2.3)
|
30
|
+
activemodel (= 4.2.3)
|
31
|
+
activesupport (= 4.2.3)
|
32
|
+
arel (~> 6.0)
|
33
|
+
activesupport (4.2.3)
|
34
|
+
i18n (~> 0.7)
|
35
|
+
json (~> 1.7, >= 1.7.7)
|
36
|
+
minitest (~> 5.1)
|
37
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
38
|
+
tzinfo (~> 1.1)
|
39
|
+
arel (6.0.2)
|
40
|
+
binding_of_caller (0.7.2)
|
41
|
+
debug_inspector (>= 0.0.1)
|
42
|
+
builder (3.2.2)
|
43
|
+
byebug (5.0.0)
|
44
|
+
columnize (= 0.9.0)
|
45
|
+
coderay (1.1.0)
|
46
|
+
coffee-rails (4.1.0)
|
47
|
+
coffee-script (>= 2.2.0)
|
48
|
+
railties (>= 4.0.0, < 5.0)
|
49
|
+
coffee-script (2.4.1)
|
50
|
+
coffee-script-source
|
51
|
+
execjs
|
52
|
+
coffee-script-source (1.9.1.1)
|
53
|
+
columnize (0.9.0)
|
54
|
+
debug_inspector (0.0.2)
|
55
|
+
erubis (2.7.0)
|
56
|
+
execjs (2.5.2)
|
57
|
+
globalid (0.3.5)
|
58
|
+
activesupport (>= 4.1.0)
|
59
|
+
i18n (0.7.0)
|
60
|
+
jbuilder (2.3.1)
|
61
|
+
activesupport (>= 3.0.0, < 5)
|
62
|
+
multi_json (~> 1.2)
|
63
|
+
jquery-rails (4.0.3)
|
64
|
+
rails-dom-testing (~> 1.0)
|
65
|
+
railties (>= 4.2.0)
|
66
|
+
thor (>= 0.14, < 2.0)
|
67
|
+
json (1.8.3)
|
68
|
+
loofah (2.0.2)
|
69
|
+
nokogiri (>= 1.5.9)
|
70
|
+
mail (2.6.3)
|
71
|
+
mime-types (>= 1.16, < 3)
|
72
|
+
method_source (0.8.2)
|
73
|
+
mime-types (2.6.1)
|
74
|
+
mini_portile (0.6.2)
|
75
|
+
minitest (5.7.0)
|
76
|
+
multi_json (1.11.2)
|
77
|
+
mysql2 (0.3.19)
|
78
|
+
nokogiri (1.6.6.2)
|
79
|
+
mini_portile (~> 0.6.0)
|
80
|
+
pry (0.10.1)
|
81
|
+
coderay (~> 1.1.0)
|
82
|
+
method_source (~> 0.8.1)
|
83
|
+
slop (~> 3.4)
|
84
|
+
pry-nav (0.2.4)
|
85
|
+
pry (>= 0.9.10, < 0.11.0)
|
86
|
+
rack (1.6.4)
|
87
|
+
rack-test (0.6.3)
|
88
|
+
rack (>= 1.0)
|
89
|
+
rails (4.2.3)
|
90
|
+
actionmailer (= 4.2.3)
|
91
|
+
actionpack (= 4.2.3)
|
92
|
+
actionview (= 4.2.3)
|
93
|
+
activejob (= 4.2.3)
|
94
|
+
activemodel (= 4.2.3)
|
95
|
+
activerecord (= 4.2.3)
|
96
|
+
activesupport (= 4.2.3)
|
97
|
+
bundler (>= 1.3.0, < 2.0)
|
98
|
+
railties (= 4.2.3)
|
99
|
+
sprockets-rails
|
100
|
+
rails-deprecated_sanitizer (1.0.3)
|
101
|
+
activesupport (>= 4.2.0.alpha)
|
102
|
+
rails-dom-testing (1.0.6)
|
103
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
104
|
+
nokogiri (~> 1.6.0)
|
105
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
106
|
+
rails-html-sanitizer (1.0.2)
|
107
|
+
loofah (~> 2.0)
|
108
|
+
railties (4.2.3)
|
109
|
+
actionpack (= 4.2.3)
|
110
|
+
activesupport (= 4.2.3)
|
111
|
+
rake (>= 0.8.7)
|
112
|
+
thor (>= 0.18.1, < 2.0)
|
113
|
+
rake (10.4.2)
|
114
|
+
sass (3.4.16)
|
115
|
+
sass-rails (5.0.3)
|
116
|
+
railties (>= 4.0.0, < 5.0)
|
117
|
+
sass (~> 3.1)
|
118
|
+
sprockets (>= 2.8, < 4.0)
|
119
|
+
sprockets-rails (>= 2.0, < 4.0)
|
120
|
+
tilt (~> 1.1)
|
121
|
+
slop (3.6.0)
|
122
|
+
spring (1.3.6)
|
123
|
+
sprockets (3.2.0)
|
124
|
+
rack (~> 1.0)
|
125
|
+
sprockets-rails (2.3.2)
|
126
|
+
actionpack (>= 3.0)
|
127
|
+
activesupport (>= 3.0)
|
128
|
+
sprockets (>= 2.8, < 4.0)
|
129
|
+
thor (0.19.1)
|
130
|
+
thread_safe (0.3.5)
|
131
|
+
tilt (1.4.1)
|
132
|
+
tzinfo (1.2.2)
|
133
|
+
thread_safe (~> 0.1)
|
134
|
+
uglifier (2.7.1)
|
135
|
+
execjs (>= 0.3.0)
|
136
|
+
json (>= 1.8.0)
|
137
|
+
web-console (2.2.1)
|
138
|
+
activemodel (>= 4.0)
|
139
|
+
binding_of_caller (>= 0.7.2)
|
140
|
+
railties (>= 4.0)
|
141
|
+
sprockets-rails (>= 2.0, < 4.0)
|
142
|
+
|
143
|
+
PLATFORMS
|
144
|
+
ruby
|
145
|
+
|
146
|
+
DEPENDENCIES
|
147
|
+
byebug
|
148
|
+
coffee-rails (~> 4.1.0)
|
149
|
+
jbuilder (~> 2.0)
|
150
|
+
jquery-rails
|
151
|
+
mysql2
|
152
|
+
pry
|
153
|
+
pry-nav
|
154
|
+
rails (= 4.2.3)
|
155
|
+
rake (~> 10.4.2)
|
156
|
+
sass-rails (~> 5.0)
|
157
|
+
spring
|
158
|
+
uglifier (>= 1.3.0)
|
159
|
+
web-console (~> 2.0)
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Birt
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/birt`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'birt'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install birt
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it ( https://github.com/[my-github-username]/birt/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create a new Pull Request
|
data/README.rdoc
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
File without changes
|
data/app/mailers/.keep
ADDED
File without changes
|
data/app/models/.keep
ADDED
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Birt</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/bin/bundle
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "birt"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/rails
ADDED
data/bin/rake
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
data/bin/spring
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# This file loads spring without using Bundler, in order to be fast.
|
4
|
+
# It gets overwritten when you run the `spring binstub` command.
|
5
|
+
|
6
|
+
unless defined?(Spring)
|
7
|
+
require "rubygems"
|
8
|
+
require "bundler"
|
9
|
+
|
10
|
+
if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
|
11
|
+
Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
|
12
|
+
gem "spring", match[1]
|
13
|
+
require "spring/binstub"
|
14
|
+
end
|
15
|
+
end
|
data/birt.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'birt/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "birt"
|
8
|
+
spec.version = Birt::VERSION
|
9
|
+
spec.authors = ["saxer"]
|
10
|
+
spec.email = ["15201280641@qq.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{百灵报表(birt)rails runtime}
|
13
|
+
spec.description = %q{birt report rails runtime}
|
14
|
+
spec.homepage = "https://github.com/mumaoxi/birt"
|
15
|
+
spec.licenses = ["MIT"]
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|pkg|public|config|birt)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["app","lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.4"
|
32
|
+
spec.add_development_dependency 'rails', '~> 0'
|
33
|
+
spec.add_development_dependency "core_extend", "~> 0.1.5"
|
34
|
+
spec.add_development_dependency "highcharts-rails", "~> 4.1"
|
35
|
+
spec.add_development_dependency "mysql2","~> 0.3.19"
|
36
|
+
|
37
|
+
end
|
data/config.ru
ADDED
data/lib/assets/.keep
ADDED
File without changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class Birt::DataSet
|
2
|
+
|
3
|
+
attr_accessor :name
|
4
|
+
attr_accessor :columns
|
5
|
+
attr_accessor :query_text
|
6
|
+
attr_accessor :query_result
|
7
|
+
attr_accessor :data_source
|
8
|
+
|
9
|
+
def initialize(xml_element)
|
10
|
+
self.columns = Array.new
|
11
|
+
if xml_element
|
12
|
+
self.name = xml_element.attribute(:name).value
|
13
|
+
xml_element.get_elements("list-property[@name='resultSet']/structure/property[@name='name']").each do |column|
|
14
|
+
self.columns.push column.text
|
15
|
+
end
|
16
|
+
self.query_text = xml_element.get_elements("xml-property[@name='queryText']")[0].text.gsub("\n", ' ')
|
17
|
+
end
|
18
|
+
yield(self) if block_given?
|
19
|
+
end
|
20
|
+
|
21
|
+
#开始查询
|
22
|
+
def query
|
23
|
+
Birt::Mysql.query(self.data_source, query_text).each do |row|
|
24
|
+
p row
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class Birt::DataSource
|
2
|
+
|
3
|
+
attr_accessor :name
|
4
|
+
attr_accessor :host
|
5
|
+
attr_accessor :port
|
6
|
+
attr_accessor :username
|
7
|
+
attr_accessor :password
|
8
|
+
attr_accessor :database
|
9
|
+
|
10
|
+
def initialize(xml_element)
|
11
|
+
if xml_element
|
12
|
+
self.name = xml_element.attribute(:name).value
|
13
|
+
self.host = xml_element.get_elements("property[@name='odaURL']")[0].text
|
14
|
+
self.username = xml_element.get_elements("property[@name='odaUser']")[0].text
|
15
|
+
self.password = Base64.decode64 xml_element.get_elements("encrypted-property[@name='odaPassword']")[0].text
|
16
|
+
end
|
17
|
+
yield(self) if block_given?
|
18
|
+
end
|
19
|
+
|
20
|
+
def host=(host)
|
21
|
+
host_port = host.gsub('jdbc:mysql://', '').split(':')
|
22
|
+
port_database = host_port[1].split('/')
|
23
|
+
@host = host_port[0]
|
24
|
+
@port = port_database[0]
|
25
|
+
@database = port_database[1]
|
26
|
+
end
|
27
|
+
end
|
data/lib/birt/mysql.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
class Birt::Mysql
|
2
|
+
|
3
|
+
def self.client(data_source)
|
4
|
+
@client ||=Mysql2::Client.new(
|
5
|
+
host: data_source.host,
|
6
|
+
port: data_source.port,
|
7
|
+
username: data_source.username,
|
8
|
+
password: data_source.password,
|
9
|
+
database: data_source.database
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.query(data_source, query_text)
|
14
|
+
client = client(data_source)
|
15
|
+
results = client.query(query_text)
|
16
|
+
yield(results) if block_given?
|
17
|
+
results
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Birt::RptDesign
|
2
|
+
|
3
|
+
#design文件路径
|
4
|
+
attr_accessor :rpt_design_path
|
5
|
+
attr_accessor :data_sources
|
6
|
+
attr_accessor :data_sets
|
7
|
+
|
8
|
+
def initialize(rpt_design_path)
|
9
|
+
self.rpt_design_path = rpt_design_path
|
10
|
+
self.data_sources = Hash.new
|
11
|
+
self.data_sets = Hash.new
|
12
|
+
end
|
13
|
+
|
14
|
+
#解析文件
|
15
|
+
def parse_rpt
|
16
|
+
_root = REXML::Document.new(File.read(self.rpt_design_path)).root
|
17
|
+
|
18
|
+
#数据源
|
19
|
+
_root.each_element(xpath = '/report/data-sources/oda-data-source') do |item|
|
20
|
+
self.data_sources[item.attribute(:name).value] = Birt::DataSource.new(item)
|
21
|
+
end
|
22
|
+
|
23
|
+
#数据集
|
24
|
+
_root.each_element(xpath='/report/data-sets/oda-data-set') do |item|
|
25
|
+
self.data_sets[item.attribute(:name).value] = Birt::DataSet.new(item) do |data_set|
|
26
|
+
data_set.data_source = self.data_sources[item.get_elements("property[@name='dataSource']")[0].text]
|
27
|
+
data_set.query
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
p self.data_sources
|
32
|
+
p self.data_sets
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/lib/birt/version.rb
ADDED
data/lib/birt.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "birt/version"
|
2
|
+
require 'rexml/document'
|
3
|
+
require 'base64'
|
4
|
+
require 'pry'
|
5
|
+
require 'mysql2'
|
6
|
+
|
7
|
+
Dir.glob("#{File.dirname(__FILE__)}/birt/*.rb") { |f| require f }
|
8
|
+
Dir.glob("#{File.dirname(__FILE__)}/birt/report/*.rb") { |f| require f }
|
9
|
+
|
10
|
+
module Birt
|
11
|
+
# Your code goes here...
|
12
|
+
end
|
data/lib/tasks/.keep
ADDED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: birt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saxer
|
@@ -30,14 +30,70 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '10.
|
33
|
+
version: '10.4'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '10.
|
40
|
+
version: '10.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: core_extend
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.5
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.1.5
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: highcharts-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mysql2
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.3.19
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.3.19
|
41
97
|
description: birt report rails runtime
|
42
98
|
email:
|
43
99
|
- 15201280641@qq.com
|
@@ -46,7 +102,40 @@ extensions: []
|
|
46
102
|
extra_rdoc_files: []
|
47
103
|
files:
|
48
104
|
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
106
|
+
- Gemfile
|
107
|
+
- Gemfile.lock
|
49
108
|
- LICENSE
|
109
|
+
- README.md
|
110
|
+
- README.rdoc
|
111
|
+
- Rakefile
|
112
|
+
- app/assets/images/.keep
|
113
|
+
- app/assets/javascripts/application.js
|
114
|
+
- app/assets/stylesheets/application.css
|
115
|
+
- app/controllers/application_controller.rb
|
116
|
+
- app/controllers/concerns/.keep
|
117
|
+
- app/helpers/application_helper.rb
|
118
|
+
- app/mailers/.keep
|
119
|
+
- app/models/.keep
|
120
|
+
- app/models/concerns/.keep
|
121
|
+
- app/views/layouts/application.html.erb
|
122
|
+
- bin/bundle
|
123
|
+
- bin/console
|
124
|
+
- bin/rails
|
125
|
+
- bin/rake
|
126
|
+
- bin/setup
|
127
|
+
- bin/spring
|
128
|
+
- birt.gemspec
|
129
|
+
- config.ru
|
130
|
+
- lib/assets/.keep
|
131
|
+
- lib/birt.rb
|
132
|
+
- lib/birt/data_set.rb
|
133
|
+
- lib/birt/data_source.rb
|
134
|
+
- lib/birt/mysql.rb
|
135
|
+
- lib/birt/report/table_report.rb
|
136
|
+
- lib/birt/rpt_design.rb
|
137
|
+
- lib/birt/version.rb
|
138
|
+
- lib/tasks/.keep
|
50
139
|
homepage: https://github.com/mumaoxi/birt
|
51
140
|
licenses:
|
52
141
|
- MIT
|
@@ -55,6 +144,7 @@ metadata:
|
|
55
144
|
post_install_message:
|
56
145
|
rdoc_options: []
|
57
146
|
require_paths:
|
147
|
+
- app
|
58
148
|
- lib
|
59
149
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
150
|
requirements:
|
@@ -68,8 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
158
|
version: '0'
|
69
159
|
requirements: []
|
70
160
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.4.
|
161
|
+
rubygems_version: 2.4.3
|
72
162
|
signing_key:
|
73
163
|
specification_version: 4
|
74
|
-
summary: 百灵报表(birt)rails runtime
|
164
|
+
summary: "百灵报表(birt)rails runtime"
|
75
165
|
test_files: []
|