rbdock 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/rbdock +0 -1
- data/lib/rbdock.rb +3 -2
- data/lib/rbdock/application.rb +93 -0
- data/lib/rbdock/command.rb +1 -1
- data/lib/rbdock/command/options.rb +26 -8
- data/lib/rbdock/generate.rb +25 -12
- data/lib/rbdock/helpers.rb +0 -64
- data/lib/rbdock/version.rb +1 -1
- data/man/rbdock.1 +88 -0
- data/man/rbdock.1.html +131 -0
- data/man/rbdock.1.ronn +56 -0
- data/rbdock.gemspec +2 -0
- metadata +45 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: afcfd019368909a53cd8f7aa0383d10bae904a31
|
4
|
+
data.tar.gz: 68ba344e4dd32b2288b0ec11fc308e32302f92e7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 28eaaf87143875c9fdb56320dd2637115c9307fc45a171eb86a046f70ecfdee4504b34f5095d192337f64fe4dc07d5b6d6132118cae083c77f0b8b45d158b3b0
|
7
|
+
data.tar.gz: 859023e7afa4f0f345816b9509d25a854011185511a1daed5f9213a526412d977be395c4068d944108f8784bfae905ef742c543ea9aec658fbc1371e7cf9c326
|
data/bin/rbdock
CHANGED
data/lib/rbdock.rb
CHANGED
@@ -43,6 +43,7 @@ end
|
|
43
43
|
require "rbdock/helpers"
|
44
44
|
|
45
45
|
module Rbdock
|
46
|
-
autoload :Command,
|
47
|
-
autoload :Generate,
|
46
|
+
autoload :Command, "rbdock/command"
|
47
|
+
autoload :Generate, "rbdock/generate"
|
48
|
+
autoload :Application, "rbdock/application"
|
48
49
|
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Rbdock
|
4
|
+
|
5
|
+
class Application
|
6
|
+
|
7
|
+
def self.prepare url
|
8
|
+
new(url).execute
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize url
|
12
|
+
@logger = Log4r::Logger.new("rbdock::application")
|
13
|
+
@logger.info("Preparing application at #{url}")
|
14
|
+
@url = url
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute
|
18
|
+
|
19
|
+
if local?
|
20
|
+
raise ArgumentError, "Application path #{@url} is not exist" if not File.exist?(@url)
|
21
|
+
@logger.debug("Use local application at #{@url}")
|
22
|
+
return @url
|
23
|
+
end
|
24
|
+
|
25
|
+
if git?
|
26
|
+
raise StandardError, "Command git not found." if `which git`.empty?
|
27
|
+
@logger.debug("Use `git` to clone application")
|
28
|
+
|
29
|
+
if cloned? and same_application?
|
30
|
+
@logger.debug("Update application at #{@url}")
|
31
|
+
git_update
|
32
|
+
end
|
33
|
+
|
34
|
+
if cloned? and not same_application?
|
35
|
+
@logger.debug("Replace application at #{@url}")
|
36
|
+
replace
|
37
|
+
end
|
38
|
+
|
39
|
+
if not cloned?
|
40
|
+
@logger.debug("Clone application at #{@url}")
|
41
|
+
git_clone
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
return clone_path
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
def local?
|
50
|
+
not URI.regexp =~ @url
|
51
|
+
end
|
52
|
+
|
53
|
+
def git?
|
54
|
+
@url.include?(".git") || @url.include?("github.com") || @url.include?("git@")
|
55
|
+
end
|
56
|
+
|
57
|
+
def cloned?
|
58
|
+
File.exist? clone_path
|
59
|
+
end
|
60
|
+
|
61
|
+
def same_application?
|
62
|
+
@url == `git --git-dir=#{clone_path}/.git config --get remote.origin.url`.chomp
|
63
|
+
end
|
64
|
+
|
65
|
+
def clone_path
|
66
|
+
@clone_path ||= '.rbdock_app'
|
67
|
+
end
|
68
|
+
|
69
|
+
def git_clone
|
70
|
+
checked_system("git clone -q #{@url} #{clone_path}", "Clone")
|
71
|
+
STDERR.puts "Clone #{@url} to #{clone_path}/"
|
72
|
+
end
|
73
|
+
|
74
|
+
def git_update
|
75
|
+
checked_system("cd #{clone_path}; git pull -q", "Update")
|
76
|
+
STDERR.puts "Update #{@url}"
|
77
|
+
end
|
78
|
+
|
79
|
+
def replace
|
80
|
+
checked_system("rm -fr #{clone_path}", "Replace")
|
81
|
+
git_clone
|
82
|
+
STDERR.puts "Delete old application and clone #{@url} to #{clone_path}/"
|
83
|
+
clone_path
|
84
|
+
end
|
85
|
+
|
86
|
+
def checked_system command, action
|
87
|
+
if not system(command)
|
88
|
+
raise StandardError, "#{action} #{@url} is failed."
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
end
|
data/lib/rbdock/command.rb
CHANGED
@@ -15,7 +15,7 @@ module Rbdock
|
|
15
15
|
def execute
|
16
16
|
options = Options.parse!(@argv)
|
17
17
|
if options[:app]
|
18
|
-
options[:app_path] = Rbdock.
|
18
|
+
options[:app_path] = Rbdock::Application.prepare(options[:app])
|
19
19
|
end
|
20
20
|
Rbdock::Generate.run(options)
|
21
21
|
rescue => e
|
@@ -6,6 +6,9 @@ module Rbdock
|
|
6
6
|
|
7
7
|
def self.parse!(argv)
|
8
8
|
|
9
|
+
# Setup logger
|
10
|
+
@logger = Log4r::Logger.new("rbdock::command::options")
|
11
|
+
|
9
12
|
# Restore option and its value
|
10
13
|
options = {}
|
11
14
|
|
@@ -24,6 +27,7 @@ module Rbdock
|
|
24
27
|
|
25
28
|
def self.set_default_value options
|
26
29
|
options[:image] = "ubuntu"
|
30
|
+
options[:output_filename] = "Dockerfile"
|
27
31
|
end
|
28
32
|
|
29
33
|
def self.create_command_parser options
|
@@ -31,21 +35,35 @@ module Rbdock
|
|
31
35
|
show_version opt
|
32
36
|
show_help opt
|
33
37
|
|
34
|
-
opt.on('-i name','--image=name', 'Set image name(ubuntu|centos)') { |
|
35
|
-
options[:image] =
|
38
|
+
opt.on('-i name','--image=name', 'Set image name (ubuntu|centos)') { |i|
|
39
|
+
options[:image] = i
|
40
|
+
}
|
41
|
+
|
42
|
+
opt.on('-a path','--app=path', 'Add Rails/Sinatra app') { |path|
|
43
|
+
options[:app] = path
|
44
|
+
}
|
45
|
+
|
46
|
+
opt.on('-o filename', '--ouput=filename', 'Set output Dockerfile name') { |f|
|
47
|
+
options[:output_filename] = f
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
opt.on('-f','--force', 'Attempt to overwrite Dockerfile without prompting for confirmation') {|b|
|
52
|
+
options[:force_write_mode] = b
|
36
53
|
}
|
37
|
-
|
54
|
+
|
55
|
+
opt.on('--rbenv', desc='Use rbenv for ruby version manager') {
|
38
56
|
options[:use_rbenv] = true
|
39
57
|
}
|
40
|
-
|
58
|
+
|
59
|
+
opt.on('--rvm', desc='Use rvm for ruby version manager') {
|
41
60
|
options[:use_rvm] = true
|
42
61
|
}
|
43
|
-
|
44
|
-
options[:app] = path
|
45
|
-
}
|
62
|
+
|
46
63
|
opt.on('-l','--list', 'List all available ruby versions') {
|
47
64
|
list_ruby_versions
|
48
65
|
}
|
66
|
+
|
49
67
|
opt.on('--debug', desc='Run as debug mode')
|
50
68
|
end
|
51
69
|
end
|
@@ -59,7 +77,7 @@ module Rbdock
|
|
59
77
|
end
|
60
78
|
|
61
79
|
def self.show_help opt
|
62
|
-
opt.banner = "Usage: #{opt.program_name} <ruby-versions> [
|
80
|
+
opt.banner = "Usage: #{opt.program_name} <ruby-versions> [options]"
|
63
81
|
opt.on_tail('-h','--help','Show this message') {
|
64
82
|
STDERR.puts opt.help
|
65
83
|
exit
|
data/lib/rbdock/generate.rb
CHANGED
@@ -12,11 +12,13 @@ module Rbdock
|
|
12
12
|
@logger = Log4r::Logger.new("rbdock::generate")
|
13
13
|
@logger.info("Generate options: #{options.inspect}")
|
14
14
|
|
15
|
-
@image
|
16
|
-
@ruby_versions
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
15
|
+
@image = options[:image]
|
16
|
+
@ruby_versions = options[:ruby_versions]
|
17
|
+
@dockerfile_name = options[:output_filename]
|
18
|
+
@force_write_mode = options[:force_write_mode]
|
19
|
+
@use_rbenv = options[:use_rbenv]
|
20
|
+
@use_rvm = options[:use_rvm]
|
21
|
+
@app_path = options[:app_path]
|
20
22
|
end
|
21
23
|
|
22
24
|
def execute
|
@@ -32,21 +34,32 @@ module Rbdock
|
|
32
34
|
end
|
33
35
|
|
34
36
|
def safe_write content
|
35
|
-
if File.exist?
|
36
|
-
STDERR.print "Overwrite
|
37
|
-
if $stdin.gets.chomp == '
|
38
|
-
File.open(
|
37
|
+
if !@force_write_mode && File.exist?(@dockerfile_name)
|
38
|
+
STDERR.print "Overwrite #{@dockerfile_name}? Y/n: "
|
39
|
+
if $stdin.gets.chomp == 'Y'
|
40
|
+
File.open(@dockerfile_name,'w') do |f|
|
39
41
|
f.puts content
|
40
42
|
end
|
41
|
-
|
43
|
+
|
44
|
+
if @dockerfile_name == 'Dockerfile'
|
45
|
+
STDERR.puts "Dockerfile is successfully generated"
|
46
|
+
else
|
47
|
+
STDERR.puts "Dockerfile named '#{@dockerfile_name}' is successfully generated"
|
48
|
+
end
|
49
|
+
|
42
50
|
else
|
43
51
|
puts content
|
44
52
|
end
|
45
53
|
else
|
46
|
-
File.open(
|
54
|
+
File.open(@dockerfile_name,'w') do |f|
|
47
55
|
f.puts content
|
48
56
|
end
|
49
|
-
|
57
|
+
|
58
|
+
if @dockerfile_name == 'Dockerfile'
|
59
|
+
STDERR.puts "Dockerfile is successfully generated"
|
60
|
+
else
|
61
|
+
STDERR.puts "Dockerfile named '#{@dockerfile_name}' is successfully generated"
|
62
|
+
end
|
50
63
|
end
|
51
64
|
end
|
52
65
|
|
data/lib/rbdock/helpers.rb
CHANGED
@@ -8,69 +8,5 @@ module Rbdock
|
|
8
8
|
def source_root
|
9
9
|
@source_root ||= Pathname.new(File.expand_path('../../../', __FILE__))
|
10
10
|
end
|
11
|
-
|
12
|
-
def clone_app_to_local url
|
13
|
-
raise StandardError, "command git not found." if `which git`.empty?
|
14
|
-
|
15
|
-
if local? url
|
16
|
-
if not File.exist? url
|
17
|
-
raise StandardError, "#{url} is not exit"
|
18
|
-
end
|
19
|
-
|
20
|
-
return url
|
21
|
-
end
|
22
|
-
|
23
|
-
if not already_cloned?
|
24
|
-
return exec_clone url
|
25
|
-
end
|
26
|
-
|
27
|
-
if already_cloned? and same_app?(url)
|
28
|
-
return update_app url
|
29
|
-
end
|
30
|
-
|
31
|
-
return replace_app url
|
32
|
-
end
|
33
|
-
|
34
|
-
def default_app_path
|
35
|
-
'.rbdock_app'
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def local? url
|
41
|
-
not URI.regexp =~ url
|
42
|
-
end
|
43
|
-
|
44
|
-
def exec_clone url
|
45
|
-
if not system("git clone -q #{url} #{default_app_path}")
|
46
|
-
raise StandardError, "clone #{url} is failed. Check url."
|
47
|
-
end
|
48
|
-
STDERR.puts "Clone #{url} to #{default_app_path}/"
|
49
|
-
default_app_path
|
50
|
-
end
|
51
|
-
|
52
|
-
def replace_app url
|
53
|
-
system("rm -fr #{default_app_path}")
|
54
|
-
exec_clone url
|
55
|
-
STDERR.puts "Delete old app and clone #{url} to #{default_app_path}/"
|
56
|
-
default_app_path
|
57
|
-
end
|
58
|
-
|
59
|
-
def update_app url
|
60
|
-
if not system("cd #{default_app_path}; git pull -q")
|
61
|
-
raise StandardError, "clone #{url} is failed. Check url."
|
62
|
-
end
|
63
|
-
STDERR.puts "Update #{url}"
|
64
|
-
default_app_path
|
65
|
-
end
|
66
|
-
|
67
|
-
def already_cloned?
|
68
|
-
File.exist? default_app_path
|
69
|
-
end
|
70
|
-
|
71
|
-
def same_app? url
|
72
|
-
url == `git --git-dir=.rbdock_app/.git config --get remote.origin.url`.chomp
|
73
|
-
end
|
74
|
-
|
75
11
|
end
|
76
12
|
end
|
data/lib/rbdock/version.rb
CHANGED
data/man/rbdock.1
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
|
+
.
|
4
|
+
.TH "RBDOCK" "1" "March 2014" "" ""
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBrbdock\fR \- Generate Dockerfile for Ruby, Rails and Sinatra
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
\fBrbdock\fR \fIruby\-versions\fR
|
11
|
+
.
|
12
|
+
.SH "DESCRIPTION"
|
13
|
+
\fBrbdock\fR is a simple command\-line tool for generating Dockerfile for Ruby, Ruby on Rails and Sinatra application\. It generate all most you need when you run Ruby application in docker container, so it\'s perfect for first point for starting to use docker with ruby\. It just generating Dockerfile, so you can edit it for your own setting\.
|
14
|
+
.
|
15
|
+
.SH "OPTIONS"
|
16
|
+
.
|
17
|
+
.TP
|
18
|
+
\fB\-a URL\fR, \fB\-\-app URL\fR
|
19
|
+
URL or path to your Rails or Sinatra application\.
|
20
|
+
.
|
21
|
+
.TP
|
22
|
+
\fB\-i\fR, \fB\-\-image\fR
|
23
|
+
Base image name\. You can use ubuntu or centos now\. By default, \fBrbdock\fR use ubuntu\.
|
24
|
+
.
|
25
|
+
.TP
|
26
|
+
\fB\-\-rbenv\fR
|
27
|
+
Use rbenv for ruby version manager\.
|
28
|
+
.
|
29
|
+
.TP
|
30
|
+
\fB\-\-rvm\fR
|
31
|
+
Use rvm for ruby version manager\.
|
32
|
+
.
|
33
|
+
.TP
|
34
|
+
\fB\-o FILENAME\fR, \fB\-\-output FILENAME\fR
|
35
|
+
Output filename\. By default, \fBrbdock\fR use Dockefile\.
|
36
|
+
.
|
37
|
+
.TP
|
38
|
+
\fB\-f\fR, \fB\-\-force\fR
|
39
|
+
Attempt to overwrite Dockerfile without prompting for confirmation even if Dockerfile exists\.
|
40
|
+
.
|
41
|
+
.TP
|
42
|
+
\fB\-l\fR, \fB\-\-list\fR
|
43
|
+
List all available ruby version\.
|
44
|
+
.
|
45
|
+
.SH "EXAMPLE"
|
46
|
+
Generate Dockerfile to build ruby 2\.1\.0 ready image\.
|
47
|
+
.
|
48
|
+
.IP "" 4
|
49
|
+
.
|
50
|
+
.nf
|
51
|
+
|
52
|
+
$ rbdock 2\.1\.0
|
53
|
+
.
|
54
|
+
.fi
|
55
|
+
.
|
56
|
+
.IP "" 0
|
57
|
+
.
|
58
|
+
.P
|
59
|
+
Generate Dockerfile to build multiple versions of ruby by rvm\.
|
60
|
+
.
|
61
|
+
.IP "" 4
|
62
|
+
.
|
63
|
+
.nf
|
64
|
+
|
65
|
+
$ rbdock 2\.0\.0\-p353 1\.9\.3\-p484 \-\-rvm
|
66
|
+
.
|
67
|
+
.fi
|
68
|
+
.
|
69
|
+
.IP "" 0
|
70
|
+
.
|
71
|
+
.P
|
72
|
+
Generate Dockerfile for Rails with ruby 2\.1\.0\.
|
73
|
+
.
|
74
|
+
.IP "" 4
|
75
|
+
.
|
76
|
+
.nf
|
77
|
+
|
78
|
+
$ rbdock 2\.1\.0 \-\-app my_rails_app/
|
79
|
+
.
|
80
|
+
.fi
|
81
|
+
.
|
82
|
+
.IP "" 0
|
83
|
+
.
|
84
|
+
.SH "BUGS"
|
85
|
+
Report issues at \fIhttps://github\.com/tcnksm/rbdock\fR\.
|
86
|
+
.
|
87
|
+
.SH "COPYRIGHT"
|
88
|
+
rbdock is Copyright (C) 2014 Taichi Nakashima \fIhttp://github\.com/tcnksm\fR
|
data/man/rbdock.1.html
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv='content-type' value='text/html;charset=utf8'>
|
5
|
+
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
|
6
|
+
<title>rbdock(1) - Generate Dockerfile for Ruby, Rails and Sinatra</title>
|
7
|
+
<style type='text/css' media='all'>
|
8
|
+
/* style: man */
|
9
|
+
body#manpage {margin:0}
|
10
|
+
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
11
|
+
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
12
|
+
.mp h2 {margin:10px 0 0 0}
|
13
|
+
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
14
|
+
.mp h3 {margin:0 0 0 4ex}
|
15
|
+
.mp dt {margin:0;clear:left}
|
16
|
+
.mp dt.flush {float:left;width:8ex}
|
17
|
+
.mp dd {margin:0 0 0 9ex}
|
18
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
19
|
+
.mp pre {margin-bottom:20px}
|
20
|
+
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
21
|
+
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
22
|
+
.mp img {display:block;margin:auto}
|
23
|
+
.mp h1.man-title {display:none}
|
24
|
+
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
25
|
+
.mp h2 {font-size:16px;line-height:1.25}
|
26
|
+
.mp h1 {font-size:20px;line-height:2}
|
27
|
+
.mp {text-align:justify;background:#fff}
|
28
|
+
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
29
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
30
|
+
.mp u {text-decoration:underline}
|
31
|
+
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
32
|
+
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
33
|
+
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
34
|
+
.mp b.man-ref {font-weight:normal;color:#434241}
|
35
|
+
.mp pre {padding:0 4ex}
|
36
|
+
.mp pre code {font-weight:normal;color:#434241}
|
37
|
+
.mp h2+pre,h3+pre {padding-left:0}
|
38
|
+
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
39
|
+
ol.man-decor {width:100%}
|
40
|
+
ol.man-decor li.tl {text-align:left}
|
41
|
+
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
42
|
+
ol.man-decor li.tr {text-align:right;float:right}
|
43
|
+
</style>
|
44
|
+
</head>
|
45
|
+
<!--
|
46
|
+
The following styles are deprecated and will be removed at some point:
|
47
|
+
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
48
|
+
|
49
|
+
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
50
|
+
.man-navigation should be used instead.
|
51
|
+
-->
|
52
|
+
<body id='manpage'>
|
53
|
+
<div class='mp' id='man'>
|
54
|
+
|
55
|
+
<div class='man-navigation' style='display:none'>
|
56
|
+
<a href="#NAME">NAME</a>
|
57
|
+
<a href="#SYNOPSIS">SYNOPSIS</a>
|
58
|
+
<a href="#DESCRIPTION">DESCRIPTION</a>
|
59
|
+
<a href="#OPTIONS">OPTIONS</a>
|
60
|
+
<a href="#EXAMPLE">EXAMPLE</a>
|
61
|
+
<a href="#BUGS">BUGS</a>
|
62
|
+
<a href="#COPYRIGHT">COPYRIGHT</a>
|
63
|
+
</div>
|
64
|
+
|
65
|
+
<ol class='man-decor man-head man head'>
|
66
|
+
<li class='tl'>rbdock(1)</li>
|
67
|
+
<li class='tc'></li>
|
68
|
+
<li class='tr'>rbdock(1)</li>
|
69
|
+
</ol>
|
70
|
+
|
71
|
+
<h2 id="NAME">NAME</h2>
|
72
|
+
<p class="man-name">
|
73
|
+
<code>rbdock</code> - <span class="man-whatis">Generate Dockerfile for Ruby, Rails and Sinatra</span>
|
74
|
+
</p>
|
75
|
+
|
76
|
+
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
77
|
+
|
78
|
+
<p><code>rbdock</code> <var>ruby-versions</var></p>
|
79
|
+
|
80
|
+
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
81
|
+
|
82
|
+
<p><strong>rbdock</strong> is a simple command-line tool for generating Dockerfile for Ruby, Ruby on Rails and Sinatra application. It generate all most you need when you run Ruby application in docker container, so it's perfect for first point for starting to use docker with ruby. It just generating Dockerfile, so you can edit it for your own setting.</p>
|
83
|
+
|
84
|
+
<h2 id="OPTIONS">OPTIONS</h2>
|
85
|
+
|
86
|
+
<dl>
|
87
|
+
<dt><code>-a URL</code>, <code>--app URL</code></dt><dd><p> URL or path to your Rails or Sinatra application.</p></dd>
|
88
|
+
<dt><code>-i</code>, <code>--image</code></dt><dd><p> Base image name. You can use ubuntu or centos now. By default, <strong>rbdock</strong> use ubuntu.</p></dd>
|
89
|
+
<dt class="flush"><code>--rbenv</code></dt><dd><p> Use rbenv for ruby version manager.</p></dd>
|
90
|
+
<dt class="flush"><code>--rvm</code></dt><dd><p> Use rvm for ruby version manager.</p></dd>
|
91
|
+
<dt><code>-o FILENAME</code>, <code>--output FILENAME</code></dt><dd><p> Output filename. By default, <strong>rbdock</strong> use Dockefile.</p></dd>
|
92
|
+
<dt><code>-f</code>, <code>--force</code></dt><dd><p> Attempt to overwrite Dockerfile without prompting for confirmation even if Dockerfile exists.</p></dd>
|
93
|
+
<dt><code>-l</code>, <code>--list</code></dt><dd><p> List all available ruby version.</p></dd>
|
94
|
+
</dl>
|
95
|
+
|
96
|
+
|
97
|
+
<h2 id="EXAMPLE">EXAMPLE</h2>
|
98
|
+
|
99
|
+
<p>Generate Dockerfile to build ruby 2.1.0 ready image.</p>
|
100
|
+
|
101
|
+
<pre><code>$ rbdock 2.1.0
|
102
|
+
</code></pre>
|
103
|
+
|
104
|
+
<p>Generate Dockerfile to build multiple versions of ruby by rvm.</p>
|
105
|
+
|
106
|
+
<pre><code>$ rbdock 2.0.0-p353 1.9.3-p484 --rvm
|
107
|
+
</code></pre>
|
108
|
+
|
109
|
+
<p>Generate Dockerfile for Rails with ruby 2.1.0.</p>
|
110
|
+
|
111
|
+
<pre><code>$ rbdock 2.1.0 --app my_rails_app/
|
112
|
+
</code></pre>
|
113
|
+
|
114
|
+
<h2 id="BUGS">BUGS</h2>
|
115
|
+
|
116
|
+
<p>Report issues at <a href="https://github.com/tcnksm/rbdock" data-bare-link="true">https://github.com/tcnksm/rbdock</a>.</p>
|
117
|
+
|
118
|
+
<h2 id="COPYRIGHT">COPYRIGHT</h2>
|
119
|
+
|
120
|
+
<p>rbdock is Copyright (C) 2014 Taichi Nakashima <a href="http://github.com/tcnksm" data-bare-link="true">http://github.com/tcnksm</a></p>
|
121
|
+
|
122
|
+
|
123
|
+
<ol class='man-decor man-foot man foot'>
|
124
|
+
<li class='tl'></li>
|
125
|
+
<li class='tc'>March 2014</li>
|
126
|
+
<li class='tr'>rbdock(1)</li>
|
127
|
+
</ol>
|
128
|
+
|
129
|
+
</div>
|
130
|
+
</body>
|
131
|
+
</html>
|
data/man/rbdock.1.ronn
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
rbdock(1) -- Generate Dockerfile for Ruby, Rails and Sinatra
|
2
|
+
====
|
3
|
+
|
4
|
+
## SYNOPSIS
|
5
|
+
|
6
|
+
`rbdock` <ruby-versions>
|
7
|
+
|
8
|
+
## DESCRIPTION
|
9
|
+
|
10
|
+
**rbdock** is a simple command-line tool for generating Dockerfile for Ruby, Ruby on Rails and Sinatra application. It generate all most you need when you run Ruby application in docker container, so it's perfect for first point for starting to use docker with ruby. It just generating Dockerfile, so you just edit it add your own setting.
|
11
|
+
|
12
|
+
## OPTIONS
|
13
|
+
|
14
|
+
* `-a URL`, `--app URL`:
|
15
|
+
URL or path to your Rails or Sinatra application.
|
16
|
+
|
17
|
+
* `-i`, `--image`:
|
18
|
+
Base image name. You can use ubuntu or centos now. By default, rbdock use ubuntu.
|
19
|
+
|
20
|
+
* `--rbenv`:
|
21
|
+
Use rbenv for ruby version manager.
|
22
|
+
|
23
|
+
* `--rvm`:
|
24
|
+
Use rvm for ruby version manager.
|
25
|
+
|
26
|
+
* `-o FILENAME`, `--output FILENAME`:
|
27
|
+
Output filename. By default, **rbdock** use Dockefile.
|
28
|
+
|
29
|
+
* `-f`, `--force`:
|
30
|
+
Attempt to overwrite Dockerfile without prompting for confirmation even if Dockerfile exists.
|
31
|
+
|
32
|
+
* `-l`, `--list`:
|
33
|
+
List all available ruby version.
|
34
|
+
|
35
|
+
## EXAMPLE
|
36
|
+
|
37
|
+
Generate Dockerfile to build ruby 2.1.0 ready image.
|
38
|
+
|
39
|
+
$ rbdock 2.1.0
|
40
|
+
|
41
|
+
Generate Dockerfile to build multiple versions of ruby by rvm.
|
42
|
+
|
43
|
+
$ rbdock 2.0.0-p353 1.9.3-p484 --rvm
|
44
|
+
|
45
|
+
Generate Dockerfile for Rails with ruby 2.1.0.
|
46
|
+
|
47
|
+
$ rbdock 2.1.0 --app my_rails_app/
|
48
|
+
|
49
|
+
## BUGS
|
50
|
+
|
51
|
+
Report issues at <https://github.com/tcnksm/rbdock>.
|
52
|
+
|
53
|
+
## COPYRIGHT
|
54
|
+
|
55
|
+
rbdock is Copyright (C) 2014 Taichi Nakashima <http://github.com/tcnksm>
|
56
|
+
|
data/rbdock.gemspec
CHANGED
@@ -20,10 +20,12 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_dependency "erubis", "~> 2.7.0"
|
22
22
|
spec.add_dependency "log4r", "~> 1.1.10"
|
23
|
+
spec.add_dependency "gem-man"
|
23
24
|
spec.add_development_dependency "bundler", "~> 1.5"
|
24
25
|
spec.add_development_dependency "rake"
|
25
26
|
spec.add_development_dependency "rspec", ">= 2.13"
|
26
27
|
spec.add_development_dependency "guard-rspec"
|
27
28
|
spec.add_development_dependency "yard", "~> 0.8"
|
28
29
|
spec.add_development_dependency "redcarpet", "~> 2.2"
|
30
|
+
spec.add_development_dependency "ronn"
|
29
31
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbdock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- tcnksm
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-17 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: erubis
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: log4r
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,15 +34,27 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 1.1.10
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gem-man
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
46
55
|
- !ruby/object:Gem::Dependency
|
47
56
|
name: bundler
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
58
|
requirements:
|
51
59
|
- - ~>
|
52
60
|
- !ruby/object:Gem::Version
|
@@ -54,7 +62,6 @@ dependencies:
|
|
54
62
|
type: :development
|
55
63
|
prerelease: false
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
65
|
requirements:
|
59
66
|
- - ~>
|
60
67
|
- !ruby/object:Gem::Version
|
@@ -62,55 +69,48 @@ dependencies:
|
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: rake
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
72
|
requirements:
|
67
|
-
- -
|
73
|
+
- - '>='
|
68
74
|
- !ruby/object:Gem::Version
|
69
75
|
version: '0'
|
70
76
|
type: :development
|
71
77
|
prerelease: false
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
79
|
requirements:
|
75
|
-
- -
|
80
|
+
- - '>='
|
76
81
|
- !ruby/object:Gem::Version
|
77
82
|
version: '0'
|
78
83
|
- !ruby/object:Gem::Dependency
|
79
84
|
name: rspec
|
80
85
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
86
|
requirements:
|
83
|
-
- -
|
87
|
+
- - '>='
|
84
88
|
- !ruby/object:Gem::Version
|
85
89
|
version: '2.13'
|
86
90
|
type: :development
|
87
91
|
prerelease: false
|
88
92
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
93
|
requirements:
|
91
|
-
- -
|
94
|
+
- - '>='
|
92
95
|
- !ruby/object:Gem::Version
|
93
96
|
version: '2.13'
|
94
97
|
- !ruby/object:Gem::Dependency
|
95
98
|
name: guard-rspec
|
96
99
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
100
|
requirements:
|
99
|
-
- -
|
101
|
+
- - '>='
|
100
102
|
- !ruby/object:Gem::Version
|
101
103
|
version: '0'
|
102
104
|
type: :development
|
103
105
|
prerelease: false
|
104
106
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
107
|
requirements:
|
107
|
-
- -
|
108
|
+
- - '>='
|
108
109
|
- !ruby/object:Gem::Version
|
109
110
|
version: '0'
|
110
111
|
- !ruby/object:Gem::Dependency
|
111
112
|
name: yard
|
112
113
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
114
|
requirements:
|
115
115
|
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
@@ -118,7 +118,6 @@ dependencies:
|
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
121
|
requirements:
|
123
122
|
- - ~>
|
124
123
|
- !ruby/object:Gem::Version
|
@@ -126,7 +125,6 @@ dependencies:
|
|
126
125
|
- !ruby/object:Gem::Dependency
|
127
126
|
name: redcarpet
|
128
127
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
128
|
requirements:
|
131
129
|
- - ~>
|
132
130
|
- !ruby/object:Gem::Version
|
@@ -134,11 +132,24 @@ dependencies:
|
|
134
132
|
type: :development
|
135
133
|
prerelease: false
|
136
134
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
135
|
requirements:
|
139
136
|
- - ~>
|
140
137
|
- !ruby/object:Gem::Version
|
141
138
|
version: '2.2'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: ronn
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
142
153
|
description: Generate Dockerfile for ruby or running rails/sinatra.
|
143
154
|
email:
|
144
155
|
- nsd22843@gmail.com
|
@@ -157,11 +168,15 @@ files:
|
|
157
168
|
- Vagrantfile
|
158
169
|
- bin/rbdock
|
159
170
|
- lib/rbdock.rb
|
171
|
+
- lib/rbdock/application.rb
|
160
172
|
- lib/rbdock/command.rb
|
161
173
|
- lib/rbdock/command/options.rb
|
162
174
|
- lib/rbdock/generate.rb
|
163
175
|
- lib/rbdock/helpers.rb
|
164
176
|
- lib/rbdock/version.rb
|
177
|
+
- man/rbdock.1
|
178
|
+
- man/rbdock.1.html
|
179
|
+
- man/rbdock.1.ronn
|
165
180
|
- rbdock.gemspec
|
166
181
|
- spec/spec_helper.rb
|
167
182
|
- templates/base_package/centos.erb
|
@@ -178,33 +193,26 @@ files:
|
|
178
193
|
homepage: https://github.com/tcnksm/rbdock
|
179
194
|
licenses:
|
180
195
|
- MIT
|
196
|
+
metadata: {}
|
181
197
|
post_install_message:
|
182
198
|
rdoc_options: []
|
183
199
|
require_paths:
|
184
200
|
- lib
|
185
201
|
required_ruby_version: !ruby/object:Gem::Requirement
|
186
|
-
none: false
|
187
202
|
requirements:
|
188
|
-
- -
|
203
|
+
- - '>='
|
189
204
|
- !ruby/object:Gem::Version
|
190
205
|
version: '0'
|
191
|
-
segments:
|
192
|
-
- 0
|
193
|
-
hash: 1155994554511253811
|
194
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
|
-
none: false
|
196
207
|
requirements:
|
197
|
-
- -
|
208
|
+
- - '>='
|
198
209
|
- !ruby/object:Gem::Version
|
199
210
|
version: '0'
|
200
|
-
segments:
|
201
|
-
- 0
|
202
|
-
hash: 1155994554511253811
|
203
211
|
requirements: []
|
204
212
|
rubyforge_project:
|
205
|
-
rubygems_version:
|
213
|
+
rubygems_version: 2.0.14
|
206
214
|
signing_key:
|
207
|
-
specification_version:
|
215
|
+
specification_version: 4
|
208
216
|
summary: Generate Dockerfile for ruby/rails/sinatra.
|
209
217
|
test_files:
|
210
218
|
- spec/spec_helper.rb
|