svnignore 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. data/CHANGELOG +6 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +51 -0
  4. data/Rakefile +55 -0
  5. data/VERSION +1 -0
  6. data/bin/svnignore +55 -0
  7. metadata +60 -0
data/CHANGELOG ADDED
@@ -0,0 +1,6 @@
1
+ 2009-03-05 - Sean Huber (shuber@huberry.com)
2
+ * Initial commit
3
+ * Change file permissions
4
+ * Add ignore logic
5
+ * Remove symlink to svnignore file
6
+ * Update README
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Sean Huber (shuber@huberry.com)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,51 @@
1
+ = svnignore
2
+
3
+ git style ignores with subversion
4
+
5
+ This script looks for files named `.svnignore` in the current directory along with all of its nested directories and ignores the patterns found in them
6
+
7
+ It can handle basic ignores, patterns (with *), recursive patterns (with **), and ignoring multiple files/patterns in the same directory
8
+
9
+
10
+ == Installation
11
+
12
+ gem install svnignore
13
+
14
+
15
+ == Usage
16
+
17
+ Move into the root of your svn project (`cd ~/Projects/project_name`) and run `svnignore`
18
+
19
+ Here's a sample `.svnignore` file that I frequently use with rails projects
20
+
21
+ **/.DS_Store
22
+ config/application_settings.yml
23
+ config/database.yml
24
+ db/*.sqlite3
25
+ log/*.log
26
+ tmp/*
27
+
28
+ In this case, the script would parse those patterns and execute the following commands
29
+
30
+ svn propset svn:ignore -R '.DS_Store' .
31
+ svn propset svn:ignore -F some_temp_file config/
32
+ svn propset svn:ignore '*.sqlite3' db/
33
+ svn propset svn:ignore '*.log' log/
34
+ svn propset svn:ignore '*' tmp/
35
+
36
+
37
+ == Note on Patches/Pull Requests
38
+
39
+ * Fork the project.
40
+ * Make your feature addition or bug fix.
41
+ * Add tests for it. This is important so I don't break it in a
42
+ future version unintentionally.
43
+ * Commit, do not mess with rakefile, version, or history.
44
+ (if you want to have your own version, that is fine but
45
+ bump version in a commit by itself I can ignore when I pull)
46
+ * Send me a pull request. Bonus points for topic branches.
47
+
48
+
49
+ == Contact
50
+
51
+ Problems, comments, and suggestions all welcome: shuber@huberry.com
data/Rakefile ADDED
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = 'svnignore'
8
+ gem.summary = 'git style ignores with subversion'
9
+ gem.description = 'git style ignores with subversion'
10
+ gem.email = 'shuber@huberry.com'
11
+ gem.homepage = 'http://github.com/shuber/svnignore'
12
+ gem.authors = ['Sean Huber']
13
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
14
+ end
15
+ rescue LoadError
16
+ puts 'Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler'
17
+ end
18
+
19
+ require 'rake/testtask'
20
+ Rake::TestTask.new(:test) do |test|
21
+ test.libs << 'lib' << 'test'
22
+ test.pattern = 'test/**/*_test.rb'
23
+ test.verbose = true
24
+ end
25
+
26
+ begin
27
+ require 'rcov/rcovtask'
28
+ Rcov::RcovTask.new do |test|
29
+ test.libs << 'test'
30
+ test.pattern = 'test/**/*_test.rb'
31
+ test.verbose = true
32
+ end
33
+ rescue LoadError
34
+ task :rcov do
35
+ abort 'RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov'
36
+ end
37
+ end
38
+
39
+ task :test => :check_dependencies
40
+
41
+ task :default => :test
42
+
43
+ require 'rake/rdoctask'
44
+ Rake::RDocTask.new do |rdoc|
45
+ if File.exist?('VERSION')
46
+ version = File.read('VERSION')
47
+ else
48
+ version = ""
49
+ end
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "svnignore #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('bin/**/*.rb')
55
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
data/bin/svnignore ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'tempfile'
4
+
5
+ Dir[File.join(Dir.pwd, '**', '.svnignore')].each do |file|
6
+ # Stores the parsed ignore patterns
7
+ #
8
+ ignores = Hash.new { |hash, key| hash[key] = [] }
9
+
10
+ # Read the patterns from the svn ignore file
11
+ #
12
+ patterns = File.read(file).split("\n")
13
+
14
+ patterns.each do |pattern|
15
+ # Figure out paths
16
+ #
17
+ path = File.join(File.dirname(file), pattern)
18
+ parent = File.dirname(path)
19
+ relative_path = (parent == Dir.pwd) ? '.' : File.join(parent.gsub(File.join(Dir.pwd, ''), ''), '')
20
+
21
+ # Check for ** in path (recursive ignore)
22
+ #
23
+ if relative_path =~ /\*\*\//
24
+ relative_path.gsub!(/\*\*\/.*$/, '')
25
+ relative_path = '.' if relative_path.empty?
26
+ recursive = '-R '
27
+ else
28
+ recursive = ''
29
+ end
30
+
31
+ ignores[relative_path] << { :pattern => File.basename(pattern), :recursive => recursive }
32
+ end
33
+
34
+ # Ignore the patterns
35
+ #
36
+ ignores.sort.each do |(relative_path, patterns)|
37
+ if patterns.length == 1
38
+ options = patterns.first[:recursive]
39
+ pattern = "'#{patterns.first[:pattern].gsub(/'/, "\\\\'")}'"
40
+ else
41
+ # Create a temporary file to store a newline separated list of files to ignore for this relative path
42
+ #
43
+ temp_file = Tempfile.new('svn-ignore-', Dir.pwd)
44
+ temp_file.print(patterns.map { |configuration| configuration[:pattern] }.join("\n"))
45
+ temp_file.flush
46
+
47
+ options = '-F '
48
+ pattern = File.basename(temp_file.path)
49
+ end
50
+
51
+ command = "svn propset svn:ignore #{options}#{pattern} #{relative_path}"
52
+ # puts command
53
+ system command
54
+ end
55
+ end
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: svnignore
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Sean Huber
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-06 00:00:00 -08:00
13
+ default_executable: svnignore
14
+ dependencies: []
15
+
16
+ description: git style ignores with subversion
17
+ email: shuber@huberry.com
18
+ executables:
19
+ - svnignore
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ files:
25
+ - CHANGELOG
26
+ - MIT-LICENSE
27
+ - README.rdoc
28
+ - Rakefile
29
+ - VERSION
30
+ - bin/svnignore
31
+ has_rdoc: true
32
+ homepage: http://github.com/shuber/svnignore
33
+ licenses: []
34
+
35
+ post_install_message:
36
+ rdoc_options:
37
+ - --charset=UTF-8
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ requirements: []
53
+
54
+ rubyforge_project:
55
+ rubygems_version: 1.3.5
56
+ signing_key:
57
+ specification_version: 3
58
+ summary: git style ignores with subversion
59
+ test_files: []
60
+