dock0 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: 77e31bedaa3cdf7f2f0b6a1d9f3b2a616507c3e8
4
+ data.tar.gz: 4aa1571f764516df89d8ecef220b194c0ecad8d5
5
+ SHA512:
6
+ metadata.gz: 490523b79088c2c192cfd060f8bebfd8f63de4f23c390f2604b8a42aa557195e05348554ca461fb9da38ac41d503f1150bd5ad67ea7fecf9f3345ff192edf1ab
7
+ data.tar.gz: 88b2b55fd8e9ae34af1ebca922cfcbc1a73b8250833daf352171830de2c22c1206980581398513f1790cd97242e1b3d98e7428d858d1f451304c8d63194c3478
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ pkg/*.gem
2
+ coverage/
3
+ .coveralls.yml
4
+ .bundle
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format Fuubar
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ Encoding:
2
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ cache: bundler
3
+ rvm:
4
+ - 2.1.0
5
+ - 2.0.0
6
+ - 1.9.3
7
+ notifications:
8
+ email: false
9
+ irc:
10
+ channels:
11
+ - ircs://irc.oftc.net:6697#akerl
12
+ channel_key: sekrit
13
+ template:
14
+ - '%{repository}/%{branch}/%{build_number}: %{message} -- %{build_url}'
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
data/Gemfile.lock ADDED
@@ -0,0 +1,34 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dock0 (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (1.1.0)
10
+ hashr (0.0.22)
11
+ json (1.8.1)
12
+ parser (2.1.4)
13
+ ast (~> 1.1)
14
+ slop (~> 3.4, >= 3.4.5)
15
+ powerpack (0.0.9)
16
+ rainbow (1.99.2)
17
+ rake (10.1.1)
18
+ rubocop (0.17.0)
19
+ json (~> 1.8)
20
+ parser (~> 2.1.3)
21
+ powerpack (~> 0.0.6)
22
+ rainbow (~> 1.99.1)
23
+ slop (3.4.7)
24
+ travis-lint (1.7.0)
25
+ hashr (~> 0.0.22)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ dock0!
32
+ rake
33
+ rubocop
34
+ travis-lint
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Les Aker
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
13
+ all 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
21
+ THE SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ dock0
2
+ =========
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/dock0.png)](http://badge.fury.io/rb/dock0)
5
+ [![Dependency Status](https://gemnasium.com/akerl/dock0.png)](https://gemnasium.com/akerl/dock0)
6
+ [![Code Climate](https://codeclimate.com/github/akerl/dock0.png)](https://codeclimate.com/github/akerl/dock0)
7
+ [![Coverage Status](https://coveralls.io/repos/akerl/dock0/badge.png?branch=master)](https://coveralls.io/r/akerl/dock0?branch=master)
8
+ [![Build Status](https://travis-ci.org/akerl/dock0.png?branch=master)](https://travis-ci.org/akerl/dock0)
9
+
10
+ Dynamic Arch image generator for building a read-only host system for [Docker](https://www.docker.io)
11
+
12
+ ## Usage
13
+
14
+ Informative words will be here one day.
15
+
16
+ ## Installation
17
+
18
+ gem install dock0
19
+
20
+ ## License
21
+
22
+ dock0 is released under the MIT License. See the bundled LICENSE file for details.
23
+
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ desc 'Update bundle'
6
+ task :bundle do
7
+ `bundle update`
8
+ end
9
+
10
+ desc 'Run tests'
11
+ RSpec::Core::RakeTask.new(:spec)
12
+
13
+ desc 'Run Rubocop on the gem'
14
+ Rubocop::RakeTask.new(:rubocop) do |task|
15
+ task.patterns = ['lib/**/*.rb', 'spec/*.rb', 'spec/helpers/*.rb', 'bin/*']
16
+ task.fail_on_error = true
17
+ end
18
+
19
+ desc 'Run travis-lint on .travis.yml'
20
+ task :travislint do
21
+ print 'There is an issue with your .travis.yml' unless system('travis-lint')
22
+ end
23
+
24
+ task default: [:spec, :travislint, :rubocop, :build]
25
+ task release: [:bundle]
data/bin/dock0 ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'dock0'
4
+
5
+ Dir.chdir File.dirname(ARGV.first)
6
+ Dock0.new(ARGV).easy_mode
7
+
8
+ puts 'All done!'
data/dock0.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'dock0'
3
+ s.version = '0.0.1'
4
+ s.date = Time.now.strftime("%Y-%m-%d")
5
+
6
+ s.summary = 'Builds a read-only Arch host for Docker'
7
+ s.description = "Generates a read-only Arch host for running Docker containers"
8
+ s.authors = ['Les Aker']
9
+ s.email = 'me@lesaker.org'
10
+ s.homepage = 'https://github.com/aker/dock0'
11
+ s.license = 'MIT'
12
+
13
+ s.files = `git ls-files`.split
14
+ s.test_files = `git ls-files spec/*`.split
15
+ s.executables = ['dock0']
16
+
17
+ s.add_development_dependency 'rubocop'
18
+ s.add_development_dependency 'travis-lint'
19
+ s.add_development_dependency 'rake'
20
+ end
data/lib/dock0.rb ADDED
@@ -0,0 +1,72 @@
1
+ require 'yaml'
2
+ require 'fileutils'
3
+
4
+ ##
5
+ # Dock0 provides an interface for building Arch images
6
+
7
+ module Dock0
8
+ class << self
9
+ ##
10
+ # Insert a helper .new() method for creating a new Dock0 object
11
+
12
+ def new(*args)
13
+ Dock0::Image.new(*args)
14
+ end
15
+ end
16
+
17
+ ##
18
+ # An Image is an Arch system being built
19
+
20
+ class Image
21
+ attr_reader :device_path, :config
22
+
23
+ ##
24
+ # Make a new Image object with the given config
25
+
26
+ def initialize(*configs)
27
+ @config = configs.each_with_object({}) do |path, obj|
28
+ obj.merge! YAML.load(File.read(path))
29
+ end
30
+ end
31
+
32
+ def prepare_device
33
+ `mkfs.ext2 #{@config['paths']['device']}`
34
+ `mount #{@config['paths']['device']} #{@config['paths']['mount']}`
35
+ end
36
+
37
+ def install_packages
38
+ File.read(@config['paths']['package_list']).split("\n").each do |package|
39
+ `pacstrap -G -M #{@config['paths']['mount']} #{package}`
40
+ end
41
+ end
42
+
43
+ def apply_overlay
44
+ overlay_path = @config['paths']['overlay'] + '/.'
45
+ FileUtils.cp_r overlay_path, @config['paths']['mount']
46
+ end
47
+
48
+ def run_scripts
49
+ Dir.glob(@config['paths']['scripts'] + '/*.rb').each do |script|
50
+ load script
51
+ end
52
+ end
53
+
54
+ def run_commands
55
+ cmds = @config['commands']
56
+ cmds.fetch('chroot', []).each do |cmd|
57
+ `arch_chroot #{@config['path']['mount']} #{cmd}`
58
+ end
59
+ cmds.fetch('host', []).each do |cmd|
60
+ `#{cmd}`
61
+ end
62
+ end
63
+
64
+ def easy_mode
65
+ prepare_device
66
+ install_packages
67
+ apply_overlay
68
+ run_scripts
69
+ run_commands
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dock0 do
4
+ it "doesn't have tests yet" do
5
+ expect(1).to eql 1
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
5
+ SimpleCov.start do
6
+ add_filter '/spec/'
7
+ end
8
+
9
+ require 'rspec'
10
+ require 'dock0'
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dock0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Les Aker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: travis-lint
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Generates a read-only Arch host for running Docker containers
56
+ email: me@lesaker.org
57
+ executables:
58
+ - dock0
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".rubocop.yml"
65
+ - ".travis.yml"
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - LICENSE
69
+ - README.md
70
+ - Rakefile
71
+ - bin/dock0
72
+ - dock0.gemspec
73
+ - lib/dock0.rb
74
+ - spec/dock0_spec.rb
75
+ - spec/spec_helper.rb
76
+ homepage: https://github.com/aker/dock0
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.0.14
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Builds a read-only Arch host for Docker
100
+ test_files:
101
+ - spec/dock0_spec.rb
102
+ - spec/spec_helper.rb