fixbraces 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +12 -0
- data/README.md +4 -0
- data/bin/fixbraces +12 -2
- data/features/fixbraces.feature +20 -0
- data/lib/fixbraces/version.rb +1 -1
- data/spec/fixbraces_spec.rb +11 -0
- metadata +3 -2
data/CHANGELOG.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Fixbraces Changelog #
|
2
|
+
|
3
|
+
## 1.2.0 ##
|
4
|
+
- Error and exit if no file or directory is passed to the script
|
5
|
+
- Print a message and gracefully handle non-existent path or directory
|
6
|
+
|
7
|
+
## 1.0.0 ##
|
8
|
+
- List the changed files.
|
9
|
+
|
10
|
+
## 0.9.0 ##
|
11
|
+
|
12
|
+
- Initial version.
|
data/README.md
CHANGED
@@ -43,6 +43,10 @@ or a number of files:
|
|
43
43
|
|
44
44
|
Run `fixbraces --help` for details.
|
45
45
|
|
46
|
+
## Changelog
|
47
|
+
|
48
|
+
See the current version of the [Changelog](https://github.com/Abizern/fixbraces/blob/master/CHANGELOG.md) is part of the repository.
|
49
|
+
|
46
50
|
## Disclaimer
|
47
51
|
|
48
52
|
I have tests, you can see them for yourself. The script works, but I'm
|
data/bin/fixbraces
CHANGED
@@ -20,8 +20,18 @@ end
|
|
20
20
|
|
21
21
|
source_files = []
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
# Bail if no path of file is given
|
24
|
+
Trollop::die "fixbraces needs to know what directory or files to attempt to correct" if ARGV.length < 1
|
25
|
+
|
26
|
+
ARGV.each do |path|
|
27
|
+
f = File.expand_path path
|
28
|
+
|
29
|
+
# Skip this file or dir if it doesn't exist
|
30
|
+
unless File.exist? f
|
31
|
+
puts "Invalid path #{path}"
|
32
|
+
next
|
33
|
+
end
|
34
|
+
|
25
35
|
extension = File.extname f
|
26
36
|
|
27
37
|
if File.directory? f
|
data/features/fixbraces.feature
CHANGED
@@ -23,3 +23,23 @@ Feature: The binary interface for fixbraces works
|
|
23
23
|
And there should not be any .h files listed
|
24
24
|
And the .h files in that directory are unchanged
|
25
25
|
And the exit status should be 0
|
26
|
+
|
27
|
+
Scenario: Show an error message if no file or directory is provided
|
28
|
+
Given an Xcode project
|
29
|
+
When I run `fixbraces`
|
30
|
+
Then the output should contain "Error: fixbraces needs to know what directory or files to attempt to correct."
|
31
|
+
And the exit status should not be 0
|
32
|
+
|
33
|
+
Scenario: Show an error message for a non-existent file or directory
|
34
|
+
Given an Xcode project
|
35
|
+
When I run `fixbraces non_existent_path`
|
36
|
+
Then the output should contain "Invalid path"
|
37
|
+
And the exit status should be 0
|
38
|
+
|
39
|
+
Scenario: If one of the files is non-existent correct the file that can be changed and show an error message for the non-existent one
|
40
|
+
Given a single source file called MasterViewController.m
|
41
|
+
When I run `fixbraces MasterViewController.m some_file.m`
|
42
|
+
Then MasterViewController.m should be formatted correctly
|
43
|
+
And the output should contain "MasterViewController.m"
|
44
|
+
And the output should contain "Invalid path"
|
45
|
+
And the exit status should be 0
|
data/lib/fixbraces/version.rb
CHANGED
data/spec/fixbraces_spec.rb
CHANGED
@@ -62,6 +62,17 @@ describe Fixbraces do
|
|
62
62
|
result = `diff -r --brief #{Dir.pwd + "/tmp/spec/"} #{Dir.pwd + "/spec/fixtures/expected/"}`
|
63
63
|
expect(result).to eq ""
|
64
64
|
end
|
65
|
+
|
66
|
+
it 'should preserve the original file mode' do
|
67
|
+
files = Dir.glob Dir.pwd + "/tmp/spec/*.{h,m}"
|
68
|
+
files.each do |f|
|
69
|
+
original_mode = File.new(f).stat.mode
|
70
|
+
Fixbraces.process_file f
|
71
|
+
new_mode = File.new(f).stat.mode
|
72
|
+
|
73
|
+
expect(new_mode).to eq original_mode
|
74
|
+
end
|
75
|
+
end
|
65
76
|
end
|
66
77
|
|
67
78
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fixbraces
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: trollop
|
@@ -91,6 +91,7 @@ extra_rdoc_files: []
|
|
91
91
|
files:
|
92
92
|
- .gitignore
|
93
93
|
- .rspec
|
94
|
+
- CHANGELOG.md
|
94
95
|
- Gemfile
|
95
96
|
- LICENSE.txt
|
96
97
|
- README.md
|