html_radar 0.0.2 → 0.0.8

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: 4516a1e573f0e691434a1c9ea100c53649dc8d6f
4
- data.tar.gz: 3d9b696c067de37618296f65868184a019654ce8
3
+ metadata.gz: 15bfc290c5722c9696dea48e1f052022e79bb29b
4
+ data.tar.gz: 43624f827b198917c78dec68e6840975d9e238fe
5
5
  SHA512:
6
- metadata.gz: c68f29d14250c53626a797c96da8c87a25a981d5670c8d5975e986f4a5fc5680870722fb9b17d9931f0283da41e14fa75a00caf914668417915da14938fed345
7
- data.tar.gz: 36036bfe4388580c75b208b46b6a77be409abe19a96e7b3c7fb3e55d67a3a7820cde053ed9df32be193eedf27e73e60242959df583e0d0eaabd7234a876617dd
6
+ metadata.gz: 14e678e1e62bd842e06839709080dcf6f37af4e2123727c4740e8ce6de80be75346d026cbed5c02eb4e54227eb2ab778cc88aedf53a266c15c965ff9f3b5aea3
7
+ data.tar.gz: 7138cb5629dc2981afa41cf24f73421a1311cfb40681f1cdeac3734f723c2c2cdcea66dea1a437bd9a93e94f22579a69580bb661cbd74bc7fd7fa8816899f138
data/README.rdoc CHANGED
@@ -1,3 +1,52 @@
1
1
  = HtmlRadar
2
2
 
3
- This project rocks and uses MIT-LICENSE.
3
+ == Finds Change in URL Content
4
+
5
+ Scrapes, Remembers, Outputs Change in URL Content."
6
+
7
+ = Installation
8
+
9
+ # Gemfile
10
+
11
+ gem 'html_radar'
12
+
13
+ = Usage
14
+
15
+ == Givens
16
+
17
+ http://test.html = "
18
+ <html><body>
19
+ <p><a href='http://test.html'>Static</a></p>
20
+ <p><a href='http://test.html'>Dynamic</a></p>
21
+ </body></html>"
22
+
23
+ url = "test.html"
24
+ css_selector = "a"
25
+ item_tag = "ul"
26
+ top_id = "_123_"
27
+
28
+ memory = ""
29
+
30
+ === html_radar creates a memory...
31
+
32
+ memory = HtmlRadar.refresh(memory, url, css_selector, item_tag, top_id)
33
+
34
+ === html_radar remembers memory...
35
+
36
+ remember = HtmlRadar.show(memory).to_s
37
+ remember.scan("Static").present? #=> TRUE
38
+ memory.scan("Static").present? #=> TRUE
39
+
40
+ === html_radar evolves the memory...
41
+
42
+ memory = HtmlRadar.refresh(memory, url, css_selector, item_tag, top_id)
43
+
44
+ === html_radar compares memories...
45
+
46
+ remember = HtmlRadar.show(memory).to_s
47
+ remember.scan("Static").present? #=> FALSE
48
+ memory.scan("Static").present? #=> TRUE
49
+
50
+ = License
51
+
52
+ MIT-LICENSE.
@@ -1,3 +1,3 @@
1
1
  module HtmlRadar
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.8"
3
3
  end
data/lib/html_radar.rb CHANGED
@@ -1,3 +1,223 @@
1
1
  module HtmlRadar
