dafuq 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +41 -0
- data/Rakefile +1 -0
- data/bin/dafuq +24 -0
- data/dafuq.gemspec +22 -0
- data/lib/dafuq.rb +26 -0
- data/lib/dafuq/code.rb +18 -0
- data/lib/dafuq/version.rb +3 -0
- metadata +74 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 AbhishekKr
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Dafuq
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'dafuq'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install dafuq
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
DaFuq
|
22
|
+
|
23
|
+
'-notail', '--no-whitespace' : Dafuq::Code.notail no_whitespace_path, recurse
|
24
|
+
'-no-r', '--no-recurse' : non-recursive action in directories
|
25
|
+
|
26
|
+
'-v', '--verbose' : verbose
|
27
|
+
|
28
|
+
log the output to a file
|
29
|
+
-l $PATH_TO_LOG_FILE
|
30
|
+
--log $PATH_TO_LOG_FILE
|
31
|
+
|
32
|
+
.....more to come
|
33
|
+
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
1. Fork it
|
38
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
41
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/dafuq
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
3
|
+
|
4
|
+
require 'arg0'
|
5
|
+
require 'dafuq'
|
6
|
+
|
7
|
+
if Arg0::Console.switch?(['-h', '--help'])
|
8
|
+
puts <<-DATA
|
9
|
+
DaFuq
|
10
|
+
|
11
|
+
'-notail', '--no-whitespace' : Dafuq::Code.notail no_whitespace_path, recurse
|
12
|
+
'-no-r', '--no-recurse' : non-recursive action in directories
|
13
|
+
|
14
|
+
'-v', '--verbose' : verbose
|
15
|
+
|
16
|
+
log the output to a file
|
17
|
+
-l $PATH_TO_LOG_FILE
|
18
|
+
--log $PATH_TO_LOG_FILE
|
19
|
+
|
20
|
+
.....more to come
|
21
|
+
DATA
|
22
|
+
end
|
23
|
+
|
24
|
+
Dafuq.is_this
|
data/dafuq.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'dafuq/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "dafuq"
|
8
|
+
gem.version = Dafuq::VERSION
|
9
|
+
gem.authors = ["AbhishekKr"]
|
10
|
+
gem.email = ["abhikumar163@gmail.com"]
|
11
|
+
gem.description = %q{dafuq is here to handle dafuq tasks required now and then, sometimes and often}
|
12
|
+
gem.summary = %q{dafuq is this, said a lot... will be adding some of the solutions to it over time}
|
13
|
+
gem.homepage = "https://github.com/abhishekkr/dafuq"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
|
19
|
+
gem.executables = %w( dafuq )
|
20
|
+
|
21
|
+
gem.add_runtime_dependency 'arg0', '>= 0.0.2'
|
22
|
+
end
|
data/lib/dafuq.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Dafuq
|
2
|
+
|
3
|
+
dafuq_all = File.join(File.dirname(File.expand_path __FILE__), '*', '*.rb')
|
4
|
+
Dir.glob(dafuq_all).each {|lib| require lib}
|
5
|
+
|
6
|
+
module Dafuq
|
7
|
+
|
8
|
+
class << self
|
9
|
+
attr_accessor :verbose, :log
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.log_me(msg)
|
13
|
+
puts "[+] #{msg}" if @verbose
|
14
|
+
File.open(@log, 'a+'){|fyl| fyl.puts msg} if File.exists?(@log)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.is_this
|
18
|
+
Dafuq.verbose = Arg0::Console.switch?(['-v', '--verbose'])
|
19
|
+
Dafuq.log = Arg0::Console.value_for(['-l', '--log']).join
|
20
|
+
recurse = ! Arg0::Console.switch?(['-no-r', '--no-recurse'])
|
21
|
+
|
22
|
+
Arg0::Console.value_for(['-notail', '--no-whitespace']).each do |no_whitespace_path|
|
23
|
+
Dafuq::Code.notail no_whitespace_path, recurse
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/dafuq/code.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Dafuq
|
2
|
+
module Code
|
3
|
+
|
4
|
+
# 'remove tailing whitespace'
|
5
|
+
def self.notail(edit_path, recursive = true)
|
6
|
+
Dir.glob(File.expand_path(File.join edit_path, '*')).each do |fyl|
|
7
|
+
if File.symlink? fyl
|
8
|
+
next
|
9
|
+
elsif File.directory?(fyl) && recursive
|
10
|
+
notail(fyl)
|
11
|
+
else
|
12
|
+
Dafuq.log_me "Processing: #{fyl}"
|
13
|
+
%x{sed -i 's/\ *$//g' #{fyl}}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dafuq
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- AbhishekKr
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: arg0
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.0.2
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.0.2
|
30
|
+
description: dafuq is here to handle dafuq tasks required now and then, sometimes
|
31
|
+
and often
|
32
|
+
email:
|
33
|
+
- abhikumar163@gmail.com
|
34
|
+
executables:
|
35
|
+
- dafuq
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- .gitignore
|
40
|
+
- Gemfile
|
41
|
+
- LICENSE.txt
|
42
|
+
- README.md
|
43
|
+
- Rakefile
|
44
|
+
- bin/dafuq
|
45
|
+
- dafuq.gemspec
|
46
|
+
- lib/dafuq.rb
|
47
|
+
- lib/dafuq/code.rb
|
48
|
+
- lib/dafuq/version.rb
|
49
|
+
homepage: https://github.com/abhishekkr/dafuq
|
50
|
+
licenses: []
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 1.8.24
|
70
|
+
signing_key:
|
71
|
+
specification_version: 3
|
72
|
+
summary: dafuq is this, said a lot... will be adding some of the solutions to it over
|
73
|
+
time
|
74
|
+
test_files: []
|