birt 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/lib/app/controllers/birt/api_controller.rb +1 -2
- data/lib/birt/core/mysql.rb +2 -1
- data/lib/birt/version.rb +1 -1
- data/lib/birt.rb +15 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9b7b2e02b34b0e0a11a383755b89d6949439b5ef
         | 
| 4 | 
            +
              data.tar.gz: 63c116c33dc69424de1d89a063310384afd7ebd2
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ea1bd93581c306b71c195aec4fcc318d20cbab24b74f3d3a8924a0f5f500b46a1867ad7b9e638380d1d16f0c0752bcc52b2fb7ec7208741c1a1b1c33edbad723
         | 
| 7 | 
            +
              data.tar.gz: 1ccabe819bb5d15b48bad7454eed264e50ab567877f297799505abff74670540ff2bbdd37562c2b8eebfc86395d2f1b754ec5885736931b5c6b3c0f37797b87b
         | 
    
        data/lib/birt/core/mysql.rb
    CHANGED
    
    | @@ -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
    
    
    
        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. | 
| 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- | 
| 11 | 
            +
            date: 2015-08-14 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         |