2
- require 'railtie' if defined?(Rails)
2
+
3
+ require 'action_view'
4
+
5
+ #def self.show(memory) #=> latest_change
6
+ def self.show(memory)
7
+ x = set_defaults(memory)
8
+ return show_latest(x)
9
+ end
10
+
11
+ #def self.refresh(memory, url, css_selector, top_id) #=> new_memory
12
+ def self.refresh(memory, url, css_selector, item_tag, top_id)
13
+ x = set_defaults(memory, url, css_selector, item_tag, top_id)
14
+ if x[:refresh_ready]
15
+ x = add_new(x)
16
+ x = add_old(x)
17
+ x = add_diff(x)
18
+ x = prepend_diff(x)
19
+ end
20
+ return x[:memory]
21
+ end
22
+
23
+ def self.show_latest(x)
24
+ return x[:memory].to_s.split(x[:split_tag]).first
25
+ end
26
+
27
+ def self.set_defaults(memory, url=nil, css_selector=nil, item_tag="p", top_id="_top_")
28
+ x={}
29
+ x[:memory] = memory
30
+ x[:url] = url
31
+ x[:css_selector] = css_selector
32
+ x[:item_tag] = item_tag
33
+ x[:top_id] = top_id
34
+ x[:refresh_ready] = (url.present? and css_selector.present? and item_tag.present? and top_id.present?)
35
+ x[:base_url] = x[:url].to_s.split("/")[0..2].join("/") + "/"
36
+ x[:split_tag] = "<!-- split_tag -->"
37
+ return x
38
+ end
39
+
40
+ def self.prepend_diff(x)
41
+ if x[:diff].present?
42
+ x[:memory] = ((x[:diff]) + (x[:split_tag]) + (x[:diff_old]) )
43
+ else
44
+ x[:memory] = ((x[:split_tag]) + (x[:diff_old]) )
45
+ end
46
+ return x
47
+ end
48
+
49
+ def self.add_diff(x)
50
+
51
+ old_a, old_hsh = get_diff_a_and_hsh(x[:css_selector], x[:old_docs])
52
+ new_a, new_hsh = get_diff_a_and_hsh(x[:css_selector], x[:new_docs])
53
+ diff_a = (new_a - old_a)
54
+
55
+ diff_s = ""
56
+ for diff in diff_a
57
+ begin
58
+ if Sanitize.clean( ( (new_hsh[diff]) ) ).present?
59
+ diff_s << "<#{x[:item_tag]}>#{new_hsh[diff]}</#{x[:item_tag]}>"
60
+ diff_s << "<center>#{Time.now.to_s}</center>"
61
+ diff_s << "<center><a href='##{x[:top_id]}'>###</a></center>"
62
+ diff_s << "<hr />"
63
+ end
64
+ end
65
+ end
66
+ x[:diff] = diff_s
67
+
68
+ diff_s = ""
69
+ for diff in old_a[0..300]
70
+ diff_s << "<#{x[:item_tag]}>#{new_hsh[diff]}</#{x[:item_tag]}>"
71
+ diff_s << "<center>#{Time.now.to_s}</center>"
72
+ diff_s << "<center><a href='##{x[:top_id]}'>###</a></center>"
73
+ diff_s << "<hr />"
74
+ end
75
+ x[:diff_old] = diff_s
76
+
77
+ return x
78
+ end
79
+
80
+ def self.get_diff_a_and_hsh(css_selector, docs)
81
+ doc_a = []
82
+ doc_hsh = {}
83
+ length = 255
84
+ css_selector = css_selector.split(" ").last
85
+ for doc in docs.css(css_selector)
86
+ d = 1
87
+ doc_s = doc.to_s
88
+ a = doc_s.gsub(/[^a-zA-Z]/i,'').to_s.downcase
89
+ aa = a.split('').uniq
90
+ for b in aa
91
+ d += b.ord
92
+ d *= a.scan(b).size
93
+ end
94
+ doc_id = d.to_s
95
+ unless doc_a.include?(doc_id)
96
+ doc_a << doc_id
97
+ doc_hsh[doc_id] = doc_s
98
+ end
99
+ end
100
+ return doc_a, doc_hsh
101
+ end
102
+
103
+ def self.add_old(x)
104
+ x = add_old_content(x)
105
+ x = add_old_docs(x)
106
+ return x
107
+ end
108
+
109
+ def self.add_new(x)
110
+ x = add_new_content(x)
111
+ x = fix_new_content_base_url(x)
112
+ x = fix_new_content_base_url_target(x)
113
+ x = add_new_docs(x)
114
+ return x
115
+ end
116
+
117
+ def self.fix_new_content_base_url_target(x)
118
+ content = x[:new_content]
119
+ content = content.to_s.gsub("href=", "target='_blank' href=")
120
+ x[:new_content] = content
121
+ return x
122
+ end
123
+
124
+ def self.fix_new_content_base_url(x)
125
+ base_url = x[:base_url]
126
+ content = x[:new_content]
127
+ content = get_content_mix_base_url_selector(base_url, content, "href=\"")
128
+ content = get_content_mix_base_url_selector(base_url, content, "href=\'")
129
+ content = get_content_mix_base_url_selector(base_url, content, "src=\"")
130
+ content = get_content_mix_base_url_selector(base_url, content, "src=\'")
131
+ env_base_url = (base_url+"/")
132
+ content = content.gsub(env_base_url, base_url)
133
+ double_base_url = base_url + base_url
134
+ content = content.gsub(double_base_url, base_url)
135
+ mutant_base_url = (base_url+"http")
136
+ content = content.gsub(mutant_base_url, "http")
137
+ x[:new_content] = content
138
+ return x
139
+ end
140
+
141
+ def self.get_content_mix_base_url_selector(base_url, content, selector)
142
+ selector_with_base_url = selector + base_url
143
+ content = content.to_s.gsub(selector, selector_with_base_url)
144
+ return content.to_s
145
+ end
146
+
147
+
148
+ def self.add_new_docs(x)
149
+ x[:new_docs] = Nokogiri::HTML(x[:new_content])
150
+ return x
151
+ end
152
+
153
+ def self.add_old_docs(x)
154
+ x[:old_docs] = Nokogiri::HTML(x[:old_content])
155
+ return x
156
+ end
157
+
158
+ def self.mix_base_url_to_doc(element, doc, base_url)
159
+
160
+ doc_element = doc[element]
161
+ if doc_element.present? and !get_first_match(doc_element, element)
162
+ doc_element_a = doc_element.split("")
163
+ if (doc_element_a.first == "/")
164
+ doc_element_a.shift
165
+ doc_element = doc_element_a.join
166
+ end
167
+ doc[element] = base_url + doc_element
168
+ doc["target"] = "_blank" if element=="href"
169
+ end
170
+ return doc
171
+ end
172
+
173
+ def self.add_new_content(x)
174
+ begin
175
+ if x[:url].present?
176
+ if x[:url]=='http://test.html'
177
+ x[:new_content] = "
178
+ <html><body>
179
+ <p><a href='http://www.abcbots.com/test'>Static</a></p>
180
+ <p><a href='http://www.abcbots.com/test'>Dynamic: #{pass=get_random(10)}</a></p>
181
+ <p><a href='http://www.abcbots.com/test'>Dynamic: #{pass}</a></p>
182
+ </body></html>"
183
+ else
184
+ x[:new_content] = open(source_url.to_s).read.to_s.gsub("@", " @")
185
+ end
186
+ else
187
+ x[:new_content] = ""
188
+ end
189
+ rescue
190
+ x[:new_content] = "(Access Denied)"
191
+ end
192
+ return x
193
+ end
194
+
195
+ def self.get_random(pass_qty=30)
196
+ s = SecureRandom.base64(pass_qty).to_s
197
+ s = s.gsub("/", SecureRandom.hex(1).first.to_s)
198
+ s = s.gsub("+", SecureRandom.hex(1).first.to_s)
199
+ return s.gsub("==", SecureRandom.hex(1).first.to_s)
200
+ end
201
+
202
+ def self.add_old_content(x)
203
+ x[:old_content] = x[:memory].to_s
204
+ return x
205
+ end
206
+
207
+ # Hola.hi #=> "Hello World!"
208
+ def self.hi
209
+ puts "Hello World!"
210
+ return "Hello World!"
211
+ end
212
+
213
+ # Hola.get_url("http://www.google.com") #=> "<html>...</html>"
214
+ def self.get_url(a="")
215
+ content = open(a.to_s).read.to_s.gsub("@", " @_")
216
+ docs = Nokogiri::HTML(content)
217
+ docs = docs.to_s.gsub(" @_", "@").to_s
218
+ puts a+": "+docs
219
+ return docs.to_s
220
+ end
221
+
222
+
3
223
  end
@@ -0,0 +1,2 @@
1
+ class User < ActiveRecord::Base
2
+ end
@@ -8,32 +8,27 @@
8
8
  #
9
9
  # And be sure to use new-style password hashing:
10
10
  # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+
11
16
  development:
12
17
  adapter: mysql2
13
18
  encoding: utf8
19
+ reconnect: false
14
20
  database: dummy_development
15
21
  pool: 5
16
22
  username: root
17
- password:
18
23
  socket: /var/lib/mysql/mysql.sock
19
24
 
20
- # Warning: The database defined as "test" will be erased and
21
- # re-generated from your development database when you run "rake".
22
- # Do not set this db to the same as development or production.
23
25
  test:
24
26
  adapter: mysql2
25
27
  encoding: utf8
28
+ reconnect: false
26
29
  database: dummy_test
27
30
  pool: 5
28
31
  username: root
29
- password:
30
32
  socket: /var/lib/mysql/mysql.sock
31
33
 
32
- production:
33
- adapter: mysql2
34
- encoding: utf8
35
- database: dummy_production
36
- pool: 5
37
- username: root
38
- password:
39
- socket: /var/lib/mysql/mysql.sock
34
+
@@ -9,4 +9,4 @@
9
9
 
10
10
  # Make sure your secret_key_base is kept private
11
11
  # if you're sharing your code publicly.
12
- Dummy::Application.config.secret_key_base = 'd1b333916a1facdc03771f6133e819a8c902be006dc84c7687d0641a163c559252a04bc667fef72156f667d2771195c1594eb8ca56c989ea04e300ae4ef5e10d'
12
+ Dummy::Application.config.secret_key_base = 'ed08e998a374729a64e97760a8ef574522ed30fb89a413218ec9011274d86df66d9cc8955dc7c4a2c16866515ed8547bce931b3a1fc1060e1d45dd45291a1187'
@@ -39,7 +39,7 @@ Dummy::Application.routes.draw do
39
39
  # get 'recent', on: :collection
40
40
  # end
41
41
  # end
42
-
42
+
43
43
  # Example resource route with concerns:
44
44
  # concern :toggleable do
45
45
  # post 'toggle'
