evertils 0.3.22 → 0.3.23
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 +4 -4
- data/lib/evertils/controllers/log.rb +9 -3
- data/lib/evertils/helpers/api-enml-handler.rb +7 -3
- data/lib/evertils/helpers/note.rb +10 -8
- data/lib/evertils/type.rb +1 -1
- data/lib/evertils/version.rb +1 -1
- data/lib/evertils.rb +0 -1
- metadata +1 -2
- data/lib/evertils/utils.rb +0 -123
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b4bd61f2af2b06593fac31f09d04e7178dff145
|
4
|
+
data.tar.gz: 1f901acc3a972cbb973527ec47bdbd4e92fb99eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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('
|
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.
|
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
|
-
|
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
|
-
|
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.
|
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
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
data/lib/evertils/version.rb
CHANGED
data/lib/evertils.rb
CHANGED
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.
|
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:
|
data/lib/evertils/utils.rb
DELETED
@@ -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
|