pointmd_comments 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 564a71620179d2b409489f0b96711361c2dfceb07d268bbb47fb4e164934de35
4
- data.tar.gz: 2c77c09da91a7ccaad9f429107633cd04dce8747945b5063e45ddb9bf71e7414
3
+ metadata.gz: 198cd3c27d299997ca927ded8927ca90390751e51f7c21015b27b871915bfc0e
4
+ data.tar.gz: 27bb94862cbc8d391c9274fa2e921a10e62adb0d72892a4fb1a0070ec1190e17
5
5
  SHA512:
6
- metadata.gz: 211f18075aed368f744d3fb7d902849b09f642f8ac9275fe47a2b5ec6fb9a47acf327528f36941373b00f26d9f606685f4c372c88c35f5c06a8f46292823985d
7
- data.tar.gz: fa6938170ae9ed200a6b19ef385c0751c2bf03f48150bbb1ae591fab8ab01912c738a7d9cdd94b19c21a735a0356579f4579bbabd40aff2d2d5f2a0470450fed
6
+ metadata.gz: 2cab6853272b96d288ff0ec49b8b3924a884285fde307ecd56549f7d217dda576aa3f5813a85f908ed75c581db4cf2f3ed8d3b1b6d41702554ec81f9af633c1f
7
+ data.tar.gz: 56235e2eb248b0a2987b296686af0448be815ab0fc805db12cd8e4559ae73f6f8d799ec106494dd7957e324596790b405965391f56c728a981e903a472f02c0b
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'pointmd_comments'
3
3
 
4
- PointmdComments.collect
4
+ PointmdComments.collect_from_shell
@@ -16,7 +16,11 @@ require 'pointmd_comments/errors/unknown_source'
16
16
  module PointmdComments
17
17
  class Error < StandardError; end
18
18
 
19
- def self.collect
19
+ def self.collect(options = {})
20
+ Aggregators::Main.new(options).call
21
+ end
22
+
23
+ def self.collect_from_shell
20
24
  args = ARGV.dup
21
25
  options = OptParser.new.parse
22
26
  Aggregators::Main.new(options).call
@@ -6,8 +6,8 @@ module PointmdComments
6
6
  def initialize(options)
7
7
  # Currently 'path' is not supported
8
8
  @path = nil
9
- @output = options[:output]
10
- @source = options[:source]
9
+ @output = options[:output] || default_output_path
10
+ @source = options[:source] || Aggregators::Posts::DEFAULT_SOURCE
11
11
  @posts_aggregator = Aggregators::Posts.new(source: source, path: path)
12
12
  @comments_aggregator = Aggregators::Comments.new
13
13
  @browser = ::Watir::Browser.new :chrome, headless: true
@@ -46,7 +46,7 @@ module PointmdComments
46
46
  end
47
47
 
48
48
  def write_to_csv
49
- file_path = output || default_output_path
49
+ file_path = output
50
50
 
51
51
  CSV.open(file_path, 'w') do |csv|
52
52
  all_comments.each { |c| csv << c }
@@ -3,6 +3,7 @@ module PointmdComments
3
3
  class Posts
4
4
  # NOTE: This array may be populated with other website sections in the future.
5
5
  ALLOWED_SOURCES = %i[news today].freeze
6
+ DEFAULT_SOURCE = :news
6
7
  MAIN_PAGE = 'https://point.md/ru/'.freeze
7
8
 
8
9
  attr_reader :source, :urls
@@ -1,3 +1,3 @@
1
1
  module PointmdComments
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pointmd_comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolai Stoianov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-11 00:00:00.000000000 Z
11
+ date: 2020-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry