birt 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73de487306437a5f2436c45ea2eb0b09a14663a1
4
- data.tar.gz: c68d43bb533f6f104b0280abfd76d108f2ecfdc9
3
+ metadata.gz: 9b7b2e02b34b0e0a11a383755b89d6949439b5ef
4
+ data.tar.gz: 63c116c33dc69424de1d89a063310384afd7ebd2
5
5
  SHA512:
6
- metadata.gz: 2a015056d3bbd6e78903784641929dd5bce22b214b20895214b6886478ab09e957192e54378eb5b80ac936b617a28c6ad9ae1830a4fc1336073a51962542729b
7
- data.tar.gz: 87beae04b1ac18f60bb8f6febf4b9faefb6b751f03403632bbb0c97a429e1b8e838945fcaf164b0ef3648376331653437a2091bb3f4553cd62e09f6e5490717f
6
+ metadata.gz: ea1bd93581c306b71c195aec4fcc318d20cbab24b74f3d3a8924a0f5f500b46a1867ad7b9e638380d1d16f0c0752bcc52b2fb7ec7208741c1a1b1c33edbad723
7
+ data.tar.gz: 1ccabe819bb5d15b48bad7454eed264e50ab567877f297799505abff74670540ff2bbdd37562c2b8eebfc86395d2f1b754ec5885736931b5c6b3c0f37797b87b
@@ -11,7 +11,6 @@ module Birt
11
11
  #数据解析
12
12
  @rpt_design.parse_rpt
13
13
  @rpt_design.data_sets.values.each { |data_set| data_set.data_set_result }
14
-
15
14
  end
16
15
  end
17
- end
16
+ end
@@ -36,11 +36,12 @@ class Birt::Core::Mysql
36
36
  def self.choose_data_source(data_source = nil)
37
37
  return rails_data_source if data_source.nil?
38
38
  config_path = Rails.root ? File.join(Rails.root, "config", "birt.yml") : './config/birt.yml'
39
+ config = nil
39
40
  if (File.exist?(config_path))
40
41
  config = YAML.load(ERB.new(File.new(config_path).read).result)
41
42
  config = config[Rails.env] if defined? Rails
42
43
  end
43
- if "rptdesign" == config["datasource"]
44
+ if config && "rptdesign" == config["datasource"]
44
45
  data_source
45
46
  else
46
47
  rails_data_source
data/lib/birt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Birt
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  module Core
4
4
 
5
5
  end
data/lib/birt.rb CHANGED
@@ -8,7 +8,6 @@ require 'pry'
8
8
  require 'mysql2'
9
9
 
10
10
 
11
-
12
11
  %w{ controllers helpers views}.each do |dir|
13
12
  path = File.join(File.dirname(__FILE__), 'app', dir)
14
13
  $LOAD_PATH << path
@@ -22,7 +21,22 @@ Dir.glob("#{File.dirname(__FILE__)}/birt/core/chart/*.rb") { |f| require f }
22
21
 
23
22
  module Birt
24
23
  module_function
24
+
25
25
  def birt(rptdesign_name)
26
26
  "<div class=\"birt\" data-rptdesign=\"#{rptdesign_name}.rptdesign\"></div>"
27
27
  end
28
+
29
+ #获取目录结构
30
+ def menus
31
+
32
+ Dir.glob("./reports/*.rptdesign").inject([]) { |acc, f|
33
+ names = REXML::Document.new(File.read(f)).root.get_elements("/report/text-property[@name='displayName']")
34
+ display_name = names[0].text if names && names[0]
35
+ acc << {
36
+ file: f,
37
+ display_name: display_name
38
+ }; acc
39
+ }
40
+
41
+ end
28
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: birt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - saxer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-13 00:00:00.000000000 Z
11
+ date: 2015-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails