trackchange 0.5.1 → 0.5.2

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.
@@ -2,23 +2,25 @@ page = require('webpage').create()
2
2
  sys = require('system')
3
3
 
4
4
  if (sys.args.length < 2 || sys.args.length > 3)
5
- console.log 'Usage: select.coffee URL [selector]'
6
- phantom.exit
5
+ console.log 'Usage: query.coffee URL [selector]'
6
+ phantom.exit 1
7
7
 
8
8
  address = sys.args[1]
9
9
  selector = sys.args[2] || 'body'
10
10
 
11
+ # this will be evaluated within the context of the page
11
12
  query = (selector) ->
12
13
  nodeList = document.querySelectorAll(selector)
13
- nodeList.item(i).innerText for i in [0..nodeList.length-1]
14
+ result = ['(Empty selection.)'] if nodeList.length == 0
15
+ result ||= (nodeList.item(i).innerText for i in [0..nodeList.length-1])
14
16
 
15
- storePageAndExit = ->
17
+ queryPageAndExit = ->
16
18
  result = page.evaluate query, selector
17
19
  console.log result.join("\n")
18
20
  phantom.exit()
19
21
 
20
22
  page.open address, (status) ->
21
23
  if status != 'success'
22
- console.log 'Unable to load the address!'
23
- phantom.exit 1
24
- window.setTimeout storePageAndExit, 200
24
+ console.log "Unable to load page #{address}"
25
+ phantom.exit 2
26
+ window.setTimeout queryPageAndExit, 500
@@ -1,3 +1,3 @@
1
1
  module Trackchange
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackchange
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-22 00:00:00.000000000 Z
12
+ date: 2015-02-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cronedit
@@ -95,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  segments:
97
97
  - 0
98
- hash: -576997153301819687
98
+ hash: -1126504187557020857
99
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  none: false
101
101
  requirements:
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  segments:
106
106
  - 0
107
- hash: -576997153301819687
107
+ hash: -1126504187557020857
108
108
  requirements: []
109
109
  rubyforge_project:
110
110
  rubygems_version: 1.8.23