mr_poole 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db31487041b5c6ed8e580f7d8a8b003bb65c775a
4
- data.tar.gz: 9999f65961a392b2b3121ccb0edff2c87d69d06a
3
+ metadata.gz: 55b01d175e1b4409aa3952570665706d4cb48b12
4
+ data.tar.gz: e3e8070ed4000eae92275b01c2ba420ff7424432
5
5
  SHA512:
6
- metadata.gz: f5f0071a2daf4825b72f3eecc81cf54afcc1d032fcaf6ba07f4a29bacbad69ea4d2c4ec1aebc62fd72ceb817b94a3d593ee9349463d789401a77e2cbbb850cdb
7
- data.tar.gz: 83515d8083a1734d9a50c5c7a097acc12a7ab5e1f0b2e0a681eee3b809cfea58fd73467479139f7805578758f09a0a4fdee669f0d6c383aef968d0e6bffd7b1c
6
+ metadata.gz: 6e7f154e7cc3cab30bfecc709f5fc132d39fa69a0e62742bc9f6436bef2aa901f8633f87ae474a3524913997c795c3c5af2c1c86dde696866b0e623af808afb1
7
+ data.tar.gz: 357f0267e6992c9b944f1ff8b1ff01947ad28da1e6a36e2880f9ffde82b585cb03e304da7f1e883810d9650c6aef2027ff9763090af0d677eef1edf9cc6a4033
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### v0.5.1 (2014-01-31)
4
+
5
+ - Bug fixes for older rubies (1.8.7, 1.9.2).
6
+
3
7
  ### v0.5.0 (2014-01-31)
4
8
 
5
9
  - Add word_separator configuration option (to use hyphens). Thanks to [Harry
@@ -1,6 +1,17 @@
1
1
  require 'yaml'
2
2
  require 'ostruct'
3
3
 
4
+ # YAML parsing in old rubies didn't use Psych, and so throws a NameError later
5
+ # when we check for one after we parse our YAML. Before we start, we'll check
6
+ # for that and create a dummy Pysch::SyntaxError constant. Older ruby YAML
7
+ # errors will be caught by check_word_separator and will throw a TypeError
8
+ # instead.
9
+ if RUBY_VERSION < '1.9'
10
+ class Psych
11
+ SyntaxError = nil
12
+ end
13
+ end
14
+
4
15
  module MrPoole
5
16
  class Config
6
17
 
@@ -10,10 +21,11 @@ module MrPoole
10
21
  yaml = YAML.load(File.read('_config.yml'))
11
22
  @config = OpenStruct.new(yaml["poole"])
12
23
  @config.srcdir = yaml['source'] if yaml['source']
24
+ check_word_separator
13
25
  else
14
26
  @config = OpenStruct.new
15
27
  end
16
- rescue Psych::SyntaxError
28
+ rescue TypeError, ::Psych::SyntaxError
17
29
  bad_yaml_message
18
30
  exit
19
31
  end
@@ -33,6 +45,17 @@ module MrPoole
33
45
 
34
46
  private
35
47
 
48
+ # on old rubies, the YAML parser doesn't throw an error if you pass
49
+ # something like 'word_separator: -', it just assumes you want an array
50
+ # with the elment nil. We'll check for that case and die, since it's not
51
+ # what we want here.
52
+ def check_word_separator
53
+ return unless @config.word_separator
54
+ if @config.word_separator == [nil]
55
+ raise TypeError
56
+ end
57
+ end
58
+
36
59
  def bad_yaml_message
37
60
  puts 'Error reading YAML file _config.yml!'
38
61
  puts ' (Did you forget to escape a hyphen?)'
@@ -93,7 +93,7 @@ module MrPoole
93
93
  puts ''
94
94
  puts "This is Mr. Poole, version #{MrPoole::VERSION}, running on ruby version #{RUBY_VERSION}"
95
95
  puts ''
96
- puts 'Copyright 2013, Michael McClimon'
96
+ puts 'Copyright 2014, Michael McClimon'
97
97
  puts 'https://github.com/mmcclimon/mr_poole'
98
98
  puts ''
99
99
  exit
@@ -1,3 +1,3 @@
1
1
  module MrPoole
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mr_poole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael McClimon