pointmd_comments 0.1.1 → 0.1.2

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: 562f9314352d713e79b1000a52b8fb5118cf7c8380fbff54a42437a40fe5b1bb
4
- data.tar.gz: 80784c08130b3edcefd58d6c7e298eeacac14eb66c8ca59e56e3a751ae0a758b
3
+ metadata.gz: d1240669a7cadfb4f4b32107b6a88265099a1ec232d68826c2371b8281e9f16f
4
+ data.tar.gz: fb50998e48a4c61ae0d904c26ba9c56a4d297dd21a9b7529178a80d8078565aa
5
5
  SHA512:
6
- metadata.gz: 71ca6190c6db162d1aceaa231fffb7b00f9684dbfa7534adeb265c051bf910aa3b9de0d74cbe887f46e5d8ec03500511f657f4a80a971c8a6c6e8eeecb550884
7
- data.tar.gz: 869d4bbfa6491937846230d29c578dffa27be82df82669ae8d6693f32a18cd741eb966194bf9be78277f5680e5087846ad82098ca5f5d1f86eea22f5a8a92fac
6
+ metadata.gz: 65803978c6330f2d99f17c7eeb77594676ac34a37bc44df9566c37928c98f1e1eb9c0aa1af752da41560e52e3a35dd2d9ce32d2ee2604f74d4407229d4735399
7
+ data.tar.gz: 94dee964589f7260d3e320db9943b33311c98b360680a47d7c1b9e7838af2046e36176abb8be44a96df827f6197d280c7173a4ce1a64c6e7cfab182d3f7bb9b3
@@ -19,9 +19,7 @@ module PointmdComments
19
19
  class Error < StandardError; end
20
20
 
21
21
  def self.collect
22
- # DOESN'T WORK!!
23
22
  args = ARGV.dup
24
- puts args
25
23
  options = OptParser.new.parse
26
24
  Aggregators::Main.new(options).call
27
25
  rescue StandardError => e
@@ -1,10 +1,12 @@
1
1
  module PointmdComments
2
2
  module Aggregators
3
3
  class Main
4
- attr_reader :posts_aggregator, :browser, :comments_aggregator, :all_comments, :posts, :source, :path
4
+ attr_reader :posts_aggregator, :browser, :comments_aggregator, :all_comments, :posts, :source, :output, :path
5
5
 
6
6
  def initialize(options)
7
- @path = options[:path]
7
+ # Currently 'path' is not supported
8
+ @path = nil
9
+ @output = options[:output]
8
10
  @source = options[:source]
9
11
  @posts_aggregator = Aggregators::Posts.new(source: source, path: path)
10
12
  @comments_aggregator = Aggregators::Comments.new
@@ -44,10 +46,20 @@ module PointmdComments
44
46
  end
45
47
 
46
48
  def write_to_csv
47
- CSV.open('output.csv', 'w') do |csv|
49
+ file_path = output || default_output_path
50
+
51
+ CSV.open(file_path, 'w') do |csv|
48
52
  all_comments.each { |c| csv << c }
49
53
  end
50
54
  end
55
+
56
+ def default_output_path
57
+ "pointmd_comments_#{current_time}.csv"
58
+ end
59
+
60
+ def current_time
61
+ Time.now.strftime('%Y%m%d_%H%M')
62
+ end
51
63
  end
52
64
  end
53
65
  end
@@ -26,11 +26,11 @@ module PointmdComments
26
26
  options[:source] = s.to_sym
27
27
  end
28
28
  opts.on(
29
- '-p PATH',
30
- '--path=PATH',
31
- 'A file path to pull links from.'
32
- ) do |s|
33
- options[:source] = s.to_sym
29
+ '-o OUTPUT_PATH',
30
+ '--output=OUTPUT_PATH',
31
+ 'A custom file path for the CSV.'
32
+ ) do |p|
33
+ options[:output] = p
34
34
  end
35
35
  opts.on('-V', '--version', 'Version') do
36
36
  puts PointmdComments::VERSION
@@ -1,3 +1,3 @@
1
1
  module PointmdComments
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pointmd_comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolai Stoianov