rocker-docket 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -8
- data/bin/rkt +1 -1
- data/bin/rocker-docket +14 -5
- data/{Dockerfile → lib/rocker/Dockerfile.erb} +1 -1
- data/lib/rocker/docket.rb +52 -1
- data/lib/rocker/docket/version.rb +1 -1
- 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: a958dca255506b4a3308b658c3be7305bd2c9188
|
4
|
+
data.tar.gz: 55ce171c83214bc3bc4c2fea2f9c893667ff9372
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 660254a3aa01b9f6e13231b92b555d4c8b2f6a3a7e3f5abc3d40bc09e2d9270ec359c324f68d91f717c69668d93fb995ab0a89b3f48393f08833b341d115b2de
|
7
|
+
data.tar.gz: 3895472a9f574158ed58c351f3393bec1a82421fbc4b2d69344278587e05df809512700d06f595ea1d579aae06b85097219f19b804242a83de551fa82240a80e
|
data/README.md
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
# Rocker-Docket
|
2
|
-
Run Rocket under Docker.
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
Run [Rocket](https://github.com/coreos/rocket) under [Docker](https://github.com/docker/docker).
|
4
|
+
|
5
|
+
This gives you access to the rkt executable without having to install rkt on your system.
|
6
|
+
You do, however, have to have docker installed.
|
7
|
+
|
8
|
+
# Installation
|
9
|
+
|
10
|
+
Install the gem:
|
6
11
|
```bash
|
7
|
-
|
8
|
-
docker run rocker-docket help
|
12
|
+
gem install rocker-docket
|
9
13
|
```
|
10
14
|
|
11
|
-
|
12
|
-
|
15
|
+
Once installed, you can:
|
16
|
+
* Build the image : ```rocker-docket build```
|
17
|
+
* Update to the latest version of rocket: ```rocker-docket update```.
|
13
18
|
|
14
|
-
|
19
|
+
Updating will also build. If you have never run build before, it will get the
|
20
|
+
latest version of rocket.
|
21
|
+
|
22
|
+
# Usage
|
23
|
+
Use it just like you would use the rkt CLI, after you have built the image.
|
24
|
+
```bash
|
25
|
+
rkt help
|
26
|
+
```
|
15
27
|
|
28
|
+
By default, the host directory /var/lib/rkt will be mounted in the container, for rkt
|
29
|
+
operations. You can override this by setting ```ROCKET_DIR```.
|
data/bin/rkt
CHANGED
data/bin/rocker-docket
CHANGED
@@ -1,12 +1,21 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
$: << File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
+
require 'rocker/docket'
|
4
|
+
FileUtils.mkdir_p Rocker::Docket.dir
|
5
|
+
|
6
|
+
|
2
7
|
case ARGV[0]
|
3
8
|
when 'build'
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
9
|
+
Rocker::Docket.build
|
10
|
+
when 'update'
|
11
|
+
tag = Rocker::Docket.update
|
12
|
+
if tag
|
13
|
+
puts "Updated to #{tag}."
|
14
|
+
else
|
15
|
+
puts "Already on latest version."
|
16
|
+
end
|
8
17
|
else
|
9
|
-
puts "Usage: rocker-docket [build|
|
18
|
+
puts "Usage: rocker-docket [build|update]"
|
10
19
|
exit 1
|
11
20
|
end
|
12
21
|
|
data/lib/rocker/docket.rb
CHANGED
@@ -1,7 +1,58 @@
|
|
1
1
|
require "rocker/docket/version"
|
2
|
+
require 'erb'
|
3
|
+
require 'json'
|
4
|
+
require 'open-uri'
|
2
5
|
|
3
6
|
module Rocker
|
4
7
|
module Docket
|
5
|
-
|
8
|
+
class << self
|
9
|
+
def build
|
10
|
+
update unless File.exists? dockerfile
|
11
|
+
write(dockerfile, ERB.new(File.read(template)).result(binding))
|
12
|
+
exec "docker build -t rocker-docket #{dir}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def template
|
16
|
+
"#{File.join(File.dirname(__FILE__), 'Dockerfile.erb')}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def update
|
20
|
+
release = JSON.parse(releases_string)[0]
|
21
|
+
assets_url = release['assets_url']
|
22
|
+
tag = release['tag_name']
|
23
|
+
download_url = JSON.parse(open(assets_url){|f| f.read }).detect{ |a| a['name'] =~ /rocket.*.tar.gz/ }['browser_download_url']
|
24
|
+
if download_url == rocket_url
|
25
|
+
nil
|
26
|
+
else
|
27
|
+
write(rocket_url_file, download_url)
|
28
|
+
tag
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def releases_string
|
33
|
+
open("https://api.github.com/repos/coreos/rocket/releases"){ |f| f.read }
|
34
|
+
end
|
35
|
+
|
36
|
+
def dockerfile
|
37
|
+
"#{dir}/Dockerfile"
|
38
|
+
end
|
39
|
+
|
40
|
+
def rocket_url
|
41
|
+
File.read rocket_url_file if File.exists? rocket_url_file
|
42
|
+
end
|
43
|
+
|
44
|
+
def rocket_url_file
|
45
|
+
"#{dir}/rocket_url"
|
46
|
+
end
|
47
|
+
|
48
|
+
def dir
|
49
|
+
"#{ENV['HOME']}/.rocker-docket"
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
def write(file, string)
|
54
|
+
File.open(file, 'w'){ |f| f.write(string) }
|
55
|
+
end
|
56
|
+
end
|
6
57
|
end
|
7
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocker-docket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Shea
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -48,13 +48,13 @@ extensions: []
|
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
50
|
- ".gitignore"
|
51
|
-
- Dockerfile
|
52
51
|
- Gemfile
|
53
52
|
- LICENSE.txt
|
54
53
|
- README.md
|
55
54
|
- Rakefile
|
56
55
|
- bin/rkt
|
57
56
|
- bin/rocker-docket
|
57
|
+
- lib/rocker/Dockerfile.erb
|
58
58
|
- lib/rocker/docket.rb
|
59
59
|
- lib/rocker/docket/version.rb
|
60
60
|
- rocker-docket.gemspec
|