geminabox-release 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/lib/geminabox-release/version.rb +1 -1
- data/lib/geminabox-release.rb +40 -2
- 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: d37cb4f55660a786f8ca9d36046a4b4d820965ff
|
4
|
+
data.tar.gz: 40e10d1433b881910fbc8195f66a13f0c50e7c19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f254ed4f049c95c5c6d747ddbd4de739da9dc26de9bb9e42e5400976323519794bdc68dbe0cf1a8787d0f24a3730dfff33bd658182e53f2cb0b700f31e577420
|
7
|
+
data.tar.gz: 0f7a85365efad03c22a67ba2fc400abc21222e75c7eda7db1ca379691c56830e1dd0c8a844645965afc6f683944b939b07f1c79e93f1b054a28b509b8a4f9e69
|
data/README.md
CHANGED
@@ -5,9 +5,10 @@ geminabox-release
|
|
5
5
|
This gem is a dependency free option to add a rake inabox:release task to bundler gem_tasks for releasing a new gem to
|
6
6
|
your geminabox server.
|
7
7
|
|
8
|
+
The gem only uses the ruby default libaries uri and net/http and expects you are using bundler.
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
|
11
|
+
You must no longer require "bundler/gem_tasks" as geminabox-release requires a modified version for you which supports all other functionality!
|
11
12
|
|
12
13
|
## How to use
|
13
14
|
|
@@ -29,7 +30,9 @@ GeminaboxRelease.patch(:use_config => true)
|
|
29
30
|
|
30
31
|
```
|
31
32
|
|
32
|
-
Then you will get
|
33
|
+
Then you will get a rake inabox:release task.
|
34
|
+
|
35
|
+
**Ensure you do not _require "bundler/gem_tasks"_ in your rakefile anymore!**
|
33
36
|
|
34
37
|
The gem (theoretically) supports basic auth like geminabox in the host address. e.g. http://username:password@localhost:4000
|
35
38
|
It's untested as we didn't need it. Feel free to try it.
|
@@ -47,7 +50,7 @@ $> rake inabox:forcepush # builds gem and pushes to geminabox server overwri
|
|
47
50
|
|
48
51
|
## Safety
|
49
52
|
|
50
|
-
To ensure you are not
|
53
|
+
To ensure you are not accidentally pushing your gem to rubygems there are two distinct safety measures.
|
51
54
|
|
52
55
|
1) The rake task has another name. Do not use rake release if you want to push to your geminabox server!
|
53
56
|
|
data/lib/geminabox-release.rb
CHANGED
@@ -3,23 +3,55 @@ require 'net/http'
|
|
3
3
|
|
4
4
|
module GeminaboxRelease
|
5
5
|
|
6
|
+
class GeminaboxRelease::Error < StandardError; end
|
7
|
+
class GeminaboxRelease::NoHost < GeminaboxRelease::Error
|
8
|
+
def initialize(msg = "")
|
9
|
+
if msg.empty?
|
10
|
+
msg = "Please provide a host to upload to, via :host or :use_config option."
|
11
|
+
end
|
12
|
+
super(msg)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class GeminaboxRelease::NoConfigFile < GeminaboxRelease::Error
|
17
|
+
def initialize(msg = "")
|
18
|
+
if msg.empty?
|
19
|
+
msg = "Please provide a geminabox config file in ~/.gem/geminabox to use :use_config option.\n"
|
20
|
+
msg += "The config file should be YAML with an host entry, e.g.\n \":host: http://your.host.tld:optional-port\""
|
21
|
+
end
|
22
|
+
super(msg)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class GeminaboxRelease::InvalidConfig < GeminaboxRelease::Error
|
27
|
+
def initialize(msg = "")
|
28
|
+
if msg.empty?
|
29
|
+
msg = "Please set your host in your geminabox config (in ~/.gem/geminabox).\n"
|
30
|
+
msg += "The config file should be YAML with an host entry, e.g.\n \":host: http://your.host.tld:optional-port\""
|
31
|
+
end
|
32
|
+
super(msg)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
6
36
|
def self.host
|
7
37
|
@host
|
8
38
|
end
|
9
39
|
|
10
40
|
def self.patch(options = {})
|
41
|
+
begin
|
11
42
|
if options[:host]
|
12
43
|
@host = options[:host]
|
13
44
|
elsif options[:use_config]
|
14
45
|
require 'yaml'
|
46
|
+
raise GeminaboxRelease::NoConfigFile unless File.exist?(File.expand_path("~/.gem/geminabox"))
|
15
47
|
data = YAML.load_file(File.expand_path("~/.gem/geminabox"))
|
16
48
|
if data.has_key?(:host)
|
17
49
|
@host = data[:host]
|
18
50
|
else
|
19
|
-
raise
|
51
|
+
raise GeminaboxRelease::InvalidConfig
|
20
52
|
end
|
21
53
|
else
|
22
|
-
raise
|
54
|
+
raise GeminaboxRelease::NoHost
|
23
55
|
end
|
24
56
|
|
25
57
|
Bundler::GemHelper.class_eval do
|
@@ -112,5 +144,11 @@ module GeminaboxRelease
|
|
112
144
|
# initialize patched gem tasks
|
113
145
|
require 'bundler/gem_tasks'
|
114
146
|
|
147
|
+
end
|
148
|
+
rescue GeminaboxRelease::Error => e
|
149
|
+
# \033[31m RED, \033[1m BOLD, \033[22m BOLD OFF, \033[0m COLOR OFF
|
150
|
+
STDERR.puts "\033[31mGeminaboxRelease Exception: \033[1m#{e.class.to_s}\033[22m\033[0m"
|
151
|
+
STDERR.puts "\033[31m#{e.message}\033[0m"
|
115
152
|
end
|
153
|
+
|
116
154
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geminabox-release
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis-Florian Herr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Dependency free rake release task for geminabox
|
14
14
|
email:
|
@@ -17,8 +17,8 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- lib/geminabox-release/version.rb
|
21
20
|
- lib/geminabox-release.rb
|
21
|
+
- lib/geminabox-release/version.rb
|
22
22
|
- .gitignore
|
23
23
|
- .ruby-version
|
24
24
|
- Gemfile
|