houki 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: 24dd96bcc5421e5c1374e767f4e75f18863da680
4
+ data.tar.gz: f6a6a263f992d713ef28903fe750dd32f133f38e
5
+ SHA512:
6
+ metadata.gz: d066392cb64df85393104953a498fe9a95cc13f24d2ece34494760fc53d69a08cadc76cc3777d79db53d8669c7097b01add47f455c951497d4428aef10b97d3f
7
+ data.tar.gz: 790131ec8b43e2a9cf777c7e8daf46c5801185bb7e44b413d60e76668ee3ccdeb53563a4e99c240bc71c3a394a22683140f85614d565f999e4a8d3790d95609b
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in houki.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 yuuji.yaginuma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,21 @@
1
+ # Houki
2
+
3
+ Delete collectively unnecessary files.
4
+
5
+ ## Installation
6
+
7
+ $ gem install houki
8
+
9
+ ## Usage
10
+
11
+ TODO: Write usage instructions here
12
+
13
+ ## Contributing
14
+
15
+ Bug reports and pull requests are welcome on GitHub at https://github.com/y-yagi/houki. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org/) code of conduct.
16
+
17
+
18
+ ## License
19
+
20
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
21
+
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "houki"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift "#{File.expand_path(File.dirname(__FILE__))}/../lib"
4
+
5
+ require 'houki'
6
+ require 'houki/options'
7
+ require 'houki/version'
8
+
9
+ begin
10
+ options = Houki::Options.parse!(ARGV)
11
+ rescue OptionParser::ParseError => e
12
+ $stderr.puts e.message.capitalize
13
+ $stderr.puts "Please see `houki --help` for valid options"
14
+ exit(false)
15
+ end
16
+
17
+ Houki.run(options)
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'houki/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "houki"
8
+ spec.version = Houki::VERSION
9
+ spec.authors = ["Yuji Yaginuma"]
10
+ spec.email = ["yuuji.yaginuma@gmail.com"]
11
+
12
+ spec.summary = %q{Delete collectively unnecessary files.}
13
+ spec.homepage = "https://github.com/y-yagi/houki"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "terminal-table"
22
+ spec.add_dependency "highline"
23
+ spec.add_development_dependency "bundler", "~> 1.10"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "minitest"
26
+ spec.add_development_dependency "pry"
27
+ end
@@ -0,0 +1,14 @@
1
+ require "houki/version"
2
+ require "houki/config"
3
+ require "houki/options"
4
+ require "houki/executors/directory"
5
+
6
+ module Houki
7
+ def self.run(options)
8
+ config = Config.parse(options)
9
+
10
+ if config['Directory']
11
+ Houki::Executors::Directory.run(config['Directory'])
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ require 'yaml'
2
+
3
+ module Houki
4
+ class Config
5
+ DEFAULT_CONFIG_FILE = "#{ENV["HOME"]}/.houki.yml"
6
+
7
+ def self.parse(options)
8
+ config_file = DEFAULT_CONFIG_FILE
9
+
10
+ if options[:config_file]
11
+ config_file = options[:config_file]
12
+ end
13
+ YAML.load_file(config_file)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ require 'fileutils'
2
+ require 'terminal-table'
3
+ require 'highline/import'
4
+
5
+ module Houki::Executors
6
+ class Directory
7
+ EXCLUDED_DIRS = ['.', '..']
8
+
9
+ def self.run(directories, need_agree: true)
10
+ table = Terminal::Table.new(title: 'Directories', rows: directories.combination(1).to_a)
11
+ $stdout.puts table
12
+
13
+ return if need_agree && !agree('Are you sure you want to delete directories? ')
14
+
15
+ directories.each do |directory|
16
+ root_dirs = Dir.entries(directory).reject { |f| EXCLUDED_DIRS.include?(f) }
17
+ FileUtils.rm_r(root_dirs.collect { |f| File.join(directory, f) })
18
+ end
19
+
20
+ $stdout.puts 'Removed the files under the directories'
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,26 @@
1
+ require 'optparse'
2
+ require 'set'
3
+
4
+ module Houki::Options
5
+ class << self
6
+ def parse!(args)
7
+ get_options(args)
8
+ end
9
+
10
+ def get_options(args)
11
+ options = {}
12
+
13
+ parser = OptionParser.new do |opts|
14
+ opts.banner = "Usage: houki [options]"
15
+
16
+ opts.separator "Configuration files:"
17
+ opts.on "-c", "--config-file FILE", "Use specified configuration file. Default is $HOME/.houki.yml" do |file|
18
+ options[:config_file] = File.expand_path(file)
19
+ end
20
+ end
21
+
22
+ parser.parse!(args)
23
+ options
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module Houki
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: houki
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yuji Yaginuma
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-11-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: terminal-table
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: highline
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.10'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.10'
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: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email:
99
+ - yuuji.yaginuma@gmail.com
100
+ executables:
101
+ - houki
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".travis.yml"
107
+ - CODE_OF_CONDUCT.md
108
+ - Gemfile
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - bin/console
113
+ - bin/setup
114
+ - exe/houki
115
+ - houki.gemspec
116
+ - lib/houki.rb
117
+ - lib/houki/config.rb
118
+ - lib/houki/executors/directory.rb
119
+ - lib/houki/options.rb
120
+ - lib/houki/version.rb
121
+ homepage: https://github.com/y-yagi/houki
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.4.5
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: Delete collectively unnecessary files.
145
+ test_files: []