gitkeep_cleaner 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2743813a2ae546997ca7b9bf32ac45d772039a4e
4
+ data.tar.gz: cedadc2619a74d6f835eac91bfcdae97923a8483
5
+ SHA512:
6
+ metadata.gz: 902209bbb13b6b80d83f3b252873aba003d2b63c4b9c74fca3be2994a2fe9678ff5fee05aea719bf71e7dc326a3f1fedf18c1447bd66f9e9c2ef2759ba29f34c
7
+ data.tar.gz: d284af63b838836ac5847a1f17b1298b75ef056df980e235d69ad261b44a3d6766440a6f0976b821d1c86ea9a7d85ac3418a6c166f273239fd72a05658c00b12
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.2
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in gitkeep_cleaner.gemspec
6
+ gemspec
@@ -0,0 +1,49 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gitkeep_cleaner (0.1.0)
5
+ thor
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ byebug (8.0.1)
11
+ coderay (1.1.0)
12
+ diff-lcs (1.2.5)
13
+ method_source (0.8.2)
14
+ pry (0.10.3)
15
+ coderay (~> 1.1.0)
16
+ method_source (~> 0.8.1)
17
+ slop (~> 3.4)
18
+ pry-byebug (3.3.0)
19
+ byebug (~> 8.0)
20
+ pry (~> 0.10)
21
+ rake (10.4.2)
22
+ rspec (3.3.0)
23
+ rspec-core (~> 3.3.0)
24
+ rspec-expectations (~> 3.3.0)
25
+ rspec-mocks (~> 3.3.0)
26
+ rspec-core (3.3.2)
27
+ rspec-support (~> 3.3.0)
28
+ rspec-expectations (3.3.1)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.3.0)
31
+ rspec-mocks (3.3.2)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.3.0)
34
+ rspec-support (3.3.0)
35
+ slop (3.6.0)
36
+ thor (0.20.0)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ bundler (~> 1.16)
43
+ gitkeep_cleaner!
44
+ pry-byebug
45
+ rake (~> 10.0)
46
+ rspec (~> 3.0)
47
+
48
+ BUNDLED WITH
49
+ 1.16.2
@@ -0,0 +1,37 @@
1
+ # GitkeepCleaner
2
+
3
+ 不要な`.gitkeep`, `.keep`を削除するgem
4
+ .gitkeepファイルがあるディレクトリにファイルがある場合は不要と判断して削除します。
5
+ `node_modules`, `tmp`, `log`のディレクトリは無視します
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'gitkeep_cleaner'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install gitkeep_cleaner
22
+
23
+ ## Usage
24
+
25
+ ```
26
+ gitkeep_cleaner clean
27
+ ```
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gitkeep_cleaner.
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require "bundler/setup"
3
+ require "gitkeep_cleaner"
4
+
5
+ require "pry"
6
+ Pry.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require "gitkeep_cleaner/cli"
3
+
4
+ GitkeepCleaner::Cli.start
@@ -0,0 +1,32 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "gitkeep_cleaner/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "gitkeep_cleaner"
7
+ spec.version = GitkeepCleaner::VERSION
8
+ spec.authors = ["Akira Kusumoto"]
9
+ spec.email = ["akirakusumo10@gmail.com"]
10
+
11
+ spec.summary = "Remove unused gitkeep files"
12
+ spec.description = "Remove unused gitkeep files"
13
+ spec.homepage = "https://github.com/bluerabbit/gitkeep_cleaner"
14
+ spec.license = "MIT"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_runtime_dependency "thor"
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.16"
29
+ spec.add_development_dependency "pry-byebug"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rspec", "~> 3.0"
32
+ end
@@ -0,0 +1,25 @@
1
+ require "gitkeep_cleaner/version"
2
+ require "logger"
3
+
4
+ module GitkeepCleaner
5
+ class << self
6
+ def clean(root_path:, ignore_paths: [])
7
+ logger = Logger.new(STDOUT)
8
+ paths = %w(.gitkeep .keep).map { |filename| "#{root_path}/**/*/#{filename}" }
9
+ ignore_full_paths = ignore_paths.map {|v| "#{root_path}/#{v}" }
10
+ paths.each do |path|
11
+ Dir.glob(path) do |keep_file_path|
12
+ dir_path = File.dirname(keep_file_path)
13
+
14
+ next if ignore_full_paths.include?(dir_path)
15
+
16
+ files = Dir.glob(["#{dir_path}/**/*.*", "#{dir_path}/**/.*"])
17
+ if files.size > 1
18
+ logger.info("Remove: #{keep_file_path}")
19
+ File.delete(keep_file_path)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ require "thor"
2
+ require "gitkeep_cleaner"
3
+ require "logger"
4
+
5
+ module GitkeepCleaner
6
+ class Cli < Thor
7
+ default_command :clean
8
+
9
+ desc "clean", "Delete unused .gitkeep"
10
+ method_option :path, required: false, desc: 'root path'
11
+
12
+ def clean
13
+ GitkeepCleaner.clean(root_path: options[:path] || Dir.pwd,
14
+ ignore_paths: ['node_modules', 'tmp', 'log'])
15
+ end
16
+
17
+ desc "version", "Show Version"
18
+
19
+ def version
20
+ say "Version: #{GitkeepCleaner::VERSION}"
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module GitkeepCleaner
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gitkeep_cleaner
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Akira Kusumoto
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-10-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry-byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ description: Remove unused gitkeep files
84
+ email:
85
+ - akirakusumo10@gmail.com
86
+ executables:
87
+ - gitkeep_cleaner
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - Gemfile.lock
96
+ - README.md
97
+ - Rakefile
98
+ - bin/console
99
+ - bin/setup
100
+ - exe/gitkeep_cleaner
101
+ - gitkeep_cleaner.gemspec
102
+ - lib/gitkeep_cleaner.rb
103
+ - lib/gitkeep_cleaner/cli.rb
104
+ - lib/gitkeep_cleaner/version.rb
105
+ homepage: https://github.com/bluerabbit/gitkeep_cleaner
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.6.13
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Remove unused gitkeep files
129
+ test_files: []