commento 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/commento/report.rb +3 -3
- data/lib/commento/{services/data_collect.rb → scrapers/ruby.rb} +9 -5
- data/lib/commento/version.rb +1 -1
- data/lib/commento.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a65354f12eb0a8c66c0bc901f87bb35f1ddf2d9d18f2b399c8e13758bc779e7
|
4
|
+
data.tar.gz: b0d88b4c72e2b6e6404b762b2113a6c61779c2d7a3cc4a7732c09452599d895c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: def8375883745c14c5fa4b032bec57a3e4030299fc79c4a0a214e46f177d4e962c93d99a2f899d51e8db450cb4e14ca26d5805430f678b5489b85f14893a72f1
|
7
|
+
data.tar.gz: b7fe5588c90a2c072efb614a43201220c443410ed149b3965ea5baf65e93276506e85fe61c4d859e2a15556e4d8232b379e6425f9b288013f48918594689c168
|
data/lib/commento/report.rb
CHANGED
@@ -4,12 +4,12 @@ module Commento
|
|
4
4
|
class Report
|
5
5
|
COMMENTO_FOLDER_NAME = 'commento'
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
@
|
7
|
+
def initialize(data_scraper: Commento::Scrapers::Ruby.new)
|
8
|
+
@data_scraper = data_scraper
|
9
9
|
end
|
10
10
|
|
11
11
|
def create_report
|
12
|
-
@commento_data = @
|
12
|
+
@commento_data = @data_scraper.call
|
13
13
|
FileUtils.mkdir_p(COMMENTO_FOLDER_NAME)
|
14
14
|
File.write(
|
15
15
|
"#{COMMENTO_FOLDER_NAME}/#{file_name}",
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Commento
|
4
|
-
module
|
5
|
-
class
|
4
|
+
module Scrapers
|
5
|
+
class Ruby
|
6
6
|
COMMENTO_MATCH_REGEXP = /^[ \t]*# commento:.+$/.freeze
|
7
7
|
|
8
8
|
# @data contains data with next format
|
@@ -32,13 +32,17 @@ module Commento
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
# commento line looks like
|
36
|
+
# commento: fantasy_sports.points, fantasy_sports.statistics
|
35
37
|
def iterate_filelines(lines, filename)
|
36
38
|
lines.each.with_index(1) do |line, index|
|
37
39
|
next unless COMMENTO_MATCH_REGEXP.match?(line)
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
41
|
+
fields = line.strip.split('# commento: ')[-1].split(',').map(&:strip)
|
42
|
+
fields.each do |field|
|
43
|
+
@data[field] ||= []
|
44
|
+
@data[field] << "#{filename}:#{index}"
|
45
|
+
end
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
data/lib/commento/version.rb
CHANGED
data/lib/commento.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commento
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdanov Anton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -82,7 +82,7 @@ files:
|
|
82
82
|
- lib/commento/helpers.rb
|
83
83
|
- lib/commento/report.rb
|
84
84
|
- lib/commento/reports/html.rb
|
85
|
-
- lib/commento/
|
85
|
+
- lib/commento/scrapers/ruby.rb
|
86
86
|
- lib/commento/version.rb
|
87
87
|
homepage: https://github.com/kortirso/commento
|
88
88
|
licenses:
|