@@ -0,0 +1,9 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20131104025531) do
15
+
16
+ create_table "users", force: true do |t|
17
+ t.string "name"
18
+ t.datetime "created_at"
19
+ t.datetime "updated_at"
20
+ end
21
+
22
+ end
@@ -0,0 +1,9 @@
1
+  (130.7ms) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB
2
+  (121.9ms) CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
3
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT `schema_migrations`.* FROM `schema_migrations`
4
+ Migrating to CreateUsers (20131104025531)
5
+  (111.8ms) CREATE TABLE `users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `name` varchar(255), `created_at` datetime, `updated_at` datetime) ENGINE=InnoDB
6
+  (0.3ms) BEGIN
7
+ SQL (0.5ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20131104025531')
8
+  (29.9ms) COMMIT
9
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT `schema_migrations`.* FROM `schema_migrations`
@@ -0,0 +1,495 @@
1
+  (0.1ms) BEGIN
2
+ -------------------------
3
+ HtmlRadarTest: test_truth
4
+ -------------------------
5
+  (0.1ms) ROLLBACK
6
+  (0.1ms) BEGIN
7
+ -------------------------
8
+ HtmlRadarTest: test_truth
9
+ -------------------------
10
+  (0.1ms) ROLLBACK
11
+  (0.1ms) BEGIN
12
+ --------------------------------
13
+ HtmlRadarTest: test_HtmlRadar.hi
14
+ --------------------------------
15
+  (0.1ms) ROLLBACK
16
+  (0.0ms) BEGIN
17
+ -----------------------------------------
18
+ HtmlRadarTest: test_HtmlRadar_refresh_url
19
+ -----------------------------------------
20
+  (0.2ms) ROLLBACK
21
+  (0.1ms) BEGIN
22
+ --------------------------------------
23
+ HtmlRadarTest: test_HtmlRadar_show_url
24
+ --------------------------------------
25
+  (0.2ms) ROLLBACK
26
+  (0.1ms) BEGIN
27
+ -------------------------
28
+ HtmlRadarTest: test_truth
29
+ -------------------------
30
+  (0.1ms) ROLLBACK
31
+  (0.1ms) BEGIN
32
+ --------------------------------
33
+ HtmlRadarTest: test_HtmlRadar.hi
34
+ --------------------------------
35
+  (0.1ms) ROLLBACK
36
+  (0.1ms) BEGIN
37
+ -----------------------------------------
38
+ HtmlRadarTest: test_HtmlRadar_refresh_url
39
+ -----------------------------------------
40
+  (0.1ms) ROLLBACK
41
+  (0.2ms) BEGIN
42
+ --------------------------------------
43
+ HtmlRadarTest: test_HtmlRadar_show_url
44
+ --------------------------------------
45
+  (0.1ms) ROLLBACK
46
+  (0.2ms) BEGIN
47
+ -------------------------
48
+ HtmlRadarTest: test_truth
49
+ -------------------------
50
+  (0.1ms) ROLLBACK
51
+  (0.1ms) BEGIN
52
+ --------------------------------
53
+ HtmlRadarTest: test_HtmlRadar.hi
54
+ --------------------------------
55
+  (0.1ms) ROLLBACK
56
+  (0.0ms) BEGIN
57
+ -----------------------------------------
58
+ HtmlRadarTest: test_HtmlRadar_refresh_url
59
+ -----------------------------------------
60
+  (0.1ms) ROLLBACK
61
+  (0.1ms) BEGIN
62
+ --------------------------------------
63
+ HtmlRadarTest: test_HtmlRadar_show_url
64
+ --------------------------------------
65
+  (0.1ms) ROLLBACK
66
+  (0.1ms) BEGIN
67
+ -------------------------
68
+ HtmlRadarTest: test_truth
69
+ -------------------------
70
+  (0.1ms) ROLLBACK
71
+  (0.1ms) BEGIN
72
+ --------------------------------
73
+ HtmlRadarTest: test_HtmlRadar.hi
74
+ --------------------------------
75
+  (0.1ms) ROLLBACK
76
+  (0.1ms) BEGIN
77
+ -----------------------------------------
78
+ HtmlRadarTest: test_HtmlRadar_refresh_url
79
+ -----------------------------------------
80
+  (0.1ms) ROLLBACK
81
+  (0.1ms) BEGIN
82
+ --------------------------------------
83
+ HtmlRadarTest: test_HtmlRadar_show_url
84
+ --------------------------------------
85
+  (0.1ms) ROLLBACK
86
+  (0.1ms) BEGIN
87
+ -------------------------
88
+ HtmlRadarTest: test_truth
89
+ -------------------------
90
+  (0.1ms) ROLLBACK
91
+  (0.3ms) BEGIN
92
+ --------------------------------
93
+ HtmlRadarTest: test_HtmlRadar.hi
94
+ --------------------------------
95
+  (0.2ms) ROLLBACK
96
+  (0.2ms) BEGIN
97
+ -----------------------------------------
98
+ HtmlRadarTest: test_HtmlRadar_refresh_url
99
+ -----------------------------------------
100
+  (0.2ms) ROLLBACK
101
+  (0.1ms) BEGIN
102
+ --------------------------------------
103
+ HtmlRadarTest: test_HtmlRadar_show_url
104
+ --------------------------------------
105
+  (0.1ms) ROLLBACK
106
+  (0.1ms) BEGIN
107
+ -------------------------
108
+ HtmlRadarTest: test_truth
109
+ -------------------------
110
+  (0.1ms) ROLLBACK
111
+  (0.1ms) BEGIN
112
+ --------------------------------
113
+ HtmlRadarTest: test_HtmlRadar.hi
114
+ --------------------------------
115
+  (0.1ms) ROLLBACK
116
+  (0.1ms) BEGIN
117
+ -----------------------------------------
118
+ HtmlRadarTest: test_HtmlRadar_refresh_url
119
+ -----------------------------------------
120
+  (0.1ms) ROLLBACK
121
+  (0.1ms) BEGIN
122
+ --------------------------------------
123
+ HtmlRadarTest: test_HtmlRadar_show_url
124
+ --------------------------------------
125
+  (0.1ms) ROLLBACK
126
+  (0.1ms) BEGIN
127
+ -------------------------
128
+ HtmlRadarTest: test_truth
129
+ -------------------------
130
+  (0.1ms) ROLLBACK
131
+  (0.1ms) BEGIN
132
+ --------------------------------
133
+ HtmlRadarTest: test_HtmlRadar.hi
134
+ --------------------------------
135
+  (0.1ms) ROLLBACK
136
+  (0.1ms) BEGIN
137
+ -----------------------------------------
138
+ HtmlRadarTest: test_HtmlRadar_refresh_url
139
+ -----------------------------------------
140
+  (0.3ms) ROLLBACK
141
+  (0.1ms) BEGIN
142
+ --------------------------------
143
+ HtmlRadarTest: test_HtmlRadar.hi
144
+ --------------------------------
145
+  (0.1ms) ROLLBACK
146
+  (0.1ms) BEGIN
147
+ -----------------------------------------
148
+ HtmlRadarTest: test_HtmlRadar_refresh_url
149
+ -----------------------------------------
150
+  (0.1ms) ROLLBACK
151
+  (0.1ms) BEGIN
152
+ --------------------------------------
153
+ HtmlRadarTest: test_HtmlRadar_show_url
154
+ --------------------------------------
155
+  (0.1ms) ROLLBACK
156
+  (0.1ms) BEGIN
157
+ -------------------------
158
+ HtmlRadarTest: test_truth
159
+ -------------------------
160
+  (0.1ms) ROLLBACK
161
+  (0.1ms) BEGIN
162
+ --------------------------------
163
+ HtmlRadarTest: test_HtmlRadar.hi
164
+ --------------------------------
165
+  (0.1ms) ROLLBACK
166
+  (0.1ms) BEGIN
167
+ -----------------------------------------
168
+ HtmlRadarTest: test_HtmlRadar_refresh_url
169
+ -----------------------------------------
170
+  (0.3ms) ROLLBACK
171
+  (0.1ms) BEGIN
172
+ --------------------------------
173
+ HtmlRadarTest: test_HtmlRadar.hi
174
+ --------------------------------
175
+  (0.1ms) ROLLBACK
176
+  (0.1ms) BEGIN
177
+ -----------------------------------------
178
+ HtmlRadarTest: test_HtmlRadar_refresh_url
179
+ -----------------------------------------
180
+  (0.4ms) ROLLBACK
181
+  (0.1ms) BEGIN
182
+ --------------------------------
183
+ HtmlRadarTest: test_HtmlRadar.hi
184
+ --------------------------------
185
+  (0.1ms) ROLLBACK
186
+  (0.1ms) BEGIN
187
+ -----------------------------------------
188
+ HtmlRadarTest: test_HtmlRadar_refresh_url
189
+ -----------------------------------------
190
+  (0.2ms) ROLLBACK
191
+  (0.1ms) BEGIN
192
+ --------------------------------
193
+ HtmlRadarTest: test_HtmlRadar.hi
194
+ --------------------------------
195
+  (0.1ms) ROLLBACK
196
+  (0.1ms) BEGIN
197
+ -----------------------------------------
198
+ HtmlRadarTest: test_HtmlRadar_refresh_url
199
+ -----------------------------------------
200
+  (0.3ms) ROLLBACK
201
+  (0.1ms) BEGIN
202
+ --------------------------------
203
+ HtmlRadarTest: test_HtmlRadar.hi
204
+ --------------------------------
205
+  (0.1ms) ROLLBACK
206
+  (0.1ms) BEGIN
207
+ -----------------------------------------
208
+ HtmlRadarTest: test_HtmlRadar_refresh_url
209
+ -----------------------------------------
210
+  (0.1ms) ROLLBACK
211
+  (0.1ms) BEGIN
212
+ --------------------------------------
213
+ HtmlRadarTest: test_HtmlRadar_show_url
214
+ --------------------------------------
215
+  (0.1ms) ROLLBACK
216
+  (0.1ms) BEGIN
217
+ -------------------------
218
+ HtmlRadarTest: test_truth
219
+ -------------------------
220
+  (0.1ms) ROLLBACK
221
+  (0.1ms) BEGIN
222
+ --------------------------------
223
+ HtmlRadarTest: test_HtmlRadar.hi
224
+ --------------------------------
225
+  (0.1ms) ROLLBACK
226
+  (0.1ms) BEGIN
227
+ -------------------------------------
228
+ HtmlRadarTest: test_HtmlRadar_refresh
229
+ -------------------------------------
230
+  (0.1ms) ROLLBACK
231
+  (0.1ms) BEGIN
232
+ ----------------------------------
233
+ HtmlRadarTest: test_HtmlRadar_show
234
+ ----------------------------------
235
+  (0.1ms) ROLLBACK
236
+  (0.1ms) BEGIN
237
+ -------------------------
238
+ HtmlRadarTest: test_truth
239
+ -------------------------
240
+  (0.1ms) ROLLBACK
241
+  (0.1ms) BEGIN
242
+ --------------------------------
243
+ HtmlRadarTest: test_HtmlRadar.hi
244
+ --------------------------------
245
+  (0.1ms) ROLLBACK
246
+  (0.1ms) BEGIN
247
+ -------------------------------------
248
+ HtmlRadarTest: test_HtmlRadar_refresh
249
+ -------------------------------------
250
+  (0.1ms) ROLLBACK
251
+  (0.1ms) BEGIN
252
+ ----------------------------------
253
+ HtmlRadarTest: test_HtmlRadar_show
254
+ ----------------------------------
255
+  (0.1ms) ROLLBACK
256
+  (0.1ms) BEGIN
257
+ -------------------------
258
+ HtmlRadarTest: test_truth
259
+ -------------------------
260
+  (0.1ms) ROLLBACK
261
+  (0.1ms) BEGIN
262
+ --------------------------------
263
+ HtmlRadarTest: test_HtmlRadar.hi
264
+ --------------------------------
265
+  (0.1ms) ROLLBACK
266
+  (0.1ms) BEGIN
267
+ -------------------------------------
268
+ HtmlRadarTest: test_HtmlRadar_refresh
269
+ -------------------------------------
270
+  (0.1ms) ROLLBACK
271
+  (0.1ms) BEGIN
272
+ ----------------------------------
273
+ HtmlRadarTest: test_HtmlRadar_show
274
+ ----------------------------------
275
+  (0.1ms) ROLLBACK
276
+  (0.2ms) BEGIN
277
+ --------------------------------
278
+ HtmlRadarTest: test_HtmlRadar.hi
279
+ --------------------------------
280
+  (0.1ms) ROLLBACK
281
+  (0.1ms) BEGIN
282
+ -------------------------------------
283
+ HtmlRadarTest: test_HtmlRadar_refresh
284
+ -------------------------------------
285
+  (0.1ms) ROLLBACK
286
+  (0.1ms) BEGIN
287
+ ----------------------------------
288
+ HtmlRadarTest: test_HtmlRadar_show
289
+ ----------------------------------
290
+  (0.1ms) ROLLBACK
291
+  (0.1ms) BEGIN
292
+ --------------------------------
293
+ HtmlRadarTest: test_HtmlRadar.hi
294
+ --------------------------------
295
+  (0.1ms) ROLLBACK
296
+  (0.1ms) BEGIN
297
+ -------------------------------------
298
+ HtmlRadarTest: test_HtmlRadar_refresh
299
+ -------------------------------------
300
+  (0.1ms) ROLLBACK
301
+  (0.1ms) BEGIN
302
+ ----------------------------------
303
+ HtmlRadarTest: test_HtmlRadar_show
304
+ ----------------------------------
305
+  (0.1ms) ROLLBACK
306
+  (0.1ms) BEGIN
307
+ --------------------------------
308
+ HtmlRadarTest: test_HtmlRadar.hi
309
+ --------------------------------
310
+  (0.1ms) ROLLBACK
311
+  (0.1ms) BEGIN
312
+ -------------------------------------
313
+ HtmlRadarTest: test_HtmlRadar_refresh
314
+ -------------------------------------
315
+  (0.1ms) ROLLBACK
316
+  (0.1ms) BEGIN
317
+ ----------------------------------
318
+ HtmlRadarTest: test_HtmlRadar_show
319
+ ----------------------------------
320
+  (0.1ms) ROLLBACK
321
+  (0.1ms) BEGIN
322
+ ----------------------
323
+ HtmlRadarTest: test_hi
324
+ ----------------------
325
+  (0.1ms) ROLLBACK
326
+  (0.1ms) BEGIN
327
+ ---------------------------
328
+ HtmlRadarTest: test_refresh
329
+ ---------------------------
330
+  (0.1ms) ROLLBACK
331
+  (0.1ms) BEGIN
332
+ ------------------------
333
+ HtmlRadarTest: test_show
334
+ ------------------------
335
+  (0.1ms) ROLLBACK
336
+  (0.1ms) BEGIN
337
+ ----------------------
338
+ HtmlRadarTest: test_hi
339
+ ----------------------
340
+  (0.1ms) ROLLBACK
341
+  (0.1ms) BEGIN
342
+ ---------------------------
343
+ HtmlRadarTest: test_refresh
344
+ ---------------------------
345
+  (0.1ms) ROLLBACK
346
+  (0.1ms) BEGIN
347
+ ------------------------
348
+ HtmlRadarTest: test_show
349
+ ------------------------
350
+  (0.1ms) ROLLBACK
351
+  (0.1ms) BEGIN
352
+ ----------------------
353
+ HtmlRadarTest: test_hi
354
+ ----------------------
355
+  (0.1ms) ROLLBACK
356
+  (0.1ms) BEGIN
357
+ ---------------------------
358
+ HtmlRadarTest: test_refresh
359
+ ---------------------------
360
+  (0.1ms) ROLLBACK
361
+  (0.1ms) BEGIN
362
+ ------------------------
363
+ HtmlRadarTest: test_show
364
+ ------------------------
365
+  (0.1ms) ROLLBACK
366
+  (0.1ms) BEGIN
367
+ ----------------------
368
+ HtmlRadarTest: test_hi
369
+ ----------------------
370
+  (0.1ms) ROLLBACK
371
+  (0.1ms) BEGIN
372
+ ---------------------------
373
+ HtmlRadarTest: test_refresh
374
+ ---------------------------
375
+  (0.1ms) ROLLBACK
376
+  (0.1ms) BEGIN
377
+ ------------------------
378
+ HtmlRadarTest: test_show
379
+ ------------------------
380
+  (0.1ms) ROLLBACK
381
+  (0.1ms) BEGIN
382
+ ----------------------
383
+ HtmlRadarTest: test_hi
384
+ ----------------------
385
+  (0.1ms) ROLLBACK
386
+  (0.1ms) BEGIN
387
+ ---------------------------
388
+ HtmlRadarTest: test_refresh
389
+ ---------------------------
390
+  (0.1ms) ROLLBACK
391
+  (0.1ms) BEGIN
392
+ ------------------------
393
+ HtmlRadarTest: test_show
394
+ ------------------------
395
+  (0.1ms) ROLLBACK
396
+  (0.1ms) BEGIN
397
+ ----------------------
398
+ HtmlRadarTest: test_hi
399
+ ----------------------
400
+  (0.1ms) ROLLBACK
401
+  (0.1ms) BEGIN
402
+ ---------------------------
403
+ HtmlRadarTest: test_refresh
404
+ ---------------------------
405
+  (0.1ms) ROLLBACK
406
+  (0.1ms) BEGIN
407
+ ------------------------
408
+ HtmlRadarTest: test_show
409
+ ------------------------
410
+  (0.1ms) ROLLBACK
411
+  (0.1ms) BEGIN
412
+ ----------------------------------
413
+ HtmlRadarTest: test_First_refresh:
414
+ ----------------------------------
415
+  (0.1ms) ROLLBACK
416
+  (0.1ms) BEGIN
417
+ ----------------------------------
418
+ HtmlRadarTest: test_Second_refresh
419
+ ----------------------------------
420
+  (0.1ms) ROLLBACK
421
+  (0.1ms) BEGIN
422
+ ----------------------
423
+ HtmlRadarTest: test_hi
424
+ ----------------------
425
+  (0.1ms) ROLLBACK
426
+  (0.1ms) BEGIN
427
+ ------------------------
428
+ HtmlRadarTest: test_show
429
+ ------------------------
430
+  (0.1ms) ROLLBACK
431
+  (0.1ms) BEGIN
432
+ ----------------------------------
433
+ HtmlRadarTest: test_First_refresh:
434
+ ----------------------------------
435
+  (0.3ms) ROLLBACK
436
+  (0.1ms) BEGIN
437
+ ----------------------------------
438
+ HtmlRadarTest: test_First_refresh:
439
+ ----------------------------------
440
+  (0.3ms) ROLLBACK
441
+  (0.1ms) BEGIN
442
+ ----------------------------------
443
+ HtmlRadarTest: test_First_refresh:
444
+ ----------------------------------
445
+  (0.3ms) ROLLBACK
446
+  (0.1ms) BEGIN
447
+ ----------------------------------
448
+ HtmlRadarTest: test_First_refresh:
449
+ ----------------------------------
450
+  (0.3ms) ROLLBACK
451
+  (0.1ms) BEGIN
452
+ ----------------------------------
453
+ HtmlRadarTest: test_First_refresh:
454
+ ----------------------------------
455
+  (0.3ms) ROLLBACK
456
+  (0.1ms) BEGIN
457
+ ----------------------
458
+ HtmlRadarTest: test_hi
459
+ ----------------------
460
+  (0.1ms) ROLLBACK
461
+  (0.1ms) BEGIN
462
+ ---------------------------
463
+ HtmlRadarTest: test_refresh
464
+ ---------------------------
465
+  (0.3ms) ROLLBACK
466
+  (0.1ms) BEGIN
467
+ ----------------------
468
+ HtmlRadarTest: test_hi
469
+ ----------------------
470
+  (0.1ms) ROLLBACK
471
+  (0.1ms) BEGIN
472
+ ---------------------------
473
+ HtmlRadarTest: test_refresh
474
+ ---------------------------
475
+  (0.1ms) ROLLBACK
476
+  (0.1ms) BEGIN
477
+ ------------------------
478
+ HtmlRadarTest: test_show
479
+ ------------------------
480
+  (0.1ms) ROLLBACK
481
+  (0.1ms) BEGIN
482
+ ----------------------
483
+ HtmlRadarTest: test_hi
484
+ ----------------------
485
+  (0.1ms) ROLLBACK
486
+  (0.1ms) BEGIN
487
+ ---------------------------
488
+ HtmlRadarTest: test_refresh
489
+ ---------------------------
490
+  (0.1ms) ROLLBACK
491
+  (0.1ms) BEGIN
492
+ ------------------------
493
+ HtmlRadarTest: test_show
494
+ ------------------------
495
+  (0.1ms) ROLLBACK
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ name: MyString
5
+
6
+ two:
7
+ name: MyString
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -1,7 +1,36 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class HtmlRadarTest < ActiveSupport::TestCase
4
- test "truth" do
5
- assert_kind_of Module, HtmlRadar
4
+
5
+ test "hi" do
6
+ assert_equal "Hello World!", HtmlRadar.hi
7
+ puts "hi"
8
+ end
9
+
10
+ test "show" do
11
+ memory = "<p><a href='test.html'>Dynamic</a></p><!-- split_tag --><p><a href='test.html'>Static</a></p>"
12
+ assert_no_match "Static", HtmlRadar.show(memory)
13
+ assert_match "Dynamic", HtmlRadar.show(memory)
14
+ puts "show"
15
+ puts HtmlRadar.show(memory)
6
16
  end
17
+
18
+ test "refresh" do
19
+ memory = ""
20
+ memory = HtmlRadar.refresh(memory, "test.html", "a", "ul", "_123_")
21
+ assert_match "Static", memory
22
+ assert_match "Dynamic", memory
23
+ assert_match "<ul>", memory
24
+ assert_match "#_123_", memory
25
+ assert_match "Static", HtmlRadar.show(memory)
26
+ assert_match "Dynamic", HtmlRadar.show(memory)
27
+ assert_match "<ul>", HtmlRadar.show(memory)
28
+ assert_match "#_123_", HtmlRadar.show(memory)
29
+ memory = HtmlRadar.refresh(memory, "test.html", "a", "ul", "_123_")
30
+ assert_no_match "Static", HtmlRadar.show(memory)
31
+ assert_match "Dynamic", HtmlRadar.show(memory)
32
+ assert_match "<ul>", HtmlRadar.show(memory)
33
+ assert_match "#_123_", HtmlRadar.show(memory)
34
+ end
35
+
7
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_radar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Makena
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-30 00:00:00.000000000 Z
11
+ date: 2013-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: 4.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0
26
+ version: 4.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mysql2
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: Scrapes, Remembers and Differentiates URL Content.
41
+ description: Scrapes, Remembers, Outputs Change in URL Content.
42
42
  email:
43
43
  - dave@abcbots.com
44
44
  executables: []
@@ -57,6 +57,9 @@ files:
57
57
  - test/dummy/bin/rake
58
58
  - test/dummy/bin/rails
59
59
  - test/dummy/config.ru
60
+ - test/dummy/db/schema.rb
61
+ - test/dummy/db/migrate/20131104025531_create_users.rb
62
+ - test/dummy/app/models/user.rb
60
63
  - test/dummy/app/views/layouts/application.html.erb
61
64
  - test/dummy/app/helpers/application_helper.rb
62
65
  - test/dummy/app/controllers/application_controller.rb
@@ -82,9 +85,13 @@ files:
82
85
  - test/dummy/config/database.yml
83
86
  - test/dummy/config/routes.rb
84
87
  - test/dummy/config/locales/en.yml
88
+ - test/dummy/test/models/user_test.rb
89
+ - test/dummy/test/fixtures/users.yml
90
+ - test/dummy/log/test.log
91
+ - test/dummy/log/development.log
85
92
  - test/dummy/README.rdoc
86
93
  - test/dummy/Rakefile
87
- homepage: http://www.abcbots.com/o/2706_html_radar
94
+ homepage: http://www.abcbots.com/robots/2706_html_radar
88
95
  licenses: []
89
96
  metadata: {}
90
97
  post_install_message:
@@ -106,7 +113,7 @@ rubyforge_project:
106
113
  rubygems_version: 2.1.10
107
114
  signing_key:
108
115
  specification_version: 4
109
- summary: Differentiates URL Content over time.
116
+ summary: Find Change in URL Content
110
117
  test_files:
111
118
  - test/test_helper.rb
112
119
  - test/html_radar_test.rb
@@ -114,6 +121,9 @@ test_files:
114
121
  - test/dummy/bin/rake
115
122
  - test/dummy/bin/rails
116
123
  - test/dummy/config.ru
124
+ - test/dummy/db/schema.rb
125
+ - test/dummy/db/migrate/20131104025531_create_users.rb
126
+ - test/dummy/app/models/user.rb
117
127
  - test/dummy/app/views/layouts/application.html.erb
118
128
  - test/dummy/app/helpers/application_helper.rb
119
129
  - test/dummy/app/controllers/application_controller.rb
@@ -139,6 +149,9 @@ test_files:
139
149
  - test/dummy/config/database.yml
140
150
  - test/dummy/config/routes.rb
141
151
  - test/dummy/config/locales/en.yml
152
+ - test/dummy/test/models/user_test.rb
153
+ - test/dummy/test/fixtures/users.yml
154
+ - test/dummy/log/test.log
155
+ - test/dummy/log/development.log
142
156
  - test/dummy/README.rdoc
143
157
  - test/dummy/Rakefile
144
- has_rdoc: