geminabox-release 1.0.0 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5a43b3911599c364aa4e059815fad3dc21d9be5
4
- data.tar.gz: d009b8a270fa930c801996f48563f38855ca7efd
3
+ metadata.gz: 3ac2fe544ff961eef561fdca7d85519142cd94fb
4
+ data.tar.gz: 3bc867e5c2831655d7a6e7e9c959cc4e29f5703c
5
5
  SHA512:
6
- metadata.gz: d657614ff542a9830a3f7f816da6a112c997de11ef2abaecbbb4a70263cf241d2738f30cde52811fec230f018d3c6e980b07c7741b0882398e3dcf27440f00fc
7
- data.tar.gz: 78e143b5ac416f9c31e130049b4a66ec90af924b77cfe679c196286d2bf7177820670fe70e80936352f2bd02863858f1375e4f8a81c5038a7f14014383036250
6
+ metadata.gz: 338ec748c5093a9221c71cf058f6b769214a4e0f4a6ce72059ce1f59919fc9503f166e47470326ade7575c41b39a336df2316ad7eb4b4c627b3f1b2df2aefbde
7
+ data.tar.gz: abc2274cba3efe41565c7c2cfda0bbb796ce0174cb6a5e0d9ee659179979d39b00b9d1d18b60dbb4c8027271260e20cd9d2fa1f4ae9886414e23fcb493126bb2
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
1
  # ide
2
2
  .idea/
3
+ pkg/
4
+ Gemfile.lock
3
5
 
data/README.md CHANGED
@@ -16,25 +16,38 @@ You must no longer require "bundler/gem_tasks" as geminabox-release requires a m
16
16
 
17
17
  ## How to use
18
18
 
19
- Simply load this gem and patch with your geminabox URL in your Rakefile.
20
-
21
- E.g.
19
+ Simply load this gem and patch with your geminabox URL in your Rakefile:
22
20
 
23
21
  ```ruby
24
22
  require 'geminabox-release'
25
23
  GeminaboxRelease.patch(:host => "http://localhost:4000")
26
-
27
24
  ```
28
25
 
29
- or use your geminabox config file (YAML file with key :host and host url as value in ~/.gem/geminabox)
26
+ Then you will get a rake `inabox:release` task.
27
+
28
+ If your server requires basic authentication for the deployment, you can specify `:username` and `:password` as well.
29
+
30
+ For reasons of compatibility, you can still specify the credentials in the `:host` option (e.g. `http://username:password@localhost:4000`), in which case
31
+ they take precedence over the other parameters.
32
+
33
+ ### Global Defaults
30
34
 
35
+ You can store global defaults in `~/.gem/geminabox`, for instance:
36
+ ```yaml
37
+ :host: "http://localhost:4000"
38
+ :username: "peter.pan"
39
+ :password: "secret"
40
+ ```
41
+ Apply them by passing the `:use_config` flag:
31
42
  ```ruby
32
43
  require 'geminabox-release'
33
44
  GeminaboxRelease.patch(:use_config => true)
34
45
 
35
46
  ```
36
47
 
37
- Then you will get a rake inabox:release task.
48
+ If an attribute is present in the global configuration, and also passed to the `GeminaboxRelease.patch` call, the latter takes precedence.
49
+
50
+ ### SSL
38
51
 
39
52
  If your geminabox server is using SSL/TLS, but you have an untrusted certificate, you can use the option `ssl_dont_verify`.
40
53
 
@@ -47,6 +60,7 @@ GeminaboxRelease.patch(:host => "https://localhost:4000", :ssl_dont_verify => tr
47
60
 
48
61
  However, that is _NOT_ recommended.
49
62
 
63
+ ### Bundler's `release` Task
50
64
 
51
65
  If you wish to remove the bundler/gem_tasks rake release task, you can by adding `:remove_release` to the patch options:
52
66
 
@@ -55,12 +69,8 @@ GeminaboxRelease.patch(:remove_release => true)
55
69
 
56
70
  ```
57
71
 
58
-
59
72
  **Ensure you do not _require "bundler/gem_tasks"_ in your rakefile anymore!**
60
73
 
61
- The gem (theoretically) supports basic auth like geminabox in the host address. e.g. http://username:password@localhost:4000
62
- It's untested as we didn't need it. Feel free to try it.
63
-
64
74
 
65
75
  ### Additional tasks
66
76
 
@@ -90,6 +100,8 @@ If the rake tasks do not show make sure you did not require "bundler/gem_tasks"
90
100
 
91
101
  [Jens Hilligsøe](https://github.com/hilli)
92
102
 
103
+ [Frank Schoenheit](https://github.com/frank-schoenheit-red6es)
104
+
93
105
 
94
106
  # LICENSE
95
107
 
@@ -35,28 +35,49 @@ module GeminaboxRelease
35
35
  end
36
36
 
37
37
  def self.host
38
- @host
38
+ @config[:host]
39
+ end
40
+
41
+ def self.username
42
+ @config[:username]
43
+ end
44
+
45
+ def self.password
46
+ @config[:password]
47
+ end
48
+
49
+ def self.ssl_dont_verify
50
+ @config[:ssl_dont_verify]
51
+ end
52
+
53
+ # extract credentials from a) our options and b) the given URI
54
+ def self.credentials(uri)
55
+ username = GeminaboxRelease.username
56
+ password = GeminaboxRelease.password
57
+
58
+ unless uri.user.nil? || uri.user.empty?
59
+ username = URI.unescape uri.user
60
+ password = URI.unescape uri.password
61
+ end
62
+ [username, password]
39
63
  end
40
64
 
41
65
  def self.patch(options = {})
42
66
  begin
43
- if options[:host]
44
- @host = options[:host]
45
- elsif options[:use_config]
67
+ attribute_options = [:host, :username, :password, :ssl_dont_verify]
68
+ @config = {}
69
+ # read defaults from config file, if requested
70
+ if options[:use_config]
46
71
  require 'yaml'
47
72
  raise GeminaboxRelease::NoConfigFile unless File.exist?(File.expand_path("~/.gem/geminabox"))
48
73
  data = YAML.load_file(File.expand_path("~/.gem/geminabox"))
49
- if data.has_key?(:host)
50
- @host = data[:host]
51
- else
52
- raise GeminaboxRelease::InvalidConfig
53
- end
54
- else
55
- raise GeminaboxRelease::NoHost
56
- end
57
- if options[:ssl_dont_verify]
58
- @ssl_dont_verify = options[:ssl_dont_verify]
74
+ attribute_options.each { |k| @config[k] = data[k] if data.has_key?(k) }
59
75
  end
76
+ # overwrite defaults with concrete values, if specified
77
+ @config.merge! options.select { |k,v| attribute_options.include? k }
78
+
79
+ # sanity checks
80
+ raise GeminaboxRelease::NoHost if @config[:host].nil?
60
81
 
61
82
  Bundler::GemHelper.class_eval do
62
83
 
@@ -100,8 +121,9 @@ module GeminaboxRelease
100
121
  # pushes to geminabox
101
122
  def inabox_push(path, force = false)
102
123
  uri = URI.parse(GeminaboxRelease.host)
103
- username = uri.user
104
- password = uri.password
124
+
125
+ username, password = GeminaboxRelease.credentials(uri)
126
+
105
127
  uri.path = uri.path + "/" unless uri.path.end_with?("/")
106
128
  uri.path += "upload"
107
129
 
@@ -128,7 +150,7 @@ module GeminaboxRelease
128
150
  http = Net::HTTP.new(uri.host, uri.port)
129
151
  if uri.scheme == 'https'
130
152
  http.use_ssl = true
131
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @ssl_dont_verify
153
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE if GeminaboxRelease.ssl_dont_verify
132
154
  end
133
155
  req = Net::HTTP::Post.new(uri.request_uri)
134
156
  req.body = post_body.join
@@ -3,6 +3,6 @@ module GeminaboxRelease
3
3
  # bundler >= 1.0.14 actually is a dependency
4
4
  # Version 0.2.0
5
5
  # * @hilli added support for https with optional veriy_none mode
6
- VERSION = "1.0.0"
6
+ VERSION = "1.1.0"
7
7
  end
8
8
 
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geminabox-release
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
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: 2017-05-10 00:00:00.000000000 Z
11
+ date: 2017-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.14
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.0.14
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Dependency free rake release task for geminabox
@@ -45,14 +45,14 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - lib/geminabox-release.rb
49
- - lib/geminabox-release/version.rb
50
- - .gitignore
48
+ - ".gitignore"
51
49
  - Gemfile
52
- - geminabox-release.gemspec
50
+ - LICENSE
53
51
  - README.md
54
52
  - Rakefile
55
- - LICENSE
53
+ - geminabox-release.gemspec
54
+ - lib/geminabox-release.rb
55
+ - lib/geminabox-release/version.rb
56
56
  homepage:
57
57
  licenses:
58
58
  - MIT
@@ -63,19 +63,18 @@ require_paths:
63
63
  - lib
64
64
  required_ruby_version: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - '>='
71
+ - - ">="
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  requirements: []
75
75
  rubyforge_project:
76
- rubygems_version: 2.0.14
76
+ rubygems_version: 2.6.11
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: see readme
80
80
  test_files: []
81
- has_rdoc: