LoomioScraper 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26f80f227f0b2648c5e24b967fc86a92d1713b39
4
- data.tar.gz: eb50e1e0342329233337a0bc219757282ef1bfb8
3
+ metadata.gz: c59dfd88287bd018f8abfd43b38d97188d2b8bb7
4
+ data.tar.gz: b564c881863bb7073fd86848c63aeba9835a2bad
5
5
  SHA512:
6
- metadata.gz: 603eadccb6b8e1d6a5e60d4b5383b2f24bd14f1ea2237bb266c763ca4aa4903a427f846489c293ec9ce045144cf6a4c50acf635d75b4cd04bdfdae80c8ac7625
7
- data.tar.gz: 1580b085ff6aa250383fc94eab06762b9d6341daeb9518158ad2faee65088ee6b576672789977c7d4bb1135568afedd0c2e1b6bd96b8055e962588b9fed01068
6
+ metadata.gz: 8e3229ec5153b8b69ee1b66baacc0f5200410b2b3a3adca9f0e9091c9c51390b6e43f1f9f5c5804edc806035534b91ed1354fda1aefc264145c872c5e0570020
7
+ data.tar.gz: 22249680a421f7d1fb17cade0775360b210ee2ea82846bdd62ea49fb21f492275e979ee85e06184aa3874169c27248f6fd1d27165243cc951527c6b74ad3bba9
@@ -6,8 +6,8 @@ require 'LoomioScraper/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "LoomioScraper"
8
8
  spec.version = LoomioScraper::VERSION
9
- spec.authors = ["RDimon2912"]
10
- spec.email = ["rdimon2912@gmail.com"]
9
+ spec.authors = ["Dmitry Rozhkov", "Viktor Presniatski"]
10
+ spec.email = ["rdimon2912@gmail.com", "presniatski@gmail.com"]
11
11
 
12
12
  spec.summary = %q{Short summary}
13
13
  spec.description = %q{Scraper loomio activity}
@@ -6,4 +6,8 @@ require "LoomioScraper/activity"
6
6
 
7
7
  module LoomioScraper
8
8
  # Your code goes here...
9
+ def self.home_dir
10
+ Gem::Specification.find_by_name(self.name).gem_dir
11
+ end
12
+
9
13
  end
@@ -30,8 +30,8 @@ module LoomioScraper
30
30
  end
31
31
 
32
32
  class Activity < LoomioScraper::Scraper
33
- def initialize(*attr)
34
- super(*attr)
33
+ def initialize(url)
34
+ super(url)
35
35
  @attributes = %w{ comments }
36
36
  end
37
37
 
@@ -1,20 +1,23 @@
1
1
  module LoomioScraper
2
2
  class Scraper
3
3
 
4
- def initialize(url, *args)
5
- @dom = Scraper.html_loader(url, *args)
4
+ def initialize(url)
5
+ @dom = Scraper.html_loader(url)
6
6
  @attributes = []
7
7
  end
8
8
 
9
- def self.html_loader(url, file = 'index.html')
10
- # return Nokogiri::HTML(File.open('index.html').read)
11
-
9
+ def self.html_loader(url)
10
+ # return Nokogiri::HTML(File.open('index.html').read)
11
+ gem_path = LoomioScraper::home_dir
12
+
13
+ script_path = gem_path + '/lib/LoomioScraper/script.js'
14
+ file_path = gem_path + '/index.html'
12
15
  dom = html = nil
13
- pid ||= Process.spawn('phantomjs', "lib/LoomioScraper/script.js", url, file)
16
+ pid ||= Process.spawn('phantomjs', script_path, url, file_path)
14
17
  Process.waitpid(pid)
15
18
 
16
- html ||= File.open(file).read
17
- File.delete(file)
19
+ html ||= File.open(file_path).read
20
+ File.delete(file_path)
18
21
  dom ||= Nokogiri::HTML(html)
19
22
  end
20
23
 
@@ -4,9 +4,12 @@ var system = require('system');
4
4
 
5
5
 
6
6
  var link = system.args[1];
7
- var file = system.args[2] || "index.html";
7
+ var file = system.args[2];
8
8
 
9
- page.open(link);
9
+ console.log("file: " + file);
10
+ console.log("url: " + link);
11
+
12
+ page.open(link);
10
13
 
11
14
  page.onLoadFinished = function() {
12
15
  console.log("page load finished");
@@ -1,3 +1,3 @@
1
1
  module LoomioScraper
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: LoomioScraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
- - RDimon2912
7
+ - Dmitry Rozhkov
8
+ - Viktor Presniatski
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
@@ -55,6 +56,7 @@ dependencies:
55
56
  description: Scraper loomio activity
56
57
  email:
57
58
  - rdimon2912@gmail.com
59
+ - presniatski@gmail.com
58
60
  executables: []
59
61
  extensions: []
60
62
  extra_rdoc_files: []