code-cleaner 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -67,7 +67,7 @@ Here's an example how you can integrate code-cleaner to your tasks:
67
67
  begin
68
68
  load "code-cleaner.nake"
69
69
  rescue LoadError
70
- warn "If you want to contribute to nake, you have to install code-cleaner gem and then run ./tasks.rb hooks:
70
+ warn "If you want to contribute to nake, you have to install code-cleaner gem and then run ./tasks.rb hooks:whitespace:install"
71
71
  end
72
72
  </pre>
73
73
 
data/code-cleaner.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "code-cleaner"
6
- s.version = "0.3"
6
+ s.version = "0.4"
7
7
  s.authors = ["Jakub Šťastný aka Botanicus"]
8
8
  s.homepage = "http://github.com/botanicus/code-cleaner"
9
9
  s.summary = "Remove trailing whitespace, append missing \\n and replace tabs by two spaces"
data/tasks.rb ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env nake
2
+
3
+ begin
4
+ load "./tasks/code-cleaner.nake"
5
+ rescue LoadError
6
+ abort "If you want to contribute to code-cleaner, you have to run ./tasks.rb hooks:whitespace:install first!"
7
+ end
@@ -10,7 +10,11 @@ require "nake/task"
10
10
  Nake::Task.new("hooks:whitespace:install") do |task|
11
11
  task.description = "Install hook for automatically removing trailing whitespace"
12
12
  task.define do |options = Hash.new|
13
- FileUtils.rm ".git/hooks/pre-commit" if options[:force]
13
+ # --force
14
+ if File.exist?(".git/hooks/pre-commit") && options[:force]
15
+ FileUtils.rm ".git/hooks/pre-commit"
16
+ end
17
+
14
18
  if File.exist?(".git/hooks/pre-commit")
15
19
  abort "You must remove .git/hooks/pre-commit first!"
16
20
  else
@@ -10,7 +10,11 @@ module Hooks
10
10
  method_options :force => :boolean, :path => :string
11
11
  desc "install", "Install hook for automatically removing trailing whitespace"
12
12
  def install
13
- FileUtils.rm ".git/hooks/pre-commit" if options[:force]
13
+ # --force
14
+ if File.exist?(".git/hooks/pre-commit") && options[:force]
15
+ FileUtils.rm ".git/hooks/pre-commit"
16
+ end
17
+
14
18
  if File.exist?(".git/hooks/pre-commit")
15
19
  abort "You must remove .git/hooks/pre-commit first!"
16
20
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.3"
4
+ version: "0.4"
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"
@@ -29,6 +29,7 @@ files:
29
29
  - tasks/code-cleaner.nake
30
30
  - tasks/code-cleaner.rake
31
31
  - tasks/code-cleaner.thor
32
+ - tasks.rb
32
33
  has_rdoc: true
33
34
  homepage: http://github.com/botanicus/code-cleaner
34
35
  licenses: []