check_everything 0.1.3 → 0.1.4
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/check_everything.rb +9 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b122d8de6966ddd03792e3f87a831eb038f5a854
|
4
|
+
data.tar.gz: e59a49a8025d318948e6984e2314f12fe6913120
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 485ab37271e244ed4efb6eee554acedea3ecb22d5178ef0df91c5c8790222593b3bf0af53f9809e102f2709c678a18952b06e32806d04c7a84ed093503de432c
|
7
|
+
data.tar.gz: 73c5f8693e0ff0c78bcdefad56d265b1905753ea8b8c44c210a06f8d6b7b784e936f1ad0b9bc604058848cf868b41c13d83f24554b5ab748cddb46080033e7df
|
data/lib/check_everything.rb
CHANGED
@@ -19,7 +19,7 @@ class CheckEverything
|
|
19
19
|
"the link file."
|
20
20
|
end
|
21
21
|
# Assume no problems with the link file.
|
22
|
-
@
|
22
|
+
@category_space, @category_dash = false, false
|
23
23
|
|
24
24
|
extract_links
|
25
25
|
|
@@ -44,10 +44,10 @@ class CheckEverything
|
|
44
44
|
|
45
45
|
# Check for errors; don't allow the user to see bad categories or open up
|
46
46
|
# websites if the categories are not formatted properly.
|
47
|
-
elsif @
|
47
|
+
elsif @category_space
|
48
48
|
puts "Your link file includes a category with a space in it; " +
|
49
49
|
"please fix by entering 'check_everything -l' into your command line."
|
50
|
-
elsif @
|
50
|
+
elsif @category_dash
|
51
51
|
puts "Your link file includes a category with a dash, which is " +
|
52
52
|
"not allowed; please fix by entering 'check_everything -l' into your command line."
|
53
53
|
|
@@ -118,7 +118,7 @@ class CheckEverything
|
|
118
118
|
link_file.each do |line|
|
119
119
|
if line.start_with?("&&")
|
120
120
|
# add tags as keys in @links, and assign to cur_tags
|
121
|
-
cur_tags =
|
121
|
+
cur_tags = add_category(line[2..-1].strip).flatten
|
122
122
|
elsif line.start_with?("--")
|
123
123
|
# add links to each relevant tag in @links
|
124
124
|
cur_tags.each { |tag|
|
@@ -129,17 +129,17 @@ class CheckEverything
|
|
129
129
|
end
|
130
130
|
|
131
131
|
# Recursive helper method for extract_links
|
132
|
-
def self.
|
132
|
+
def self.add_category(line)
|
133
133
|
line.downcase!
|
134
134
|
# Add multiple tags, if separated by semicolons.
|
135
135
|
if line.include?(";")
|
136
136
|
line.split(";").map(&:strip).each do |tag|
|
137
|
-
|
137
|
+
add_category(tag.strip)
|
138
138
|
end
|
139
139
|
else
|
140
|
-
# Note to raise an error if there is an invalid
|
141
|
-
@
|
142
|
-
@
|
140
|
+
# Note to raise an error if there is an invalid category.
|
141
|
+
@category_space = true if line.match(/ /)
|
142
|
+
@category_dash = true if line.match(/-/)
|
143
143
|
@links[line] ||= []
|
144
144
|
[line]
|
145
145
|
end
|