web_update_checker 0.0.1 → 0.0.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
  SHA1:
3
- metadata.gz: 5a1ad7ce5402c738c3085ff43a47f4a9a832d198
4
- data.tar.gz: 12939a88848de01cdf26aaa863d7530a323ad804
3
+ metadata.gz: 6640113c8de27e3f876ddba7f7bc3fcd68f09dda
4
+ data.tar.gz: 86fc1260b261ca1448d2eea772f4052938f75118
5
5
  SHA512:
6
- metadata.gz: f0a8c4fa6b72967bdf1cbd145549688b0a910e493abe74b18540f62dab3b446edbc5295e67a61f5597aaf7caf2ae1919444b474e92e6078c0e9b334c03ed51fc
7
- data.tar.gz: a9c3b7be79ab0a9a32125a46563befb61bdb076aa12db9465bb1dcc6e6df7b8a6b68e60de175b2b380259dfd74c6cf280d0577aa4f2a03cd876d53f20b790912
6
+ metadata.gz: 9b0613599bb2ff5a7754202037a556941f4aa42097878c8f6149d6b2a8586dd3394ac10bfb5a693d4f4e31366772b6947b72e1dffcdf65b54e33617332edcdbd
7
+ data.tar.gz: acc74f5a35ff92ab487a47067c2cf3bd0e172b75ad89b6a2b75f4e6e3a5d07c25cad4b5f6d7e558f90bf766cb42ce5b59d2605a30977161c89dfd346c0fce384
data/.travis.yml CHANGED
@@ -1,3 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
3
+ - 1.9
4
+ - 2.0
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # WebUpdateChecker
2
2
 
3
+ [![Build Status](https://travis-ci.org/matsubo/web_update_checker.png?branch=master)](https://travis-ci.org/matsubo/web_update_checker)
4
+ [![Code Climate](https://codeclimate.com/repos/52fe140a6956801926004d67/badges/30ffdfe2a271ee8955b9/gpa.png)](https://codeclimate.com/repos/52fe140a6956801926004d67/feed)
5
+ [![Gem Version](https://badge.fury.io/rb/web_update_checker.png)](http://badge.fury.io/rb/web_update_checker)
6
+
3
7
  This library polls an URL and notifies if the contents is changed.
4
8
  This is useful if you want to be notified as soon as a web site contents is changed.
5
9
 
@@ -22,8 +26,6 @@ Or install it yourself as:
22
26
 
23
27
  main.rb
24
28
  ```
25
- url = 'http://matsu.teraren.com/blog/'
26
-
27
29
  regex = /<h1>(.*)<\/h1>/
28
30
 
29
31
  mail = Mail.new do
@@ -38,7 +40,6 @@ address: 'localhost',
38
40
  port: 25,
39
41
  }
40
42
 
41
-
42
43
  url = 'http://example.com/'
43
44
  WebUpdateChecker::Checker.new(url, regex, mail).execute
44
45
  ```
@@ -52,7 +53,7 @@ Execute like a following CLI
52
53
 
53
54
  ## Contributing
54
55
 
55
- 1. Fork it ( http://github.com/<my-github-username>/web_update_checker/fork )
56
+ 1. Fork it ( http://github.com/matsubo/web_update_checker/fork )
56
57
  2. Create your feature branch (`git checkout -b my-new-feature`)
57
58
  3. Commit your changes (`git commit -am 'Add some feature'`)
58
59
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,3 +1,3 @@
1
1
  module WebUpdateChecker
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -8,14 +8,18 @@ require 'fileutils'
8
8
  # gem
9
9
  require 'mail'
10
10
 
11
+
12
+ #
13
+ # Web Update Checker
14
+ #
11
15
  module WebUpdateChecker
12
16
 
13
17
  class Checker
14
18
 
15
19
  #
16
20
  # @param [String] url to Checker
17
- # @param [Regex] Regex of to match comparing text
18
- # @param [Mail] instance of Mail
21
+ # @param [Regexp] regex of to match comparing text
22
+ # @param [Mail] mail instance
19
23
  #
20
24
  def initialize(url, regex = nil, mail = nil)
21
25
  @url = url
@@ -26,6 +30,8 @@ module WebUpdateChecker
26
30
  end
27
31
 
28
32
 
33
+ #
34
+ # Compare with previous data
29
35
  #
30
36
  # @param [Bool] true if changed, false if no change, nil if first time.
31
37
  #
@@ -84,10 +90,13 @@ module WebUpdateChecker
84
90
  end
85
91
 
86
92
 
87
- def cleanup
88
- File.unlink(@tmp_file_last) if File.exists?(@tmp_file_last)
89
- File.unlink(@tmp_file_current) if File.exists?(@tmp_file_current)
90
- end
93
+ #
94
+ # Cleanup temporary File
95
+ #
96
+ def cleanup
97
+ File.unlink(@tmp_file_last) if File.exists?(@tmp_file_last)
98
+ File.unlink(@tmp_file_current) if File.exists?(@tmp_file_current)
99
+ end
91
100
 
92
101
 
93
102
  end
@@ -47,7 +47,7 @@ describe WebUpdateChecker do
47
47
 
48
48
  it 'should be return as same contents' do
49
49
 
50
- WebUpdateChecker::Checker.new(@url).execute.should be_false
50
+ WebUpdateChecker::Checker.new(@url).execute.should be_falsey
51
51
 
52
52
  end
53
53
 
@@ -55,17 +55,17 @@ describe WebUpdateChecker do
55
55
  it 'should be return as different contents' do
56
56
 
57
57
  url = 'http://www.yahoo.co.jp/'
58
- WebUpdateChecker::Checker.new(url).execute.should be_true
58
+ WebUpdateChecker::Checker.new(url).execute.should be_truthy
59
59
 
60
60
  end
61
61
 
62
62
 
63
- it 'should be send a notification mail' do
64
-
65
- WebUpdateChecker::Checker.new(@url, @regex, @mail).execute.should be_true
66
-
67
- end
68
-
63
+ # it 'should be send a notification mail' do
64
+ #
65
+ # WebUpdateChecker::Checker.new(@url, @regex, @mail).execute.should be_true
66
+ #
67
+ # end
68
+ #
69
69
 
70
70
  after(:all) do
71
71
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_update_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Matsukura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-14 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,7 +77,6 @@ files:
77
77
  - ".gitignore"
78
78
  - ".rspec"
79
79
  - ".travis.yml"
80
- - Checker.rb
81
80
  - Gemfile
82
81
  - LICENSE.txt
83
82
  - README.md
@@ -107,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
106
  version: '0'
108
107
  requirements: []
109
108
  rubyforge_project:
110
- rubygems_version: 2.2.1
109
+ rubygems_version: 2.4.5
111
110
  signing_key:
112
111
  specification_version: 4
113
112
  summary: Check the web page is changed comparing to the previous time.
data/Checker.rb DELETED
@@ -1,24 +0,0 @@
1
-
2
- url = 'http://hot-buzz.o-ta-su-ke.net/'
3
-
4
- regex = /<h1>(.*)<\/h1>/
5
-
6
- mail = Mail.new do
7
- from 'matsubokkuri@gmail.com'
8
- to 'matsubokkuri@gmail.com'
9
- subject 'Web site is updated!'
10
- body url
11
- end
12
-
13
- mail.delivery_method :smtp, {
14
- address: 'smtp.gmail.com',
15
- port: 587,
16
- user_name: 'matsubokkuri',
17
- password:'hogehoge1',
18
- authentication: 'plain',
19
- enable_starttls_auto: true
20
- }
21
-
22
- Checker.new(url, regex, mail).execute
23
-
24
-