peacock 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -12
- data/lib/git.rb +4 -0
- data/lib/git/lib.rb +4 -0
- data/lib/peacock/cli.rb +2 -2
- data/lib/peacock/cli_hash.rb +2 -2
- data/lib/peacock/engine/extractor.rb +1 -1
- data/lib/peacock/engine/ignorer.rb +18 -7
- data/lib/peacock/logger.rb +4 -4
- data/lib/peacock/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33e4a22c408e35b4468b963ed395cb1eefd3dda9
|
4
|
+
data.tar.gz: 911e6d77543c8bfa6a65ddd62ea2dc5347e9d041
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a94e7f27752af85eab92a233cdd265571e8c41da79081f75166491f48070ddcd7eedd0aafabb9fb593661eda98fa5564cf9e3a2973eabb8eb9e65eb752b39645
|
7
|
+
data.tar.gz: 95ce5a06d6714f5e9120d04ace27c7d0285f010468c41625c45711dd6f7ff04314d196afe2c4f2544c6150236cb5c6ed0c5b4b57e0c3ce13c316c4ac483bdc4e
|
data/README.md
CHANGED
@@ -2,11 +2,7 @@
|
|
2
2
|
|
3
3
|
Peacock is a small tool to easily manage your .gitignore written in ruby.
|
4
4
|
|
5
|
-
It lets you
|
6
|
-
|
7
|
-
Note that while ignoring files and directories peacock will perform safety commits to make sure your work is not lost. It will commit all your uncommited work (if there is any) before and after adding files to .gitignore.
|
8
|
-
|
9
|
-
While extracting, peacock leaves everything untouched.
|
5
|
+
It lets you extract files and directories from .gitignore files as well as inserting new files to .gitignore
|
10
6
|
|
11
7
|
Note that at the moment you can't combine options with one hyphen (e.g.: -ev for --extract and --verbose) but you have to pass them separated (e.g.: -e -v)
|
12
8
|
|
@@ -26,7 +22,7 @@ Options:
|
|
26
22
|
|
27
23
|
-h, [--help] # show this text
|
28
24
|
-r, [--root] # use root .gitignore
|
29
|
-
-
|
25
|
+
-s, [--silent] # suppress output
|
30
26
|
-e, [--extract] # extract file from .gitignore
|
31
27
|
|
32
28
|
## Example
|
@@ -44,8 +40,10 @@ Options:
|
|
44
40
|
added some to .gitignore
|
45
41
|
|
46
42
|
$ git status
|
47
|
-
|
48
|
-
|
43
|
+
...
|
44
|
+
Untracked files:
|
45
|
+
these
|
46
|
+
files
|
49
47
|
|
50
48
|
$ peacock -e are
|
51
49
|
removed are from .gitignore
|
@@ -53,15 +51,14 @@ Options:
|
|
53
51
|
$ git status
|
54
52
|
...
|
55
53
|
Untracked files:
|
54
|
+
these
|
56
55
|
are
|
56
|
+
files
|
57
57
|
|
58
58
|
|
59
59
|
## TODO
|
60
60
|
|
61
|
-
|
62
|
-
- custom commit messages
|
63
|
-
- comments in .gitignore
|
64
|
-
- options can't be combined (e.g. -ev for extract and surpress)
|
61
|
+
Issues are used for TODOs
|
65
62
|
|
66
63
|
## Contributing
|
67
64
|
|
data/lib/git.rb
CHANGED
data/lib/git/lib.rb
CHANGED
data/lib/peacock/cli.rb
CHANGED
@@ -50,13 +50,13 @@ module Peacock
|
|
50
50
|
Options:
|
51
51
|
\t-h, [--help] # show this text
|
52
52
|
\t-r, [--root] # use root .gitignore
|
53
|
-
\t-
|
53
|
+
\t-s, [--silent] # surpress output
|
54
54
|
\t-e, [--extract] # extract file from .gitignore
|
55
55
|
EOF
|
56
56
|
end
|
57
57
|
|
58
58
|
def options
|
59
|
-
%w(-r --root -e --extract -
|
59
|
+
%w(-r --root -e --extract -s --silent)
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
data/lib/peacock/cli_hash.rb
CHANGED
@@ -12,16 +12,13 @@ module Peacock
|
|
12
12
|
|
13
13
|
def initialize(opt_hash)
|
14
14
|
@hash = check_and_return_hash(opt_hash)
|
15
|
-
@logger = Peacock::Logger.new(@hash.
|
15
|
+
@logger = Peacock::Logger.new(@hash.silent?)
|
16
16
|
path = determine_git_ignore_path
|
17
17
|
@git_ignore = File.open(path, 'a+')
|
18
18
|
end
|
19
19
|
|
20
20
|
def workflow
|
21
|
-
Git.commit_all('peacock: before .gitignore commit')
|
22
21
|
ignore_files_and_directories
|
23
|
-
Git.clear_cache
|
24
|
-
Git.commit_all('peacock: after .gitignore commit')
|
25
22
|
@git_ignore.close
|
26
23
|
end
|
27
24
|
|
@@ -44,10 +41,9 @@ module Peacock
|
|
44
41
|
|
45
42
|
def check_and_write(str)
|
46
43
|
unless entry_exists?(str)
|
47
|
-
|
48
|
-
@logger.ignore(str)
|
44
|
+
insert_in_gitignore(str)
|
49
45
|
end
|
50
|
-
|
46
|
+
|
51
47
|
@git_ignore.rewind
|
52
48
|
end
|
53
49
|
|
@@ -57,6 +53,21 @@ module Peacock
|
|
57
53
|
end
|
58
54
|
false
|
59
55
|
end
|
56
|
+
|
57
|
+
def insert_in_gitignore(str)
|
58
|
+
@git_ignore.write(str + "\n")
|
59
|
+
Git.remove_from_cache(prepare_arg(str))
|
60
|
+
@logger.ignore(str)
|
61
|
+
end
|
62
|
+
|
63
|
+
# if directory then remove leading slash
|
64
|
+
def prepare_arg(str)
|
65
|
+
if str.start_with?('/')
|
66
|
+
str[1..-1]
|
67
|
+
else
|
68
|
+
str
|
69
|
+
end
|
70
|
+
end
|
60
71
|
|
61
72
|
end
|
62
73
|
|
data/lib/peacock/logger.rb
CHANGED
@@ -2,16 +2,16 @@ module Peacock
|
|
2
2
|
|
3
3
|
class Logger
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
@
|
5
|
+
def initialize(silent)
|
6
|
+
@silent = silent
|
7
7
|
end
|
8
8
|
|
9
9
|
def ignore(string)
|
10
|
-
puts "added #{string} to .gitignore" unless @
|
10
|
+
puts "added #{string} to .gitignore" unless @silent
|
11
11
|
end
|
12
12
|
|
13
13
|
def extract(string)
|
14
|
-
puts "removed #{string} from .gitignore" unless @
|
14
|
+
puts "removed #{string} from .gitignore" unless @silent
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
data/lib/peacock/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peacock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Paling
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
105
|
+
rubygems_version: 2.5.1
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Peacock is a small tool to easily manage your .gitignore
|