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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52e95fc4433c4fd482d8751ae16865fd3c068747
4
- data.tar.gz: ccc0e008af36d7b09b623461fe6e2778132db7e2
3
+ metadata.gz: e4617827037c4d0f95d02b4afba4ea54676551bc
4
+ data.tar.gz: c4385067e3e523b7ef8dc9d4eac5bca33c1ca7b9
5
5
  SHA512:
6
- metadata.gz: c8c2e482a327007e761a3a684661009f09f558f0691642f0294fabf1c49beaeee45c9f14859103e6148077ca2ef2f42a1dd9e50e735d280257dbd0481c629156
7
- data.tar.gz: 70bda3b3641676d7557d3c059bd3cb90bca6193c44c37c65cfaeb403d3f0c1aa6af96d569c6e56f9b5e3e47d3723f5fd8e4f4ecede479a557d94cd46a44c12cf
6
+ metadata.gz: 02c5fec41f3fefd4740be03a0faea7a27a45bb609666e63a34cc8b64452b0bf553e3c1ef35ec5867c6df0933d80692743180147d54a732b77e48df5445788bf7
7
+ data.tar.gz: cdda89f1783c26c5411393390d43bd265194bae58a43952d804fdfdec1fd5cc67c8a22b6ca578b9ff9246ab624e7108f78f16c63230770163674492279440cc8
@@ -1,13 +1,15 @@
1
- class Birt::ApiController < ActionController::Base
2
- protect_from_forgery with: :exception
1
+ module Birt
2
+ class ApiController < ActionController::Base
3
+ protect_from_forgery with: :exception
3
4
 
4
- def index
5
+ def index
5
6
 
6
- rpt_design_path = params[:_report] || '003.rptdesign'
7
- @rpt_design = Birt::Core::RptDesign.new("./birt/reports/#{rpt_design_path}")
7
+ rpt_design_path = params[:_report] || '003.rptdesign'
8
+ @rpt_design = Birt::Core::RptDesign.new("./birt/reports/#{rpt_design_path}")
8
9
 
9
- #数据解析
10
- @rpt_design.parse_rpt
11
- @rpt_design.data_sets.values.each { |data_set| data_set.data_set_result }
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::ApiHelper
1
+ module Birt
2
+ module ApiHelper
2
3
 
3
- def parse_table_header(table_header, table=nil)
4
- header = []
5
- table_header.rows.each_with_index { |row, index|
6
- header << []
7
- row.row_cells.each { |row_cell|
8
- header[index] << row_cell.cell_labels[0].text_properties[0].text
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
- header
12
- end
12
+ header
13
+ end
13
14
 
14
- def parse_table_detail(table_detail, table)
15
- detail = []
16
- table_detail.rows.each_with_index { |row|
17
- row.row_cells.each { |row_cell|
18
- data = row_cell.cell_datas[0].properties[0]
19
- data_set_result = table.data_set.data_set_result
20
- data_set_result.columns[data_set_result.column_headers.index(data.text)].each_with_index { |d, row_i|
21
- detail << [] unless detail[row_i]
22
- detail[row_i] << d
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
- detail
27
+ detail
28
+ end
27
29
  end
28
30
  end
@@ -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| f.match(%r{^(config|public|test|spec|features|birt|app/assets|lib/tasks)/}) }
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"]
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+ namespace :birt do
3
+ resources :api, only: [:index]
4
+ end
5
+ end
@@ -1,4 +1,5 @@
1
1
  require "birt/api/version"
2
+ require "birt/core"
2
3
 
3
4
  module Birt
4
5
  module Api
@@ -1,5 +1,5 @@
1
1
  module Birt
2
2
  module Api
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
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.5
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
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -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
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path("../spring", __FILE__)
4
- rescue LoadError
5
- end
6
- APP_PATH = File.expand_path('../../config/application', __FILE__)
7
- require_relative '../config/boot'
8
- require 'rails/commands'
data/bin/rake DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path("../spring", __FILE__)
4
- rescue LoadError
5
- end
6
- require_relative '../config/boot'
7
- require 'rake'
8
- Rake.application.run
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