icersplicer 0.7.6 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/icersplicer +4 -4
  3. data/lib/icersplicer.rb +17 -20
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7335ae1ec2c26b35c118a4a819080fb12bae349d
4
- data.tar.gz: 7952657256c1031014176561ba806c061d0bd29f
3
+ metadata.gz: 59b59767d5ae416f112ea0893067c55591177994
4
+ data.tar.gz: f089d8099aae8558a307fc250f33c1e90ef635bd
5
5
  SHA512:
6
- metadata.gz: 59898e152ed090c3e22721f3357f91215b2e9e37b3e6a37bc292f61ddc9d238195bd24a7553ec8005274f334e2099f33a35fa6224557766091a92c099c271d3d
7
- data.tar.gz: b17daa09375ac79f4d3373a31c91b3d2203d6e5fb41aa1c7726d13d7bd7d055590776955cf6ab89e8518ed3f959b4447a37e04d35eb81cb3c30f2240b5f3d518
6
+ metadata.gz: f23b9ba6b07e861bf392a15a038ca2215e379dbec87c91142f65f4d6b1f9505240e94fcf0cb0ebd7013d37679dcd222348ab43fc7a78c35ac8a73871917b25a0
7
+ data.tar.gz: f65520d9dff96cc467a7427bd476b3d50cd469bec785972d5686b671a175f88221272dc565b4f9156c2d2bef76632aa9e18c51dd878848eb46c84d40e6fa9fa2
data/bin/icersplicer CHANGED
@@ -149,7 +149,7 @@ if instance_variable_defined?("@search")
149
149
  replace = @replace
150
150
  search_and_replace = true
151
151
  else
152
- puts "Replace string required to use search / replace features..."
152
+ raise ArgumentError, "Replace string required to use search / replace features..."
153
153
  exit
154
154
  end
155
155
  end
@@ -181,7 +181,7 @@ if @countlines == true
181
181
  end
182
182
 
183
183
  unless File.exist?("#{inputfile}")
184
- puts "Input filename / location doesn't exist... ?"
184
+ raise ArgumentError, "Input filename / location doesn't exist... ?"
185
185
  exit
186
186
  end
187
187
 
@@ -229,8 +229,8 @@ begin
229
229
  linecounter += 1
230
230
  }
231
231
  }
232
- rescue Errno::EPIPE
233
- puts "Closing session due to broken pipe"
232
+ rescue Errno::EPIPE, IOError
233
+ raise IOError, "Closing session due to broken pipe"
234
234
  end
235
235
  closefile
236
236
  unless instance_variable_defined?("@nostats")
data/lib/icersplicer.rb CHANGED
@@ -14,9 +14,9 @@ module Icersplicer
14
14
 
15
15
  module VERSION #:nodoc:
16
16
  MAJOR = 0
17
- MINOR = 7
18
- TINY = 6
19
- CODENAME = "Ice Creambar !"
17
+ MINOR = 8
18
+ TINY = 0
19
+ CODENAME = "Ice Age !"
20
20
  STRING = [MAJOR, MINOR, TINY].join('.')
21
21
  end
22
22
 
@@ -82,7 +82,7 @@ module Icersplicer
82
82
 
83
83
  def text_highlighter(text)
84
84
  @keys ||= load_keywords("#{@@keywordsfile}")
85
- if @keys == false
85
+ unless @keys.class == Hash
86
86
  @keys = {0 => "Ln:",
87
87
  1 => "SELECT",
88
88
  2 => "CREATE TABLE",
@@ -95,12 +95,9 @@ module Icersplicer
95
95
  if n[1].split("##")[1] == nil
96
96
  text.gsub!("#{n[1]}", "\e[4;3#{cpicker[rand(cpicker.size)]}m#{n[1]}\e[0m\ \e[0;32m")
97
97
  else
98
- name = n[1].split("##")[1].split("=")[1]
99
- puts "Name: #{name}" if @@debug == true
100
- cnum = COLOURS[name].to_i
101
- puts "Colour Number: #{cnum}" if @@debug == true
102
- nval = n[1].split("##")[0]
103
- puts "Value: #{nval}" if @@debug == true
98
+ name = n[1].split("##")[1].split("=")[1]; puts "Name: #{name}" if @@debug == true
99
+ cnum = COLOURS[name].to_i; puts "Colour Number: #{cnum}" if @@debug == true
100
+ nval = n[1].split("##")[0]; puts "Value: #{nval}" if @@debug == true
104
101
  text.gsub!("#{nval}", "\e[4;3#{cnum}m#{nval}\e[0m\ \e[0;32m")
105
102
  end
106
103
  text.gsub!(" \e[0;32m", "\e[0;32m")
@@ -131,14 +128,10 @@ module Icersplicer
131
128
  # Allow line ranges
132
129
  min = n.split("-")[0].to_i
133
130
  max = n.split("-")[1].to_i
134
- unless n.split("-")[1] == nil
135
- begin
136
- if min > max and max != 0
137
- return false
138
- end
139
- rescue
140
- puts "Range Error: Minimun value can't be more than Maxiumun Range value"
141
- exit
131
+ puts "Min: #{min} Max: #{max}" if @debug == true
132
+ unless n.split("-")[1] == nil
133
+ if min > max
134
+ raise RangeError, "Range Error: Minimun value can't be more than Maxiumun Range value"
142
135
  end
143
136
  min.upto(max) {|s|
144
137
  skip_lines.update({skipcounter => s}) unless skip_lines[skip_lines.size - 1] == s
@@ -169,8 +162,12 @@ module Icersplicer
169
162
  end
170
163
 
171
164
  def openfile(outputfile)
172
- puts "Openfile: #{outputfile}"
173
- @@exp = File.open("#{outputfile}", 'w')
165
+ begin
166
+ puts "Openfile: #{outputfile}"
167
+ @@exp = File.open("#{outputfile}", 'w')
168
+ rescue Errno::EACCES
169
+ puts "Can't create file please check file / directory permissions"
170
+ end
174
171
  end
175
172
 
176
173
  def writefile(data)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icersplicer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Hood