geminabox-release 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c325616eb9060eccdcf2631308b087680fe7682d
4
+ data.tar.gz: 82011a63de0f1d810f556d941ec339da849339ae
5
+ SHA512:
6
+ metadata.gz: a703ef8202757746c3267651738bbfb61d842e7167a1605460c08da5f360dd51e303b8a1365300b8c2a785a9891ac28f6f19c60b0650cf5faf7fe0c56e9f6752
7
+ data.tar.gz: bf2290294d23b2eebe911fb1be957794dfb97f0fb3afcc4af7f81b33a3228196180b3de296283c33a1a57bdaaa3844a8638a1bde5d49a3ebf615d60343c31c58
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ # ide
2
+ .idea/
3
+
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0-p481
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Dennis-Florian Herr @ Experteer GmbH
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ geminabox-release
2
+ =================
3
+
4
+ This gem is a dependency free option to modify your bundlers gem release task to work with your geminabox server.
5
+
6
+ ## How to use
7
+
8
+ Simply load this gem and and patch with your geminabox URL before requiring bundler/gem_tasks in your Rakefile.
9
+
10
+ E.g.
11
+
12
+ ```
13
+ require 'geminabox-release'
14
+ GeminaboxRelease.patch("http://localhost:4000")
15
+ require 'bundler/gem_tasks'
16
+
17
+ ```
18
+
19
+ Then your bundler rake release will be overwritten with rake release:inabox to your specified host.
20
+
21
+ The gem (theoretically) supports basic auth like geminabox in the host address. e.g. http://username:password@localhost:4000
22
+ It's untested as we didn't need it. Feel free to try it.
23
+
24
+ The order is important as requiring bunlder/gem_tasks creates the rake tasks and this gem does not modify them after that.
25
+
26
+
27
+ # LICENSE
28
+
29
+ see {LICENSE}
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'geminabox-release/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "geminabox-release"
8
+ spec.version = GeminaboxRelease::VERSION
9
+ spec.authors = ["Dennis-Florian Herr"]
10
+ spec.email = ["dennis.herr@experteer.com"]
11
+ spec.description = 'Dependency free rake release task for geminabox'
12
+ spec.summary = 'see readme'
13
+ spec.license = "MIT"
14
+
15
+ spec.files = Dir["lib/**/*"]
16
+ spec.files += [".gitignore", ".ruby-version", "Gemfile", "geminabox-release.gemspec", "README.md", "Rakefile", "LICENSE"]
17
+ spec.require_paths = ["lib"]
18
+
19
+ end
20
+
21
+
@@ -0,0 +1,87 @@
1
+ require 'uri'
2
+ require 'net/http'
3
+
4
+ module GeminaboxRelease
5
+
6
+ def self.host
7
+ @host
8
+ end
9
+
10
+ def self.options
11
+ @options
12
+ end
13
+
14
+ def self.patch(host, options = {})
15
+ @host = host
16
+ @options = options
17
+
18
+ Bundler::GemHelper.class_eval do
19
+ def install
20
+ built_gem_path = nil
21
+
22
+ desc "Build #{name}-#{version}.gem into the pkg directory."
23
+ task 'build' do
24
+ built_gem_path = build_gem
25
+ end
26
+
27
+ desc "Build and install #{name}-#{version}.gem into system gems."
28
+ task 'install' => 'build' do
29
+ install_gem(built_gem_path)
30
+ end
31
+
32
+ desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to #{GeminaboxRelease.host}"
33
+ task 'release:inabox' => 'build' do
34
+ release_gem(built_gem_path)
35
+ end
36
+
37
+ Bundler::GemHelper.instance = self
38
+ end
39
+
40
+ def rubygem_push(path)
41
+ puts ARGV[0]
42
+ puts ARGV[1]
43
+ puts ARGV[1]
44
+ uri = URI.parse(GeminaboxRelease.host)
45
+ username = uri.user
46
+ password = uri.password
47
+ uri.path = uri.path + "/" unless uri.path.end_with?("/")
48
+ uri.path += "upload"
49
+
50
+ #############
51
+ # prepare multipart file post
52
+ #############
53
+
54
+ # Token used to terminate the file in the post body. Make sure it is not
55
+ # present in the file you're uploading.
56
+ boundary = "AaB03x" + "BOUNDARY" + "x30BaA"
57
+
58
+ post_body = []
59
+ post_body << "--#{boundary}\r\n"
60
+ post_body << "Content-Disposition: form-data; name=\"file\"; filename=\"#{File.basename(path)}\"\r\n"
61
+ post_body << "Content-Type: application/octet-stream\r\n"
62
+ post_body << "\r\n"
63
+ post_body << File.binread(path)
64
+ post_body << "\r\n--#{boundary}\r\n"
65
+ post_body << "Content-Disposition: form-data; name=\"overwrite\"\r\n"
66
+ post_body << "\r\n"
67
+ post_body << "#{!!GeminaboxRelease.options[:overwrite]}"
68
+ post_body << "\r\n--#{boundary}--\r\n\r\n"
69
+
70
+ http = Net::HTTP.new(uri.host, uri.port)
71
+ req = Net::HTTP::Post.new(uri.request_uri)
72
+ req.body = post_body.join
73
+ req.basic_auth(username, password) unless username.nil? || username.empty?
74
+ req['Accept'] = 'text/plain'
75
+ req["Content-Type"] = "multipart/form-data; boundary=#{boundary}"
76
+ response = http.request(req)
77
+ if response.code.to_i < 300
78
+ puts response.body
79
+ else
80
+ raise "Error (#{response.code} received)\n\n#{response.body}"
81
+ end
82
+ end
83
+
84
+ end
85
+
86
+ end
87
+ end
@@ -0,0 +1,4 @@
1
+ module GeminaboxRelease
2
+ VERSION = "0.0.1"
3
+ end
4
+
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: geminabox-release
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dennis-Florian Herr
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Dependency free rake release task for geminabox
14
+ email:
15
+ - dennis.herr@experteer.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/geminabox-release/version.rb
21
+ - lib/geminabox-release.rb
22
+ - .gitignore
23
+ - .ruby-version
24
+ - Gemfile
25
+ - geminabox-release.gemspec
26
+ - README.md
27
+ - Rakefile
28
+ - LICENSE
29
+ homepage:
30
+ licenses:
31
+ - MIT
32
+ metadata: {}
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubyforge_project:
49
+ rubygems_version: 2.0.14
50
+ signing_key:
51
+ specification_version: 4
52
+ summary: see readme
53
+ test_files: []
54
+ has_rdoc: