gemy 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README.md +16 -0
- data/VERSION +1 -0
- data/bin/gemy +112 -0
- data/gemy.gemspec +18 -0
- metadata +54 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 by Domizio Demichelis
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# gemy
|
2
|
+
|
3
|
+
Simple CLI tool useful for gem authors: it eases installing your gem locally, and pushing it to RubyGems.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
`gemy` requires a `VERSION` file in the gem project root, and that the project is a `git` repository.
|
8
|
+
|
9
|
+
## Description
|
10
|
+
|
11
|
+
$ gemy --help
|
12
|
+
|
13
|
+
## Copyright
|
14
|
+
|
15
|
+
Copyright (c) 2012 by Domizio Demichelis<br>
|
16
|
+
See LICENSE for details.
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/gemy
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
options = {}
|
7
|
+
|
8
|
+
file_version = File.read('VERSION').strip
|
9
|
+
copy = "gemy #{file_version} (c) 2012 Domizio Demichelis"
|
10
|
+
|
11
|
+
optparse = OptionParser.new do |opts|
|
12
|
+
|
13
|
+
opts.banner = <<-banner
|
14
|
+
Gem CLI utils:
|
15
|
+
Simple Tool for managing gem local installation and push.
|
16
|
+
Usage:
|
17
|
+
gemy <command> [options]
|
18
|
+
<command>:
|
19
|
+
install locally installs a version bumped with the commit SHA
|
20
|
+
push build the gem, push to RubyGems, tag the commit and cleanup
|
21
|
+
Options:
|
22
|
+
banner
|
23
|
+
|
24
|
+
|
25
|
+
options[:name] = File.basename FileUtils.pwd
|
26
|
+
opts.on( '-n', '--name [GEMNAME]', "The gem name (default: dir name '#{options[:name]}')") do |n|
|
27
|
+
options[:name] = n
|
28
|
+
end
|
29
|
+
|
30
|
+
options[:force] = false
|
31
|
+
opts.on( '-f', '--force', 'execute the command even if the working tree is dirty' ) do
|
32
|
+
options[:force] = true
|
33
|
+
end
|
34
|
+
|
35
|
+
options[:clean] = false
|
36
|
+
opts.on( '-c', '--clean', 'clean old installations' ) do
|
37
|
+
options[:clean] = true
|
38
|
+
end
|
39
|
+
|
40
|
+
opts.on( '-v', '--version', 'Shows the version and exits' ) do
|
41
|
+
puts file_version
|
42
|
+
exit
|
43
|
+
end
|
44
|
+
|
45
|
+
opts.on( '-h', '--help', 'Display this screen' ) do
|
46
|
+
puts copy
|
47
|
+
puts opts
|
48
|
+
exit
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
optparse.parse!
|
54
|
+
|
55
|
+
puts copy
|
56
|
+
|
57
|
+
def ensure_clean(command, force)
|
58
|
+
if !force && ! `git status -s`.empty?
|
59
|
+
puts <<-message.gsub(/^ {6}/, '')
|
60
|
+
#{command} aborted: the working tree is dirty!
|
61
|
+
If you know what you are doing you can use \`gemy #{command} -f\`"
|
62
|
+
message
|
63
|
+
exit(1)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
command = ARGV.first
|
68
|
+
|
69
|
+
case command
|
70
|
+
|
71
|
+
when 'install'
|
72
|
+
ensure_clean(:install, options[:force])
|
73
|
+
system %(gem uninstall #{options[:name]} --all --ignore-dependencies --executables) if options[:clean]
|
74
|
+
begin
|
75
|
+
commit_id = `git log -1 --format="%h" HEAD`.strip
|
76
|
+
version = "#{file_version}.#{commit_id}"
|
77
|
+
File.open('VERSION', 'w') {|f| f.puts version }
|
78
|
+
versioned_name = "#{options[:name]}-#{version}.gem"
|
79
|
+
puts versioned_name
|
80
|
+
system %(gem build #{options[:name]}.gemspec)
|
81
|
+
system %(gem install '#{versioned_name}' --local --no-rdoc --no-ri)
|
82
|
+
puts <<-warning.gsub(/^ {6}/, '')
|
83
|
+
|
84
|
+
*******************************************************************************
|
85
|
+
* WARNING *
|
86
|
+
*******************************************************************************
|
87
|
+
* The version id of locally installed gems is comparable to a --pre version: *
|
88
|
+
* i.e. it is alphabetically ordered (not numerically ordered), besides it *
|
89
|
+
* includes the sah1 commit id which is not aphabetically ordered, so be sure *
|
90
|
+
* your application picks the version you really intend to use *
|
91
|
+
*******************************************************************************
|
92
|
+
|
93
|
+
warning
|
94
|
+
ensure
|
95
|
+
FileUtils.remove_entry_secure versioned_name, true
|
96
|
+
File.open('VERSION', 'w') {|f| f.puts file_version }
|
97
|
+
end
|
98
|
+
|
99
|
+
when 'push'
|
100
|
+
begin
|
101
|
+
ensure_clean(:push, options[:force])
|
102
|
+
versioned_name = "#{options[:name]}-#{file_version}.gem"
|
103
|
+
system %(gem build #{options[:name]}.gemspec)
|
104
|
+
system %(gem push #{versioned_name})
|
105
|
+
system %(git tag '#{file_version}')
|
106
|
+
ensure
|
107
|
+
FileUtils.remove_entry_secure versioned_name, true
|
108
|
+
end
|
109
|
+
|
110
|
+
else
|
111
|
+
puts "unknown command: #{command.inspect}"
|
112
|
+
end
|
data/gemy.gemspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'gemy'
|
5
|
+
s.summary = 'Simple CLI Tool for managing gem local installation and RubyGem push'
|
6
|
+
s.description = 'Useful if you are a gem author: it eases testing your gem locally, and pushing it to RubyGems'
|
7
|
+
s.authors = ["Domizio Demichelis"]
|
8
|
+
s.email = 'dd.nexus@gmail.com'
|
9
|
+
s.homepage = "http://github.com/ddnexus/gemy"
|
10
|
+
s.extra_rdoc_files = ["README.md"]
|
11
|
+
s.executables = ['gemy']
|
12
|
+
s.files = `git ls-files -z`.split("\0")
|
13
|
+
s.version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
14
|
+
s.date = Date.today.to_s
|
15
|
+
s.required_rubygems_version = ">= 1.3.6"
|
16
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
17
|
+
end
|
18
|
+
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gemy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Domizio Demichelis
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-15 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: ! 'Useful if you are a gem author: it eases testing your gem locally,
|
15
|
+
and pushing it to RubyGems'
|
16
|
+
email: dd.nexus@gmail.com
|
17
|
+
executables:
|
18
|
+
- gemy
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files:
|
21
|
+
- README.md
|
22
|
+
files:
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- VERSION
|
26
|
+
- bin/gemy
|
27
|
+
- gemy.gemspec
|
28
|
+
homepage: http://github.com/ddnexus/gemy
|
29
|
+
licenses: []
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options:
|
32
|
+
- --charset=UTF-8
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.3.6
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 1.8.24
|
50
|
+
signing_key:
|
51
|
+
specification_version: 3
|
52
|
+
summary: Simple CLI Tool for managing gem local installation and RubyGem push
|
53
|
+
test_files: []
|
54
|
+
has_rdoc:
|