Skip to content

Commit

Permalink
Birthday! Waiting for my patch though:
Browse files Browse the repository at this point in the history
  • Loading branch information
godfat committed Nov 4, 2017
0 parents commit ff5dcea
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "task"]
path = task
url = git://github.com/godfat/gemgem.git
47 changes: 47 additions & 0 deletions README.md
@@ -0,0 +1,47 @@
# gem-compact [![Build Status](https://secure.travis-ci.org/godfat/gem-compact.png?branch=master)](http://travis-ci.org/godfat/gem-compact)

by Lin Jen-Shin ([godfat](http://godfat.org))

## LINKS:

* [github](https://github.com/godfat/gem-compact)
* [rubygems](https://rubygems.org/gems/gem-compact)

## DESCRIPTION:

Clean up gems for all the paths, including development dependencies.

## REQUIREMENTS:

* Tested with MRI (official CRuby), Rubinius and JRuby.

## INSTALLATION:

gem install gem-compact

## SYNOPSIS:

gem compact
gem compact rake

## CONTRIBUTORS:

* Lin Jen-Shin (@godfat)

## LICENSE:

Apache License 2.0 (Apache-2)

Copyright (c) 2017, Lin Jen-Shin (godfat)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

<http://www.apache.org/licenses/LICENSE-2.0>

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
12 changes: 12 additions & 0 deletions Rakefile
@@ -0,0 +1,12 @@

begin
require "#{__dir__}/task/gemgem"
rescue LoadError
sh 'git submodule update --init --recursive'
exec Gem.ruby, '-S', $PROGRAM_NAME, *ARGV
end

Gemgem.init(__dir__) do |s|
s.name = 'gem-compact'
s.version = '0.5.0'
end
28 changes: 28 additions & 0 deletions gem-compact.gemspec
@@ -0,0 +1,28 @@
# -*- encoding: utf-8 -*-
# stub: gem-compact 0.5.0 ruby lib

Gem::Specification.new do |s|
s.name = "gem-compact".freeze
s.version = "0.5.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Lin Jen-Shin (godfat)".freeze]
s.date = "2017-11-04"
s.description = "Clean up gems for all the paths, including development dependencies.".freeze
s.email = ["godfat (XD) godfat.org".freeze]
s.files = [
".gitmodules".freeze,
"README.md".freeze,
"Rakefile".freeze,
"gem-compact.gemspec".freeze,
"lib/rubygems/commands/compact_command.rb".freeze,
"lib/rubygems_plugin.rb".freeze,
"pkg/gem-compact-0.5.0.gem".freeze,
"task/README.md".freeze,
"task/gemgem.rb".freeze]
s.homepage = "https://github.com/godfat/gem-compact".freeze
s.licenses = ["Apache-2".freeze]
s.rubygems_version = "2.7.1".freeze
s.summary = "Clean up gems for all the paths, including development dependencies.".freeze
end
34 changes: 34 additions & 0 deletions lib/rubygems/commands/compact_command.rb
@@ -0,0 +1,34 @@

class Gem::Commands::CompactCommand < Gem::Command
def description
'Clean up gems for all the paths'
end

def initialize
super('compact', description)
end

def execute
require 'rubygems/commands/cleanup_command'

cmd = Gem::Commands::CleanupCommand.new
args, build_args = options.values_at(:args, :build_args)
args.unshift('--no-check-development')

with_path do
cmd.invoke_with_build_args(args, build_args)
end
end

private

def with_path
path = Gem.path
path.each do |dir|
Gem.use_paths(dir)
yield
end
ensure
Gem.use_paths(*path)
end
end
3 changes: 3 additions & 0 deletions lib/rubygems_plugin.rb
@@ -0,0 +1,3 @@

require 'rubygems/command_manager'
Gem::CommandManager.instance.register_command(:compact)
Binary file added pkg/gem-compact-0.5.0.gem
Binary file not shown.
1 change: 1 addition & 0 deletions task
Submodule task added at e05f9d

0 comments on commit ff5dcea

Please sign in to comment.