trueandco_analytics 0.4.10 → 0.4.11
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/exe/trueandco_analytics +5 -3
- data/lib/generators/trueandco_analytics/templates/trueandco_analytics.rb +4 -14
- data/lib/trueandco_analytics/config/params.rb +7 -7
- data/lib/trueandco_analytics/console/commands/database/get_current_config.rb +20 -0
- data/lib/trueandco_analytics/console/commands/report_c/generate.rb +1 -1
- data/lib/trueandco_analytics/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c5e7362fdc8ee18d920be56be5a5239c29c945d
|
4
|
+
data.tar.gz: 6cbb35319c7ba3e65da8f2ac2c26cd1dde7c4b06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc3a1b923e3fcbdc2de474dd751ddc2360139b07f712acbb643b8c57fb0ed08553881e355bbaaf31915f9b310adf03a450d38eb304287d284df46ea04005ff80
|
7
|
+
data.tar.gz: c1df04195b4ed047a2258933db51642a6060d072736bc632777952a8ea0dd7130c154a089f9b6534c080ccc0155719b92104fbc2c9636262bbc428e72c6a3df4
|
data/exe/trueandco_analytics
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
3
|
-
CURRENT_PATH = Dir.pwd
|
3
|
+
CURRENT_PATH = Dir.pwd
|
4
4
|
|
5
5
|
require 'bundler/setup'
|
6
6
|
require 'i18n'
|
7
7
|
require 'optparse'
|
8
8
|
require 'fileutils'
|
9
|
+
require 'yaml'
|
9
10
|
require 'active_record'
|
10
11
|
require 'mysql2'
|
11
12
|
require 'trueandco_analytics'
|
12
|
-
require "#{CURRENT_PATH}config/initializers/trueandco_analytics"
|
13
|
+
require "#{CURRENT_PATH}/config/initializers/trueandco_analytics"
|
13
14
|
|
14
|
-
|
15
|
+
current_db_mode = TrueandcoAnalytics::Config::Params.current_db_mode
|
16
|
+
connect_db = TrueandcoAnalytics::Database::GetCurrentConfig.new(current_db_mode, "#{CURRENT_PATH}/config/database.yml").execute
|
15
17
|
1.times do
|
16
18
|
break if connect_db.nil?
|
17
19
|
ActiveRecord::Base.establish_connection(connect_db)
|
@@ -10,9 +10,8 @@ TrueandcoAnalytics.setup do |config|
|
|
10
10
|
|
11
11
|
# Specify the database where redis will store the statistics for the session site
|
12
12
|
config.connect_redis = {
|
13
|
-
|
13
|
+
url: "redis://localhost:6379/1",
|
14
14
|
#redis_password: '',
|
15
|
-
redis_db: 1
|
16
15
|
}
|
17
16
|
|
18
17
|
# Specify Sidekiq config
|
@@ -20,18 +19,9 @@ TrueandcoAnalytics.setup do |config|
|
|
20
19
|
config.sidekiq_configure_server_url = 'redis://localhost:6379/1'
|
21
20
|
config.sidekiq_configure_namespace = 'metric'
|
22
21
|
|
23
|
-
#Log name in rails app
|
22
|
+
# Log name in rails app
|
24
23
|
config.log = nil
|
25
24
|
|
26
|
-
#Specify
|
27
|
-
=
|
28
|
-
config.connect_db = {
|
29
|
-
adapter: :mysql2,
|
30
|
-
database: 'development_db_name',
|
31
|
-
username: 'ivan',
|
32
|
-
password: '3443555',
|
33
|
-
host: '127.0.0.1',
|
34
|
-
port: 3306
|
35
|
-
}
|
36
|
-
=end
|
25
|
+
# Specify current database mode of config/database.yml to use in console mode
|
26
|
+
config.current_db_mode = 'development'
|
37
27
|
end
|
@@ -20,8 +20,8 @@ module TrueandcoAnalytics
|
|
20
20
|
@sidekiq_configure_namespace_check = false
|
21
21
|
@log = nil
|
22
22
|
@log_check = false
|
23
|
-
@
|
24
|
-
@
|
23
|
+
@current_db_mode = nil
|
24
|
+
@current_db_mode_check = false
|
25
25
|
|
26
26
|
class << self
|
27
27
|
|
@@ -42,12 +42,12 @@ module TrueandcoAnalytics
|
|
42
42
|
end
|
43
43
|
|
44
44
|
attr_reader :time_survey, :time_dead_session, :buy_selector,
|
45
|
-
:sidekiq_configure_client_url, :sidekiq_configure_server_url, :sidekiq_configure_namespace,
|
46
|
-
:
|
47
|
-
|
45
|
+
:sidekiq_configure_client_url, :sidekiq_configure_server_url, :sidekiq_configure_namespace, :connect_redis,
|
46
|
+
:current_db_mode
|
47
|
+
|
48
48
|
attr_writer_only_once :time_survey, :user_method,
|
49
|
-
:sidekiq_configure_client_url, :sidekiq_configure_server_url, :sidekiq_configure_namespace,
|
50
|
-
:
|
49
|
+
:sidekiq_configure_client_url, :sidekiq_configure_server_url, :sidekiq_configure_namespace, :connect_redis,
|
50
|
+
:current_db_mode
|
51
51
|
|
52
52
|
def buy_selector=(value)
|
53
53
|
return if value.nil?
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module TrueandcoAnalytics::Database
|
2
|
+
class GetCurrentConfig
|
3
|
+
|
4
|
+
def initialize(current_mode, path)
|
5
|
+
@current_mode = current_mode
|
6
|
+
@path = path
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute
|
10
|
+
config = YAML.load_file(path)
|
11
|
+
config[current_mode]
|
12
|
+
rescue StandardError => e
|
13
|
+
return nil
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
attr_reader :current_mode, :path
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trueandco_analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moroz Ivan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -204,6 +204,7 @@ files:
|
|
204
204
|
- lib/trueandco_analytics/config/params.rb
|
205
205
|
- lib/trueandco_analytics/console/cli/common.rb
|
206
206
|
- lib/trueandco_analytics/console/cli/report.rb
|
207
|
+
- lib/trueandco_analytics/console/commands/database/get_current_config.rb
|
207
208
|
- lib/trueandco_analytics/console/commands/report_c/generate.rb
|
208
209
|
- lib/trueandco_analytics/console/extension_string.rb
|
209
210
|
- lib/trueandco_analytics/engine.rb
|