frag 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.2.1 2012-08-11
2
+
3
+ * Gracefully exit if file is not writable.
4
+
1
5
  == 0.2.0 2012-08-11
2
6
 
3
7
  * Allow setting options in the file itself via $frag-config lines.
@@ -120,7 +120,9 @@ module Frag
120
120
  File.file?(input_path) or
121
121
  return error "not a file: #{input_path}"
122
122
  File.readable?(input_path) or
123
- return error "cannot open file: #{input_path}"
123
+ return error "cannot read file: #{input_path}"
124
+ File.writable?(input_path) or
125
+ return error "cannot write file: #{input_path}"
124
126
  tempfile = nil
125
127
  success = nil
126
128
  open(input_path) do |input|
@@ -1,5 +1,5 @@
1
1
  module Frag
2
- VERSION = [0, 2, 0]
2
+ VERSION = [0, 2, 1]
3
3
 
4
4
  class << VERSION
5
5
  include Comparable
@@ -592,10 +592,18 @@ describe Frag::App do
592
592
 
593
593
  it "prints an error if an input file is not readable" do
594
594
  write_file 'input', ''
595
- File.chmod 0, 'input'
595
+ File.chmod 0300, 'input'
596
596
  frag('input').must_equal 1
597
597
  output.string.must_equal ''
598
- error.string.must_match /cannot open file.*input/
598
+ error.string.must_match /cannot read file.*input/
599
+ end
600
+
601
+ it "prints an error if an input file is not writable" do
602
+ write_file 'input', ''
603
+ File.chmod 0500, 'input'
604
+ frag('input').must_equal 1
605
+ output.string.must_equal ''
606
+ error.string.must_match /cannot write file.*input/
599
607
  end
600
608
 
601
609
  it "prints an error if an input file is not a file" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -64,7 +64,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
64
64
  version: '0'
65
65
  segments:
66
66
  - 0
67
- hash: -1830703405673240469
67
+ hash: -3732901048616748446
68
68
  required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  none: false
70
70
  requirements:
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  version: '0'
74
74
  segments:
75
75
  - 0
76
- hash: -1830703405673240469
76
+ hash: -3732901048616748446
77
77
  requirements: []
78
78
  rubyforge_project:
79
79
  rubygems_version: 1.8.24