thecore_mssql_importer_common 0.1.0 → 2.0.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 +5 -5
- data/config/initializers/thecore_mssql_importer_common_after_initialize.rb +0 -1
- data/db/migrate/20180621103713_add_sql_server_connector_params.rb +6 -7
- data/lib/mssql_importer_common.rb +34 -0
- data/lib/tasks/thecore_mssql_importer_common_tasks.rake +13 -4
- data/lib/thecore_mssql_importer_common.rb +2 -2
- data/lib/thecore_mssql_importer_common/engine.rb +1 -1
- data/lib/thecore_mssql_importer_common/version.rb +1 -1
- metadata +7 -8
- data/config/initializers/abilities_thecore_mssql_importer_common_concern.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c33b6116fcbfbc3a625a5f6b67d96b1301deddcf72367ba65192e2d7fcc30b5e
|
4
|
+
data.tar.gz: c6ce90ce5901737c457e5c8c5c1fb2b14bd0f3083d2c7c4db949aef74a8604e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd92471c4a081f2fecbaf0616bb8b794d072bf8703676fda3e02bb01b70188fc1d5fd48e6e962be795340b3766776a35ced5993431eecb82454a83b43e1e030f
|
7
|
+
data.tar.gz: a6066d6016fec281da98370a1b970361163a0be514e07155e7e8365e1be1f5f8ef90a884b2d310d0c4bee1c71cd717f085c53cecb22df5f9d496a1520fa21e89
|
@@ -1,12 +1,11 @@
|
|
1
1
|
class AddSqlServerConnectorParams < ActiveRecord::Migration[5.2]
|
2
2
|
def change
|
3
|
-
Settings.ns('mssql_connector').username = '
|
4
|
-
Settings.ns('mssql_connector').password = '
|
5
|
-
Settings.ns('mssql_connector').host = '
|
6
|
-
Settings.ns('mssql_connector').port
|
7
|
-
Settings.ns('mssql_connector').
|
8
|
-
Settings.ns('mssql_connector').
|
9
|
-
Settings.ns('mssql_connector').table_read = 'test'
|
3
|
+
Settings.ns('mssql_connector').username = 'sa'
|
4
|
+
Settings.ns('mssql_connector').password = 'your_password'
|
5
|
+
Settings.ns('mssql_connector').host = 'localhost'
|
6
|
+
Settings.ns('mssql_connector').port = 1433
|
7
|
+
Settings.ns('mssql_connector').database = 'test'
|
8
|
+
Settings.ns('mssql_connector').table_read = 'test_table'
|
10
9
|
Settings.ns('mssql_connector').latest_migration_code = ''
|
11
10
|
end
|
12
11
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'tiny_tds'
|
2
|
+
|
3
|
+
class MSSQLImporterCommon
|
4
|
+
# "Just tests connection to the DB configured in Settings."
|
5
|
+
def self.ping_mssql_server
|
6
|
+
connect
|
7
|
+
puts 'Connecting to SQL Server'
|
8
|
+
|
9
|
+
if @client.active? == true then puts 'Done' end
|
10
|
+
|
11
|
+
@client.close
|
12
|
+
end
|
13
|
+
|
14
|
+
# "Retrieves all records from the reading table."
|
15
|
+
def self.get_all_records
|
16
|
+
connect
|
17
|
+
# Read all employees
|
18
|
+
puts "Reading data from table"
|
19
|
+
@client.execute("SELECT * FROM #{Settings.ns('mssql_connector').table_read}").each do |row|
|
20
|
+
puts row
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.connect
|
25
|
+
conn = {
|
26
|
+
username: Settings.ns('mssql_connector').username,
|
27
|
+
password: Settings.ns('mssql_connector').password,
|
28
|
+
host: Settings.ns('mssql_connector').host,
|
29
|
+
port: Settings.ns('mssql_connector').port,
|
30
|
+
database: Settings.ns('mssql_connector').database,
|
31
|
+
}
|
32
|
+
@client = TinyTds::Client.new conn
|
33
|
+
end
|
34
|
+
end
|
@@ -1,4 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require 'tracker_importer'
|
2
|
+
|
3
|
+
namespace :mssql_importer_common do
|
4
|
+
desc "Just tests connection to the DB configured in Settings."
|
5
|
+
task ping_mssql_server: :environment do
|
6
|
+
MSSQLImporterCommon.ping_mssql_server
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "Retrieves all records from the reading table."
|
10
|
+
task get_all_records: :environment do
|
11
|
+
MSSQLImporterCommon.get_all_records
|
12
|
+
end
|
13
|
+
end
|
@@ -3,7 +3,7 @@ module ThecoreMssqlImporterCommon
|
|
3
3
|
class Engine < ::Rails::Engine
|
4
4
|
|
5
5
|
initializer 'thecore_mssql_importer_common.add_to_migrations' do |app|
|
6
|
-
unless app.root.to_s
|
6
|
+
unless app.root.to_s.match root.to_s
|
7
7
|
# APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
|
8
8
|
config.paths['db/migrate'].expanded.each do |expanded_path|
|
9
9
|
app.config.paths['db/migrate'] << expanded_path
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_mssql_importer_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: thecore_backend_commons
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: tiny_tds
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -49,10 +49,10 @@ files:
|
|
49
49
|
- README.md
|
50
50
|
- Rakefile
|
51
51
|
- app/assets/config/thecore_mssql_importer_common_manifest.js
|
52
|
-
- config/initializers/abilities_thecore_mssql_importer_common_concern.rb
|
53
52
|
- config/initializers/thecore_mssql_importer_common_after_initialize.rb
|
54
53
|
- config/routes.rb
|
55
54
|
- db/migrate/20180621103713_add_sql_server_connector_params.rb
|
55
|
+
- lib/mssql_importer_common.rb
|
56
56
|
- lib/tasks/thecore_mssql_importer_common_tasks.rake
|
57
57
|
- lib/thecore_mssql_importer_common.rb
|
58
58
|
- lib/thecore_mssql_importer_common/engine.rb
|
@@ -87,8 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
|
-
|
91
|
-
rubygems_version: 2.6.14
|
90
|
+
rubygems_version: 3.0.3
|
92
91
|
signing_key:
|
93
92
|
specification_version: 4
|
94
93
|
summary: Thecorized thecore_mssql_importer_common
|
@@ -1,23 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'active_support/concern'
|
3
|
-
|
4
|
-
module ThecoreMssqlImporterCommonAbilitiesConcern
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
included do
|
7
|
-
def thecore_mssql_importer_common_abilities user
|
8
|
-
if user
|
9
|
-
# if the user is logged in, it can do certain tasks regardless his role
|
10
|
-
if user.admin?
|
11
|
-
# if the user is an admin, it can do a lot of things, usually
|
12
|
-
end
|
13
|
-
|
14
|
-
if user.has_role? :role
|
15
|
-
# a specific role, brings specific powers
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
# include the extension
|
23
|
-
TheCoreAbilities.send(:include, ThecoreMssqlImporterCommonAbilitiesConcern)
|