gemtoabox 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +59 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/gemtoabox +26 -0
- data/bin/setup +8 -0
- data/gemtoabox.gemspec +27 -0
- data/lib/gemtoabox/version.rb +3 -0
- data/lib/gemtoabox.rb +60 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5efe0ca118a1d983eb772b5d0c6709cbac8a2c6e
|
4
|
+
data.tar.gz: b8374dbe2c2bcf06db151f4fc4accb1c8643a733
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 20dce30cf138eb1cb5a90ff9ea479132a400a562883329962baefadf281d841b472dac594131977b59eb535b37ad631ef2dce4d8368e9301df1e0436f560cc0f
|
7
|
+
data.tar.gz: 43dd0c76cdc66ad9f16dcc444f4b87ed5b8a5b30e056e2e8a9634a1c9b8701689202950ebfbb7be4a423f3ac719561e11cdcf46815af0f70cb11ff678c80d5ac
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Yuri Karpovich
|
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,59 @@
|
|
1
|
+
# Gemtoabox
|
2
|
+
|
3
|
+
This gem provides the ability to backup your project gems to the private rubygem hosting on remote or local machine.
|
4
|
+
All you need is to specify path to your project Gemfile.
|
5
|
+
|
6
|
+
###### Advantages
|
7
|
+
- Gems dependencies resolving operation performs on your machine, on your environment.
|
8
|
+
That means you may be sure you save exact same gems versions you use on your project.
|
9
|
+
- Easy to use - just run executable bin file with your patamaters.
|
10
|
+
- Extremely easy to deploy your own rebygem server with [geminabox](https://hub.docker.com/r/spoonest/geminabox) docker image:
|
11
|
+
|
12
|
+
```bash
|
13
|
+
docker run -d --name geminabox -e RUBYGEMS_PROXY=true -e PRIVATE=true \
|
14
|
+
-v /local_path_where_to_store_gems:/webapps/geminabox/data -p 9292:9292 -P -h geminabox \
|
15
|
+
-e USERNAME=myuser -e PASSWORD=mypassword spoonest/geminabox:latest
|
16
|
+
```
|
17
|
+
|
18
|
+
###### Disadvantages
|
19
|
+
- This gem doesn't have any tests so feel free to contribute.
|
20
|
+
- Not sure it will work on Windows OS
|
21
|
+
|
22
|
+
## Requirements
|
23
|
+
|
24
|
+
- Bundler should be installed
|
25
|
+
- [geminabox](https://github.com/geminabox/geminabox) gem should be installed
|
26
|
+
|
27
|
+
## Installation
|
28
|
+
|
29
|
+
Add this line to your application's Gemfile:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
gem 'gemtoabox'
|
33
|
+
```
|
34
|
+
|
35
|
+
Or install it yourself as:
|
36
|
+
|
37
|
+
$ gem install gemtoabox
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
|
41
|
+
Get help:
|
42
|
+
|
43
|
+
bin/gemtoabox --help
|
44
|
+
|
45
|
+
Run upload process:
|
46
|
+
|
47
|
+
bin/gemtoabox --gemfile /your_project/Gemfile --host http://<USER>:<PASSWORD>@<HOST>:<PORT>
|
48
|
+
|
49
|
+
## Development
|
50
|
+
|
51
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
52
|
+
|
53
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/yuri-karpovich/gemtoabox.
|
58
|
+
|
59
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "gemtoabox"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/gemtoabox
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# resolve bin path, ignoring symlinks
|
5
|
+
require "pathname"
|
6
|
+
bin_file = Pathname.new(__FILE__).realpath
|
7
|
+
|
8
|
+
# add self to libpath
|
9
|
+
$:.unshift File.expand_path("../../lib", bin_file)
|
10
|
+
|
11
|
+
require "#{Pathname.new(__FILE__).parent.parent}/lib/gemtoabox"
|
12
|
+
include Gemtoabox
|
13
|
+
|
14
|
+
# parse options
|
15
|
+
require 'trollop'
|
16
|
+
opts = Trollop::options do
|
17
|
+
opt :gemfile, "path to Gemfile", :type => :string
|
18
|
+
opt :host, "Geminabox host in format http://<USER>:<PASSWORD>@<HOST>:<PORT>", :type => :string
|
19
|
+
opt :overwrite, 'Overwrite gems on versions conflicts'
|
20
|
+
end
|
21
|
+
|
22
|
+
p = Project.new
|
23
|
+
p.add_gemfile(opts[:gemfile])
|
24
|
+
GemsUploader.upload(from: p.extract_gems, to: opts[:host], overwrite: opts[:overwrite])
|
25
|
+
p.rm_project
|
26
|
+
|
data/bin/setup
ADDED
data/gemtoabox.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gemtoabox/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gemtoabox"
|
8
|
+
spec.version = Gemtoabox::VERSION
|
9
|
+
spec.authors = ["yuri-karpovich"]
|
10
|
+
spec.email = ["spoonest@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Uploads gems from your Gemfile to your own private rubygems hosting}
|
13
|
+
spec.description = %q{This gem provides the ability to backup your project gems to the private rubygem hosting on remote or local machine.
|
14
|
+
All you need is to specify path to your project Gemfile. }
|
15
|
+
spec.homepage = "https://github.com/yuri-karpovich/gemtoabox"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec", '~> 3.2', '>= 3.2.0'
|
25
|
+
spec.add_dependency "geminabox", '~> 0.13', '>= 0.13.0'
|
26
|
+
spec.add_dependency "trollop", '~> 2.1', '>= 2.1.2'
|
27
|
+
end
|
data/lib/gemtoabox.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require "gemtoabox/version"
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Gemtoabox
|
5
|
+
|
6
|
+
class Project
|
7
|
+
attr_accessor :pdir
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@pdir = Dir.mktmpdir
|
11
|
+
FileUtils.mkdir("#{@pdir}/.bundle")
|
12
|
+
config_text = "---
|
13
|
+
BUNDLE_PATH: vendor/bundle
|
14
|
+
BUNDLE_DISABLE_SHARED_GEMS: '1'"
|
15
|
+
File.open("#{@pdir}/.bundle/config", 'w') { |f| f.write(config_text) }
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_gemfile(path)
|
19
|
+
gemfile_path = path
|
20
|
+
gemfile_lock_path = "#{File.dirname(gemfile_path)}/Gemfile.lock"
|
21
|
+
raise "Gemfile was not found in #{path}" unless File.exist? gemfile_path
|
22
|
+
FileUtils.cp(gemfile_path, "#{self.pdir}/Gemfile")
|
23
|
+
FileUtils.cp(gemfile_lock_path, "#{self.pdir}/Gemfile.lock")
|
24
|
+
end
|
25
|
+
|
26
|
+
def extract_gems
|
27
|
+
Bundler.with_clean_env do
|
28
|
+
Dir.chdir "#{self.pdir}"
|
29
|
+
system "bundle install"
|
30
|
+
system "bundle package"
|
31
|
+
end
|
32
|
+
|
33
|
+
"#{self.pdir}/vendor/cache"
|
34
|
+
end
|
35
|
+
|
36
|
+
def rm_project
|
37
|
+
FileUtils.rm_rf self.pdir
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class GemsUploader
|
42
|
+
|
43
|
+
def self.upload(opts)
|
44
|
+
required_options = [:from, :to]
|
45
|
+
required_options.each { |i| raise "#{i} parameter is required" unless opts[i] }
|
46
|
+
overwrite = opts[:overwrite].to_s == 'true'
|
47
|
+
|
48
|
+
gems_folder = opts[:from]
|
49
|
+
host = opts[:to]
|
50
|
+
|
51
|
+
Dir.chdir gems_folder
|
52
|
+
|
53
|
+
command = "gem inabox -g #{host} *.gem"
|
54
|
+
command += ' -o' if overwrite
|
55
|
+
system command
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gemtoabox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- yuri-karpovich
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 3.2.0
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '3.2'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.2.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: geminabox
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0.13'
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 0.13.0
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0.13'
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 0.13.0
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: trollop
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '2.1'
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 2.1.2
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '2.1'
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 2.1.2
|
101
|
+
description: "This gem provides the ability to backup your project gems to the private
|
102
|
+
rubygem hosting on remote or local machine.\nAll you need is to specify path to
|
103
|
+
your project Gemfile. "
|
104
|
+
email:
|
105
|
+
- spoonest@gmail.com
|
106
|
+
executables: []
|
107
|
+
extensions: []
|
108
|
+
extra_rdoc_files: []
|
109
|
+
files:
|
110
|
+
- ".gitignore"
|
111
|
+
- Gemfile
|
112
|
+
- LICENSE
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- bin/console
|
116
|
+
- bin/gemtoabox
|
117
|
+
- bin/setup
|
118
|
+
- gemtoabox.gemspec
|
119
|
+
- lib/gemtoabox.rb
|
120
|
+
- lib/gemtoabox/version.rb
|
121
|
+
homepage: https://github.com/yuri-karpovich/gemtoabox
|
122
|
+
licenses: []
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.4.5.1
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Uploads gems from your Gemfile to your own private rubygems hosting
|
144
|
+
test_files: []
|