evertils 0.3.22 → 0.3.23

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: defd9cbab62144b4b40c1c1b0f0b555cc23273e1
4
- data.tar.gz: f502d4347c1f41a6a1afe8bbfc77faaae9278f6e
3
+ metadata.gz: 0b4bd61f2af2b06593fac31f09d04e7178dff145
4
+ data.tar.gz: 1f901acc3a972cbb973527ec47bdbd4e92fb99eb
5
5
  SHA512:
6
- metadata.gz: d68f78b8627152733304f5a14c5afdfc811216582a7b6dbd7f7601af360a92420e3b1a76897000d9b58cc0e107d47107c7c562811301a4154fe58a329bb2b0ea
7
- data.tar.gz: 4701bbacd9b46654cc616d93be6284dd2538f0cf708bb385cc7202d0d8fa8dd432c961bd71acbee8f622c53f26f91883e46253bad0db60193a48d029fe98fc84
6
+ metadata.gz: dd45e26d46697f7e71368a85c55c97985326abbd294e339e633f8baed0590a223be17d9699b7a5900df2afe1bc569967368415a08a9e57e648f57920663e6b12
7
+ data.tar.gz: dc9689defda9748be92ab0cb961821a6c47690d840a0d4a8c0bd18a5aa400870c759edfcf31ad2726e3eabbad0b265e7c36bc5ff25116fe1bd5a9b17b59c736e
@@ -9,8 +9,8 @@ module Evertils
9
9
  end
10
10
 
11
11
  # Send arbitrary text to the daily log
12
- def message(text)
13
- Notify.error('Text argument is required', {}) if text.nil?
12
+ def message(text = nil)
13
+ return Notify.error('A message is required', {}) if text.nil?
14
14
 
15
15
  note = @note_helper.wait_for(:Daily)
16
16
  edit_conf = {
@@ -18,6 +18,8 @@ module Evertils
18
18
  append: text
19
19
  }
20
20
 
21
+ return Notify.error("Note not found") if note.entity.nil?
22
+
21
23
  modify(note, edit_conf)
22
24
  end
23
25
 
@@ -36,7 +38,11 @@ module Evertils
36
38
 
37
39
  if nearest_ul.empty?
38
40
  node = xml_helper.ul(li)
39
- target.children.before(node)
41
+ if target.children.size.zero?
42
+ target.add_child(node)
43
+ else
44
+ target.children.before(node)
45
+ end
40
46
  else
41
47
  nearest_ul.children.after(li)
42
48
  end
@@ -58,14 +58,18 @@ module Evertils
58
58
  # lets replace it with a new DTD if that is the case
59
59
  # @since 0.3.15
60
60
  def fix_dtd
61
- if @xml.children[0].is_a?(Text)
61
+ node = @xml.children[0]
62
+
63
+ if node.is_a?(ProcessingInstruction)
64
+ node = node.next
65
+
62
66
  # remove the existing broken DTD
63
- @xml.children[0].remove
67
+ node.remove
64
68
  # create a new one (note: output is overridden in DTD class defined
65
69
  # below ApiEnmlHandler)
66
70
  dtd = DTD.new('DOCTYPE', @xml)
67
71
 
68
- @xml.children.first.before(dtd)
72
+ @xml.children.first.after(dtd)
69
73
  end
70
74
  end
71
75
 
@@ -3,8 +3,6 @@ module Evertils
3
3
  class Note
4
4
  attr_reader :model
5
5
 
6
- MAX_SEARCH_SIZE = 21
7
-
8
6
  # Create the Note object
9
7
  def initialize
10
8
  @model = Evertils::Common::Query::Simple.new
@@ -18,13 +16,17 @@ module Evertils
18
16
  Notify.info("Waiting for #{notebook}...")
19
17
  note = find_note(notebook)
20
18
 
21
- # didn't find it the first time? wait and try again
22
- if note.entity.nil?
23
- (1..MAX_SEARCH_SIZE).each do |iter|
24
- Notify.info(" (#{iter}) #{notebook}")
25
- note = find_note(notebook, true)
26
- break unless note.entity.nil? || iter == MAX_SEARCH_SIZE
19
+ begin
20
+ # didn't find it the first time? wait and try again
21
+ if note.entity.nil?
22
+ (1..Evertils::Type::Base::MAX_SEARCH_SIZE).each do |iter|
23
+ Notify.info(" (#{iter}) #{notebook}")
24
+ note = find_note(notebook, true)
25
+ break unless note.entity.nil? || iter == Evertils::Type::Base::MAX_SEARCH_SIZE
26
+ end
27
27
  end
28
+ rescue Interrupt
29
+ Notify.warning('Cancelled wait')
28
30
  end
29
31
 
30
32
  note
data/lib/evertils/type.rb CHANGED
@@ -4,7 +4,7 @@ module Evertils
4
4
  attr_reader :title, :content, :notebook
5
5
 
