birt-api 0.1.5 → 0.1.6
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/app/controllers/birt/api_controller.rb +10 -8
 - data/app/helpers/birt/api_helper.rb +23 -21
 - data/birt-api.gemspec +3 -1
 - data/config/routes.rb +5 -0
 - data/lib/birt/api.rb +1 -0
 - data/lib/birt/api/version.rb +1 -1
 - metadata +2 -7
 - data/bin/bundle +0 -3
 - data/bin/console +0 -14
 - data/bin/rails +0 -8
 - data/bin/rake +0 -8
 - data/bin/setup +0 -29
 - data/bin/spring +0 -15
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e4617827037c4d0f95d02b4afba4ea54676551bc
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c4385067e3e523b7ef8dc9d4eac5bca33c1ca7b9
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 02c5fec41f3fefd4740be03a0faea7a27a45bb609666e63a34cc8b64452b0bf553e3c1ef35ec5867c6df0933d80692743180147d54a732b77e48df5445788bf7
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: cdda89f1783c26c5411393390d43bd265194bae58a43952d804fdfdec1fd5cc67c8a22b6ca578b9ff9246ab624e7108f78f16c63230770163674492279440cc8
         
     | 
| 
         @@ -1,13 +1,15 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
               
     | 
| 
      
 1 
     | 
    
         
            +
            module Birt
         
     | 
| 
      
 2 
     | 
    
         
            +
              class ApiController < ActionController::Base
         
     | 
| 
      
 3 
     | 
    
         
            +
                protect_from_forgery with: :exception
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
                def index
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
                  rpt_design_path = params[:_report] || '003.rptdesign'
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @rpt_design = Birt::Core::RptDesign.new("./birt/reports/#{rpt_design_path}")
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
                  #数据解析
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @rpt_design.parse_rpt
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @rpt_design.data_sets.values.each { |data_set| data_set.data_set_result }
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
       12 
14 
     | 
    
         
             
              end
         
     | 
| 
       13 
15 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,28 +1,30 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module Birt 
     | 
| 
      
 1 
     | 
    
         
            +
            module Birt
         
     | 
| 
      
 2 
     | 
    
         
            +
              module ApiHelper
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
                def parse_table_header(table_header, table=nil)
         
     | 
| 
      
 5 
     | 
    
         
            +
                  header = []
         
     | 
| 
      
 6 
     | 
    
         
            +
                  table_header.rows.each_with_index { |row, index|
         
     | 
| 
      
 7 
     | 
    
         
            +
                    header << []
         
     | 
| 
      
 8 
     | 
    
         
            +
                    row.row_cells.each { |row_cell|
         
     | 
| 
      
 9 
     | 
    
         
            +
                      header[index] << row_cell.cell_labels[0].text_properties[0].text
         
     | 
| 
      
 10 
     | 
    
         
            +
                    }
         
     | 
| 
       9 
11 
     | 
    
         
             
                  }
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
       12 
     | 
    
         
            -
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
                  header
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
                def parse_table_detail(table_detail, table)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  detail = []
         
     | 
| 
      
 17 
     | 
    
         
            +
                  table_detail.rows.each_with_index { |row|
         
     | 
| 
      
 18 
     | 
    
         
            +
                    row.row_cells.each { |row_cell|
         
     | 
| 
      
 19 
     | 
    
         
            +
                      data = row_cell.cell_datas[0].properties[0]
         
     | 
| 
      
 20 
     | 
    
         
            +
                      data_set_result = table.data_set.data_set_result
         
     | 
| 
      
 21 
     | 
    
         
            +
                      data_set_result.columns[data_set_result.column_headers.index(data.text)].each_with_index { |d, row_i|
         
     | 
| 
      
 22 
     | 
    
         
            +
                        detail << [] unless detail[row_i]
         
     | 
| 
      
 23 
     | 
    
         
            +
                        detail[row_i] << d
         
     | 
| 
      
 24 
     | 
    
         
            +
                      }
         
     | 
| 
       23 
25 
     | 
    
         
             
                    }
         
     | 
| 
       24 
26 
     | 
    
         
             
                  }
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                 
     | 
| 
      
 27 
     | 
    
         
            +
                  detail
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
       27 
29 
     | 
    
         
             
              end
         
     | 
| 
       28 
30 
     | 
    
         
             
            end
         
     | 
    
        data/birt-api.gemspec
    CHANGED
    
    | 
         @@ -14,7 +14,9 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       14 
14 
     | 
    
         
             
              spec.homepage      = "https://github.com/mumaoxi/birt-api"
         
     | 
| 
       15 
15 
     | 
    
         
             
              spec.license      = "MIT"
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| 
     | 
| 
      
 17 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f|
         
     | 
| 
      
 18 
     | 
    
         
            +
                f.match(%r{^(bin|config|public|test|spec|features|birt|app/assets|lib/tasks)/}) }
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.files        +=  ["config/routes.rb"]
         
     | 
| 
       18 
20 
     | 
    
         
             
              spec.bindir        = "exe"
         
     | 
| 
       19 
21 
     | 
    
         
             
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
       20 
22 
     | 
    
         
             
              spec.require_paths = ["app","lib"]
         
     | 
    
        data/config/routes.rb
    ADDED
    
    
    
        data/lib/birt/api.rb
    CHANGED
    
    
    
        data/lib/birt/api/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: birt-api
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.6
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Saxer
         
     | 
| 
         @@ -69,14 +69,9 @@ files: 
     | 
|
| 
       69 
69 
     | 
    
         
             
            - app/controllers/birt/api_controller.rb
         
     | 
| 
       70 
70 
     | 
    
         
             
            - app/helpers/birt/api_helper.rb
         
     | 
| 
       71 
71 
     | 
    
         
             
            - app/views/birt/api/index.json.jbuilder
         
     | 
| 
       72 
     | 
    
         
            -
            - bin/bundle
         
     | 
| 
       73 
     | 
    
         
            -
            - bin/console
         
     | 
| 
       74 
     | 
    
         
            -
            - bin/rails
         
     | 
| 
       75 
     | 
    
         
            -
            - bin/rake
         
     | 
| 
       76 
     | 
    
         
            -
            - bin/setup
         
     | 
| 
       77 
     | 
    
         
            -
            - bin/spring
         
     | 
| 
       78 
72 
     | 
    
         
             
            - birt-api.gemspec
         
     | 
| 
       79 
73 
     | 
    
         
             
            - config.ru
         
     | 
| 
      
 74 
     | 
    
         
            +
            - config/routes.rb
         
     | 
| 
       80 
75 
     | 
    
         
             
            - lib/assets/.keep
         
     | 
| 
       81 
76 
     | 
    
         
             
            - lib/birt/api.rb
         
     | 
| 
       82 
77 
     | 
    
         
             
            - lib/birt/api/version.rb
         
     | 
    
        data/bin/bundle
    DELETED
    
    
    
        data/bin/console
    DELETED
    
    | 
         @@ -1,14 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #!/usr/bin/env ruby
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            require "bundler/setup"
         
     | 
| 
       4 
     | 
    
         
            -
            require "birt/api"
         
     | 
| 
       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
    DELETED
    
    
    
        data/bin/rake
    DELETED
    
    
    
        data/bin/setup
    DELETED
    
    | 
         @@ -1,29 +0,0 @@ 
     | 
|
| 
       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
    DELETED
    
    | 
         @@ -1,15 +0,0 @@ 
     | 
|
| 
       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
         
     |