web_stat 0.3.2 → 0.3.3
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/Gemfile.lock +1 -1
- data/lib/web_stat/config/web_stat.yml +21 -15
- data/lib/web_stat/configure.rb +30 -24
- data/lib/web_stat/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d27f9de72e744c0cff9c1876952b23d7dd86a3d8a8331ee95293ff06d0ad16a9
|
|
4
|
+
data.tar.gz: a9985bd6c7167e70bcffb0f215ce13afbdef85d34790a0a5486b72b7380b01fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f2a7d199c6cd737bb6b6facd97fd94324898ccb14554e2497d44d567f19c06deb127da3db5be968737d8dffde25b0b498845ebb60661408810891a3c4eea142
|
|
7
|
+
data.tar.gz: 0c1b425aa39397ac13e68009b20c0015d7939ce4af1faabbb2716b22e2cb2c4776aaecd59ab6328113a270c3a4d545f9d2d2d1472373e3f53d083cbcd3833186
|
data/Gemfile.lock
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
development: &development
|
|
2
|
+
# Minimum number of characters to detect meta title
|
|
3
|
+
min_length_of_meta_title: 10
|
|
4
|
+
# Split regular expression for titles
|
|
5
|
+
regex_to_sprit_title: '\||-|:|||:|〜|\~| – '
|
|
6
|
+
# User Agent
|
|
7
|
+
user_agent: "web_stat gem agent"
|
|
8
|
+
# Eyecatch image xpaths
|
|
9
|
+
eyecatch_image_xpaths:
|
|
10
|
+
- '/html/head/meta[@property="twitter:image"]/@content'
|
|
11
|
+
- '/html/head/meta[@property="og:image"]/@content'
|
|
12
|
+
- '//img[@class="attachment-post-thumbnail"]/@src'
|
|
13
|
+
- '//div[@id="content"]//img/@src'
|
|
14
|
+
- '//img/@src'
|
|
15
|
+
userdic: ""
|
|
16
|
+
use_chromedirver: false
|
|
17
|
+
test:
|
|
18
|
+
<<: *development
|
|
19
|
+
production:
|
|
20
|
+
<<: *development
|
|
21
|
+
use_chromedirver: true
|
data/lib/web_stat/configure.rb
CHANGED
|
@@ -3,31 +3,37 @@ module WebStat
|
|
|
3
3
|
class Configure
|
|
4
4
|
DEFAULT_CONFIG_FILE_PATH = 'config/web_stat.yml'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
self.get_custom_configure_path
|
|
15
|
-
else
|
|
16
|
-
self.get_default_configure_path
|
|
6
|
+
class << self
|
|
7
|
+
# Get yaml
|
|
8
|
+
def get
|
|
9
|
+
if defined? Rails
|
|
10
|
+
YAML.load_file(get_configure_path)[Rails.env]
|
|
11
|
+
else
|
|
12
|
+
YAML.load_file(get_configure_path)["production"]
|
|
13
|
+
end
|
|
17
14
|
end
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
File.join(
|
|
15
|
+
|
|
16
|
+
# Get configure path
|
|
17
|
+
def get_configure_path
|
|
18
|
+
if File.exists?(get_custom_configure_path)
|
|
19
|
+
get_custom_configure_path
|
|
20
|
+
else
|
|
21
|
+
get_default_configure_path
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Get default configure path
|
|
26
|
+
def get_default_configure_path
|
|
27
|
+
File.join(File.expand_path("../", __FILE__), DEFAULT_CONFIG_FILE_PATH)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Get custom configure path
|
|
31
|
+
def get_custom_configure_path
|
|
32
|
+
if defined? Rails
|
|
33
|
+
File.join(Rails.root, DEFAULT_CONFIG_FILE_PATH)
|
|
34
|
+
else
|
|
35
|
+
File.join(Bundler.root, DEFAULT_CONFIG_FILE_PATH)
|
|
36
|
+
end
|
|
31
37
|
end
|
|
32
38
|
end
|
|
33
39
|
end
|
data/lib/web_stat/version.rb
CHANGED