6
6
  COLOUR = 0xffffff
7
- MAX_SEARCH_SIZE = 21
7
+ MAX_SEARCH_SIZE = 11
8
8
 
9
9
  #
10
10
  # @since 0.3.7
@@ -1,3 +1,3 @@
1
1
  module Evertils
2
- VERSION = '0.3.22'.freeze
2
+ VERSION = '0.3.23'.freeze
3
3
  end
data/lib/evertils.rb CHANGED
@@ -25,7 +25,6 @@ require 'evertils/helpers/results'
25
25
  require 'evertils/helpers/api-enml-handler'
26
26
  require 'evertils/config'
27
27
  require 'evertils/request'
28
- require 'evertils/utils'
29
28
  require 'evertils/controller'
30
29
  require 'evertils/router'
31
30
  require 'evertils/helper'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evertils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.22
4
+ version: 0.3.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Priebe
@@ -143,7 +143,6 @@ files:
143
143
  - lib/evertils/types/monthly.rb
144
144
  - lib/evertils/types/priority-queue.rb
145
145
  - lib/evertils/types/weekly.rb
146
- - lib/evertils/utils.rb
147
146
  - lib/evertils/version.rb
148
147
  homepage: http://rubygems.org/gems/evertils
149
148
  licenses:
@@ -1,123 +0,0 @@
1
- module Evertils
2
- class Utils
3
- @cache = Hash.new
4
-
5
- # Gets a list of files from the current directory with a specific extension
6
- def self.get_files(ext)
7
- @cache[:files] ||= Hash.new
8
- @cache[:files][ext] ||= []
9
-
10
- Dir["*.#{ext}"].each do |file|
11
- @cache[:files][ext].push file
12
- end
13
-
14
- @cache[:files][ext]
15
- end
16
-
17
- # Gets a list of all files in the project with a specific extension
18
- def self.get_all_files(ext, ignore_paths = '')
19
- @cache[:files] ||= Hash.new
20
- @cache[:files][ext] ||= []
21
-
22
- if @cache[:files][ext].empty?
23
- Dir["**/*.#{ext}"].each do |file|
24
- if !ignore_paths.empty?
25
- # file is a widget
26
- if /\/#{ignore_paths}/.match(file)
27
- @cache[:files][ext].push file
28
- end
29
- else
30
- # file is not a widget
31
- @cache[:files][ext].push file
32
- end
33
- end
34
- end
35
-
36
- @cache[:files][ext]
37
- end
38
-
39
- # Gets a list of files from the current git commit queue with a specific
40
- # extension
41
- def self.get_files_from_git(ext)
42
- @cache[:files] ||= Hash.new
43
- @cache[:files][ext] ||= []
44
-
45
- modified_files = `git status --porcelain`.split("\n")
46
- modified_files.each do |file|
47
- if file.match(/#{ext}/)
48
- @cache[:files][ext].push file.strip.match(/[A-Z ]+(.*)/)[1]
49
- end
50
- end
51
-
52
- @cache[:files][ext]
53
- end
54
-
55
- # Generate a filename
56
- def self.generate_path(branch, time, identifier)
57
- # create the directory if needed
58
- Logs.mkdir identifier
59
-
60
- # create a new log file with a path based on the input parameters
61
- #Log.new(identifier, branch, time)
62
- end
63
-
64
- # Convert hash keys to symbols
65
- def self.symbolize_keys(hash)
66
- Hash[hash.map{ |k, v| [k.to_sym, v] }]
67
- end
68
-
69
- # Create a directory wherever the script is called from, if required
70
- def self.mklocaldir(name)
71
- dir = "#{Dir.pwd}/#{name.downcase}/"
72
-
73
- if !Dir.exist? dir
74
- Dir.mkdir dir
75
- else
76
- dir
77
- end
78
- end
79
-
80
- def self.os
81
- begin
82
- @os ||= (
83
- host_os = RbConfig::CONFIG['host_os']
84
- case host_os
85
- when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
86
- :windows
87
- when /darwin|mac os/
88
- :macosx
89
- when /linux/
90
- :linux
91
- when /solaris|bsd/
92
- :unix
93
- else
94
- raise TypeError, "unknown os: #{host_os.inspect}"
95
- end
96
- )
97
- rescue e
98
- Notify.error("#{e}\n#{e.backtrace.join("\n")}", show_time: false)
99
- end
100
- end
101
-
102
- def self.json?(string)
103
- begin
104
- !!JSON.parse(string)
105
- rescue
106
- false
107
- end
108
- end
109
-
110
- def self.http_response_code(url = nil)
111
- begin
112
- request = Net::HTTP.get_response(URI.parse(url || "http://google.com"))
113
- request.code.to_i
114
- rescue
115
- 500
116
- end
117
- end
118
-
119
- def self.has_internet_connection?
120
- Utils.http_response_code < 499
121
- end
122
- end
123
- end