git-trim-whitespace 0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 684c2bc9c0f90786e041bd3a9c19ec3f5e29c67e
4
+ data.tar.gz: 802637704fc3382bc338668b93eb8d190c47861d
5
+ SHA512:
6
+ metadata.gz: 7e183b536ea68aa88c69e7bdee35a230dde79d538663ee1460018e37c64dd498ca82c4c8b184e49b60dda6c0e6a2ce28a4f7055c14b73baea5628f94a33a8444
7
+ data.tar.gz: e610f9fcc44583ec93bbb5d72b060c0ec3a73e517e8d4936059277633238d1712f989f59a6ba31ee43029881a81f2a0188fba14b897f5d9a57cfd84ce6a40df5
@@ -0,0 +1,26 @@
1
+ Parts of this package are copyrighted under the terms of the modified BSD license.
2
+
3
+ Copyright (c) 2011, 2012, @radiospiel.
4
+
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without
8
+ modification, are permitted provided that the following conditions are met:
9
+ * Redistributions of source code must retain the above copyright
10
+ notice, this list of conditions and the following disclaimer.
11
+ * Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+ * No names of the contributors may be used to endorse or promote products
15
+ derived from this software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
21
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,26 @@
1
+ 1. Install the gem
2
+
3
+ gem install git-trim-whitespace
4
+
5
+ Make sure you have all preliminaries installed. This includes flex, make, and cc.
6
+
7
+ 2. Make a `.gitattributes` file in your project root with these contents:
8
+
9
+ *.rb filter=trimWhitespace
10
+
11
+ This says every ruby file will go through the trimWhitespace filter.
12
+ You could apply it to all files like this:
13
+
14
+ * filter=trimWhitespace
15
+
16
+ 3. Define the filter:
17
+
18
+ $ git config filter.trimWhitespace.clean trim_whitespace
19
+
20
+ Every filter can be run at two different hooks: right after you pull, or right before you push.
21
+ The *smudge* filter is for right after pulling and the *clean* filter is for right before pushing.
22
+
23
+ The above command creates a new filter called `trimWhitespace` for the *clean* action - it runs
24
+ all code through the `trim_whitespace` utility before pushing.
25
+
26
+ (Inspired by http://adit.io/posts/2013-08-16-five-useful-git-tips.html)
@@ -0,0 +1,18 @@
1
+ $:.unshift File.expand_path("../lib", __FILE__)
2
+
3
+ require "bundler/setup"
4
+
5
+ Dir[File.expand_path("../tasks/*.rake", __FILE__)].each do |task|
6
+ load task
7
+ end
8
+
9
+ # Add "rake release and rake install"
10
+ Bundler::GemHelper.install_tasks :name => 'git-trim-whitespace'
11
+
12
+ task :default => [:test]
13
+
14
+ task :test do
15
+ system "cd tests && ./run.sh"
16
+ raise "Tests failed" unless $?.exitstatus == 0
17
+ end
18
+
@@ -0,0 +1,16 @@
1
+ #!/bin/sh
2
+ if ! [ -e $0.bin ]; then
3
+
4
+ die() {
5
+ echo $*
6
+ exit 1
7
+ }
8
+
9
+ which make 2>&1 > /dev/null || die "Missing make binary"
10
+ which flex 2>&1 > /dev/null || die "Missing flex binary"
11
+
12
+ flex -o $0.c $0.fl
13
+ cc -o $0.bin $0.c -Os -lfl
14
+ fi
15
+
16
+ exec $0.bin
@@ -0,0 +1,5 @@
1
+ %%
2
+
3
+ [ ]+\n { fputs("\n", yyout); }
4
+
5
+ %%
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git-trim-whitespace
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - '@radiospiel'
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-17 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A native whitespace trimmer tool for git checkins
14
+ email: eno@open-lab.org
15
+ executables:
16
+ - trim_whitespace
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - Rakefile
21
+ - bin/trim_whitespace
22
+ - bin/trim_whitespace.fl
23
+ - README.md
24
+ - LICENSE.BSD
25
+ homepage: https://github.com/radiospiel/git-trim-whitespace
26
+ licenses: []
27
+ metadata: {}
28
+ post_install_message: Make sure you setup the trim-whitespace package correctly; i.e.
29
+ run "git-trim-whitespace setup"
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 2.0.3
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Trim whitespaces on git checkins
49
+ test_files: []