easy_reports 0.0.11 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/easy_reports/reports_controller.rb +2 -15
- data/app/services/easy_reports/database_mediator.rb +18 -0
- data/app/views/easy_reports/database_configs/_form.html.slim +5 -2
- data/db/migrate/20141213173509_create_easy_reports_database_configs.rb +3 -2
- data/lib/easy_reports/version.rb +1 -1
- data/lib/easy_reports.rb +2 -0
- data/test/dummy/Gemfile +1 -0
- data/test/dummy/Gemfile.lock +5 -7
- metadata +3 -6
- data/test/dummy/db/migrate/20141207144158_create_easy_reports_reports.easy_reports.rb +0 -11
- data/test/dummy/db/migrate/20141213190452_create_easy_reports_database_configs.easy_reports.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a06454a1c40dda15773fbff6ccaded3fb50bda7
|
4
|
+
data.tar.gz: a65e2e88df4ac14a947d4699087cbab9152a21fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67e0bdb44d5036c23b1dc0853a6d1ad5102b9c4f6ce8ba4b3c6fd0dc624245e164db3abf8391e47574fca8c4395dcb906501eed58edf9a6467374e2bea0df734
|
7
|
+
data.tar.gz: 48ffd8a838edc8cfef7317cb63e183f19fce2a1b75ada83df7a2de06db676e35ca9265e35d223686967aabf300f7ed5d09e3962fa56eb85da63e9a3e15d96409
|
@@ -8,21 +8,8 @@ module EasyReports
|
|
8
8
|
@reports = Report.all
|
9
9
|
|
10
10
|
# TODO: remove into service
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
ActiveRecord::Base.establish_connection(
|
15
|
-
adapter: db_config.adapter,
|
16
|
-
encoding: db_config.encoding,
|
17
|
-
pool: db_config.pool,
|
18
|
-
username: db_config.username,
|
19
|
-
password: db_config.password,
|
20
|
-
host: db_config.host,
|
21
|
-
database: db_config.database
|
22
|
-
)
|
23
|
-
@table_list = ActiveRecord::Base.connection.tables
|
24
|
-
ActiveRecord::Base.establish_connection("#{Rails.env}")
|
25
|
-
|
11
|
+
database_mediator = EasyReports::DatabaseMediator.new
|
12
|
+
@table_list = database_mediator.tables
|
26
13
|
end
|
27
14
|
|
28
15
|
def show
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module EasyReports
|
2
|
+
class DatabaseMediator
|
3
|
+
|
4
|
+
attr_reader :db
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
db_config = EasyReports::DatabaseConfig.last
|
8
|
+
|
9
|
+
@db = ::Sequel.connect(
|
10
|
+
"#{db_config.adapter}://#{db_config.username}:#{db_config.password}@#{db_config.host}:#{db_config.port}/#{db_config.database}",
|
11
|
+
:max_connections => db_config.pool, :logger => Logger.new('log/db.log'))
|
12
|
+
end
|
13
|
+
|
14
|
+
def tables
|
15
|
+
db.tables
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -3,11 +3,12 @@ class CreateEasyReportsDatabaseConfigs < ActiveRecord::Migration
|
|
3
3
|
create_table :easy_reports_database_configs do |t|
|
4
4
|
t.string :adapter
|
5
5
|
t.string :encoding
|
6
|
-
t.
|
6
|
+
t.integer :pool
|
7
7
|
t.string :username
|
8
8
|
t.string :password
|
9
9
|
t.string :host
|
10
|
-
t.
|
10
|
+
t.integer :port
|
11
|
+
t.string :database_name
|
11
12
|
|
12
13
|
t.timestamps
|
13
14
|
end
|
data/lib/easy_reports/version.rb
CHANGED
data/lib/easy_reports.rb
CHANGED
data/test/dummy/Gemfile
CHANGED
data/test/dummy/Gemfile.lock
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
easy_reports (0.0.
|
4
|
+
easy_reports (0.0.11)
|
5
|
+
pg
|
5
6
|
rails (~> 4.1.8)
|
7
|
+
sequel
|
6
8
|
slim
|
7
|
-
slim-rails
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
@@ -68,14 +69,10 @@ GEM
|
|
68
69
|
rake (>= 0.8.7)
|
69
70
|
thor (>= 0.18.1, < 2.0)
|
70
71
|
rake (10.4.2)
|
72
|
+
sequel (4.17.0)
|
71
73
|
slim (2.1.0)
|
72
74
|
temple (~> 0.6.9)
|
73
75
|
tilt (>= 1.3.3, < 2.1)
|
74
|
-
slim-rails (2.1.5)
|
75
|
-
actionpack (>= 3.0, < 4.2)
|
76
|
-
activesupport (>= 3.0, < 4.2)
|
77
|
-
railties (>= 3.0, < 4.2)
|
78
|
-
slim (~> 2.0)
|
79
76
|
sprockets (2.12.3)
|
80
77
|
hike (~> 1.2)
|
81
78
|
multi_json (~> 1.0)
|
@@ -103,6 +100,7 @@ PLATFORMS
|
|
103
100
|
DEPENDENCIES
|
104
101
|
easy_reports!
|
105
102
|
pg
|
103
|
+
sequel
|
106
104
|
slim
|
107
105
|
sqlite3
|
108
106
|
thin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_reports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Davydenkov Mihail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- app/helpers/easy_reports/reports_helper.rb
|
124
124
|
- app/models/easy_reports/database_config.rb
|
125
125
|
- app/models/easy_reports/report.rb
|
126
|
+
- app/services/easy_reports/database_mediator.rb
|
126
127
|
- app/views/easy_reports/database_configs/_form.html.slim
|
127
128
|
- app/views/easy_reports/database_configs/edit.html.slim
|
128
129
|
- app/views/easy_reports/database_configs/index.html.slim
|
@@ -180,8 +181,6 @@ files:
|
|
180
181
|
- test/dummy/config/locales/en.yml
|
181
182
|
- test/dummy/config/routes.rb
|
182
183
|
- test/dummy/config/secrets.yml
|
183
|
-
- test/dummy/db/migrate/20141207144158_create_easy_reports_reports.easy_reports.rb
|
184
|
-
- test/dummy/db/migrate/20141213190452_create_easy_reports_database_configs.easy_reports.rb
|
185
184
|
- test/dummy/db/schema.rb
|
186
185
|
- test/dummy/lib/assets/.keep
|
187
186
|
- test/dummy/log/.keep
|
@@ -257,8 +256,6 @@ test_files:
|
|
257
256
|
- test/dummy/config/locales/en.yml
|
258
257
|
- test/dummy/config/routes.rb
|
259
258
|
- test/dummy/config/secrets.yml
|
260
|
-
- test/dummy/db/migrate/20141207144158_create_easy_reports_reports.easy_reports.rb
|
261
|
-
- test/dummy/db/migrate/20141213190452_create_easy_reports_database_configs.easy_reports.rb
|
262
259
|
- test/dummy/db/schema.rb
|
263
260
|
- test/dummy/lib/assets/.keep
|
264
261
|
- test/dummy/log/.keep
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# This migration comes from easy_reports (originally 20141207141745)
|
2
|
-
class CreateEasyReportsReports < ActiveRecord::Migration
|
3
|
-
def change
|
4
|
-
create_table :easy_reports_reports do |t|
|
5
|
-
t.string :title
|
6
|
-
t.text :description
|
7
|
-
|
8
|
-
t.timestamps
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/test/dummy/db/migrate/20141213190452_create_easy_reports_database_configs.easy_reports.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# This migration comes from easy_reports (originally 20141213173509)
|
2
|
-
class CreateEasyReportsDatabaseConfigs < ActiveRecord::Migration
|
3
|
-
def change
|
4
|
-
create_table :easy_reports_database_configs do |t|
|
5
|
-
t.string :adapter
|
6
|
-
t.string :encoding
|
7
|
-
t.string :pool
|
8
|
-
t.string :username
|
9
|
-
t.string :password
|
10
|
-
t.string :host
|
11
|
-
t.string :database
|
12
|
-
|
13
|
-
t.timestamps
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|