system-builder 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/Manifest.txt +31 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +48 -0
- data/Rakefile +25 -0
- data/bin/system-builder +10 -0
- data/examples/Rakefile +20 -0
- data/examples/config.rb +28 -0
- data/examples/manifests/classes/test.pp +1 -0
- data/examples/manifests/site.pp +3 -0
- data/features/development.feature +13 -0
- data/features/step_definitions/common_steps.rb +163 -0
- data/features/support/common.rb +29 -0
- data/features/support/env.rb +14 -0
- data/features/support/matchers.rb +11 -0
- data/lib/system_builder.rb +24 -0
- data/lib/system_builder/boot.rb +221 -0
- data/lib/system_builder/cli.rb +35 -0
- data/lib/system_builder/configurator.rb +42 -0
- data/lib/system_builder/core_ext.rb +56 -0
- data/lib/system_builder/image.rb +118 -0
- data/lib/system_builder/task.rb +49 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/system-builder_cli_spec.rb +29 -0
- data/spec/system-builder_spec.rb +11 -0
- data/system-builder.gemspec +35 -0
- data/tasks/rspec.rake +21 -0
- metadata +98 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
PostInstall.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
bin/system-builder
|
7
|
+
examples/Rakefile
|
8
|
+
examples/config.rb
|
9
|
+
examples/manifests/classes/test.pp
|
10
|
+
examples/manifests/site.pp
|
11
|
+
features/development.feature
|
12
|
+
features/step_definitions/common_steps.rb
|
13
|
+
features/support/common.rb
|
14
|
+
features/support/env.rb
|
15
|
+
features/support/matchers.rb
|
16
|
+
lib/system_builder.rb
|
17
|
+
lib/system_builder/boot.rb
|
18
|
+
lib/system_builder/cli.rb
|
19
|
+
lib/system_builder/configurator.rb
|
20
|
+
lib/system_builder/core_ext.rb
|
21
|
+
lib/system_builder/image.rb
|
22
|
+
lib/system_builder/task.rb
|
23
|
+
script/console
|
24
|
+
script/destroy
|
25
|
+
script/generate
|
26
|
+
spec/spec.opts
|
27
|
+
spec/spec_helper.rb
|
28
|
+
spec/system-builder_cli_spec.rb
|
29
|
+
spec/system-builder_spec.rb
|
30
|
+
system-builder.gemspec
|
31
|
+
tasks/rspec.rake
|
data/PostInstall.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
= system-builder
|
2
|
+
|
3
|
+
* http://github.com/#{github_username}/#{project_name}
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
FIX (describe your package)
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* FIX (list of features or problems)
|
12
|
+
|
13
|
+
== SYNOPSIS:
|
14
|
+
|
15
|
+
FIX (code sample of usage)
|
16
|
+
|
17
|
+
== REQUIREMENTS:
|
18
|
+
|
19
|
+
* FIX (list of requirements)
|
20
|
+
|
21
|
+
== INSTALL:
|
22
|
+
|
23
|
+
* FIX (sudo gem install, anything else)
|
24
|
+
|
25
|
+
== LICENSE:
|
26
|
+
|
27
|
+
(The MIT License)
|
28
|
+
|
29
|
+
Copyright (c) 2009 Alban Peignier
|
30
|
+
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
32
|
+
a copy of this software and associated documentation files (the
|
33
|
+
'Software'), to deal in the Software without restriction, including
|
34
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
35
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
36
|
+
permit persons to whom the Software is furnished to do so, subject to
|
37
|
+
the following conditions:
|
38
|
+
|
39
|
+
The above copyright notice and this permission notice shall be
|
40
|
+
included in all copies or substantial portions of the Software.
|
41
|
+
|
42
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
43
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
44
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
45
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
46
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
47
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
48
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
require './lib/system_builder'
|
6
|
+
|
7
|
+
Hoe.plugin :newgem
|
8
|
+
# Hoe.plugin :website
|
9
|
+
Hoe.plugin :cucumberfeatures
|
10
|
+
|
11
|
+
# Generate all the Rake tasks
|
12
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
13
|
+
$hoe = Hoe.spec 'system-builder' do
|
14
|
+
self.version = SystemBuilder::VERSION
|
15
|
+
self.developer 'Alban Peignier', 'alban.peignier@free.fr'
|
16
|
+
self.rubyforge_name = self.name # TODO this is default value
|
17
|
+
# self.extra_deps = [['activesupport','>= 2.0.2']]
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'newgem/tasks'
|
21
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
22
|
+
|
23
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
24
|
+
# remove_task :default
|
25
|
+
# task :default => [:spec, :features]
|
data/bin/system-builder
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created by Alban Peignier on 2009-9-1.
|
4
|
+
# Copyright (c) 2009. All rights reserved.
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require File.expand_path(File.dirname(__FILE__) + "/../lib/system_builder")
|
8
|
+
require "system_builder/cli"
|
9
|
+
|
10
|
+
SystemBuilder::CLI.execute(STDOUT, ARGV)
|
data/examples/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'system_builder'
|
2
|
+
require 'system_builder/task'
|
3
|
+
|
4
|
+
def working_dir(name, type)
|
5
|
+
directory = "/var/tmp/system-builder/#{name}/#{type}"
|
6
|
+
mkdir_p directory
|
7
|
+
directory
|
8
|
+
end
|
9
|
+
|
10
|
+
SystemBuilder::Task.new(:simple_test) do
|
11
|
+
SystemBuilder::DiskImage.new(working_dir("simple_test", :disk)).tap do |image|
|
12
|
+
image.boot = SystemBuilder::DebianBoot.new(working_dir("simple_test", :boot)).tap do |boot|
|
13
|
+
boot.mirror = "http://127.0.0.1:9999/debian"
|
14
|
+
end
|
15
|
+
|
16
|
+
image.boot.configure do |chroot|
|
17
|
+
chroot.apt_install :sudo
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/examples/config.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
def working_dir(name, type)
|
2
|
+
directory = "/var/tmp/system-builder/#{name}/#{type}"
|
3
|
+
mkdir_p directory
|
4
|
+
directory
|
5
|
+
end
|
6
|
+
|
7
|
+
SystemBuilder.config(:simple_test) do
|
8
|
+
SystemBuilder::DiskImage.new(working_dir("simple_test", :disk)).tap do |image|
|
9
|
+
image.boot = SystemBuilder::DebianBoot.new(working_dir("simple_test", :boot)).tap do |boot|
|
10
|
+
boot.mirror = "http://127.0.0.1:9999/debian"
|
11
|
+
end
|
12
|
+
|
13
|
+
image.boot.configure do |chroot|
|
14
|
+
chroot.apt_install :sudo
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
SystemBuilder.config(:puppet_test) do
|
20
|
+
SystemBuilder::DiskImage.new(working_dir("puppet_test", :disk)).tap do |image|
|
21
|
+
image.boot = SystemBuilder::DebianBoot.new(working_dir("puppet_test", :boot)).tap do |boot|
|
22
|
+
boot.mirror = "http://127.0.0.1:9999/debian"
|
23
|
+
end
|
24
|
+
|
25
|
+
# use manifests/site.pp in this directory
|
26
|
+
image.boot.configurators << SystemBuilder::PuppetConfigurator.new(File.dirname(__FILE__))
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
notice("test")
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Development processes of newgem itself (rake tasks)
|
2
|
+
|
3
|
+
As a Newgem maintainer or contributor
|
4
|
+
I want rake tasks to maintain and release the gem
|
5
|
+
So that I can spend time on the tests and code, and not excessive time on maintenance processes
|
6
|
+
|
7
|
+
Scenario: Generate RubyGem
|
8
|
+
Given this project is active project folder
|
9
|
+
And "pkg" folder is deleted
|
10
|
+
When I invoke task "rake gem"
|
11
|
+
Then folder "pkg" is created
|
12
|
+
And file with name matching "pkg/*.gem" is created else you should run "rake manifest" to fix this
|
13
|
+
And gem spec key "rdoc_options" contains /--mainREADME.rdoc/
|
@@ -0,0 +1,163 @@
|
|
1
|
+
Given /^this project is active project folder/ do
|
2
|
+
@active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /^env variable \$([\w_]+) set to "(.*)"/ do |env_var, value|
|
6
|
+
ENV[env_var] = value
|
7
|
+
end
|
8
|
+
|
9
|
+
Given /"(.*)" folder is deleted/ do |folder|
|
10
|
+
in_project_folder { FileUtils.rm_rf folder }
|
11
|
+
end
|
12
|
+
|
13
|
+
When /^I invoke "(.*)" generator with arguments "(.*)"$/ do |generator, arguments|
|
14
|
+
@stdout = StringIO.new
|
15
|
+
in_project_folder do
|
16
|
+
if Object.const_defined?("APP_ROOT")
|
17
|
+
APP_ROOT.replace(FileUtils.pwd)
|
18
|
+
else
|
19
|
+
APP_ROOT = FileUtils.pwd
|
20
|
+
end
|
21
|
+
run_generator(generator, arguments.split(' '), SOURCES, :stdout => @stdout)
|
22
|
+
end
|
23
|
+
File.open(File.join(@tmp_root, "generator.out"), "w") do |f|
|
24
|
+
@stdout.rewind
|
25
|
+
f << @stdout.read
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
When /^I run executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
30
|
+
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
31
|
+
in_project_folder do
|
32
|
+
system "#{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
When /^I run project executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
37
|
+
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
38
|
+
in_project_folder do
|
39
|
+
system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
When /^I run local executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
44
|
+
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
45
|
+
executable = File.expand_path(File.join(File.dirname(__FILE__), "/../../bin", executable))
|
46
|
+
in_project_folder do
|
47
|
+
system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
When /^I invoke task "rake (.*)"/ do |task|
|
52
|
+
@stdout = File.expand_path(File.join(@tmp_root, "tests.out"))
|
53
|
+
in_project_folder do
|
54
|
+
system "rake #{task} --trace > #{@stdout} 2> #{@stdout}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
Then /^folder "(.*)" (is|is not) created/ do |folder, is|
|
59
|
+
in_project_folder do
|
60
|
+
File.exists?(folder).should(is == 'is' ? be_true : be_false)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
Then /^file "(.*)" (is|is not) created/ do |file, is|
|
65
|
+
in_project_folder do
|
66
|
+
File.exists?(file).should(is == 'is' ? be_true : be_false)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
Then /^file with name matching "(.*)" is created/ do |pattern|
|
71
|
+
in_project_folder do
|
72
|
+
Dir[pattern].should_not be_empty
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
Then /^file "(.*)" contents (does|does not) match \/(.*)\// do |file, does, regex|
|
77
|
+
in_project_folder do
|
78
|
+
actual_output = File.read(file)
|
79
|
+
(does == 'does') ?
|
80
|
+
actual_output.should(match(/#{regex}/)) :
|
81
|
+
actual_output.should_not(match(/#{regex}/))
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
Then /gem file "(.*)" and generated file "(.*)" should be the same/ do |gem_file, project_file|
|
86
|
+
File.exists?(gem_file).should be_true
|
87
|
+
File.exists?(project_file).should be_true
|
88
|
+
gem_file_contents = File.read(File.dirname(__FILE__) + "/../../#{gem_file}")
|
89
|
+
project_file_contents = File.read(File.join(@active_project_folder, project_file))
|
90
|
+
project_file_contents.should == gem_file_contents
|
91
|
+
end
|
92
|
+
|
93
|
+
Then /^(does|does not) invoke generator "(.*)"$/ do |does_invoke, generator|
|
94
|
+
actual_output = File.read(@stdout)
|
95
|
+
does_invoke == "does" ?
|
96
|
+
actual_output.should(match(/dependency\s+#{generator}/)) :
|
97
|
+
actual_output.should_not(match(/dependency\s+#{generator}/))
|
98
|
+
end
|
99
|
+
|
100
|
+
Then /help options "(.*)" and "(.*)" are displayed/ do |opt1, opt2|
|
101
|
+
actual_output = File.read(@stdout)
|
102
|
+
actual_output.should match(/#{opt1}/)
|
103
|
+
actual_output.should match(/#{opt2}/)
|
104
|
+
end
|
105
|
+
|
106
|
+
Then /^I should see$/ do |text|
|
107
|
+
actual_output = File.read(@stdout)
|
108
|
+
actual_output.should contain(text)
|
109
|
+
end
|
110
|
+
|
111
|
+
Then /^I should not see$/ do |text|
|
112
|
+
actual_output = File.read(@stdout)
|
113
|
+
actual_output.should_not contain(text)
|
114
|
+
end
|
115
|
+
|
116
|
+
Then /^I should see exactly$/ do |text|
|
117
|
+
actual_output = File.read(@stdout)
|
118
|
+
actual_output.should == text
|
119
|
+
end
|
120
|
+
|
121
|
+
Then /^I should see all (\d+) tests pass/ do |expected_test_count|
|
122
|
+
expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
|
123
|
+
actual_output = File.read(@stdout)
|
124
|
+
actual_output.should match(expected)
|
125
|
+
end
|
126
|
+
|
127
|
+
Then /^I should see all (\d+) examples pass/ do |expected_test_count|
|
128
|
+
expected = %r{^#{expected_test_count} examples?, 0 failures}
|
129
|
+
actual_output = File.read(@stdout)
|
130
|
+
actual_output.should match(expected)
|
131
|
+
end
|
132
|
+
|
133
|
+
Then /^yaml file "(.*)" contains (\{.*\})/ do |file, yaml|
|
134
|
+
in_project_folder do
|
135
|
+
yaml = eval yaml
|
136
|
+
YAML.load(File.read(file)).should == yaml
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
Then /^Rakefile can display tasks successfully/ do
|
141
|
+
@stdout = File.expand_path(File.join(@tmp_root, "rakefile.out"))
|
142
|
+
in_project_folder do
|
143
|
+
system "rake -T > #{@stdout} 2> #{@stdout}"
|
144
|
+
end
|
145
|
+
actual_output = File.read(@stdout)
|
146
|
+
actual_output.should match(/^rake\s+\w+\s+#\s.*/)
|
147
|
+
end
|
148
|
+
|
149
|
+
Then /^task "rake (.*)" is executed successfully/ do |task|
|
150
|
+
@stdout.should_not be_nil
|
151
|
+
actual_output = File.read(@stdout)
|
152
|
+
actual_output.should_not match(/^Don't know how to build task '#{task}'/)
|
153
|
+
actual_output.should_not match(/Error/i)
|
154
|
+
end
|
155
|
+
|
156
|
+
Then /^gem spec key "(.*)" contains \/(.*)\// do |key, regex|
|
157
|
+
in_project_folder do
|
158
|
+
gem_file = Dir["pkg/*.gem"].first
|
159
|
+
gem_spec = Gem::Specification.from_yaml(`gem spec #{gem_file}`)
|
160
|
+
spec_value = gem_spec.send(key.to_sym)
|
161
|
+
spec_value.to_s.should match(/#{regex}/)
|
162
|
+
end
|
163
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module CommonHelpers
|
2
|
+
def in_tmp_folder(&block)
|
3
|
+
FileUtils.chdir(@tmp_root, &block)
|
4
|
+
end
|
5
|
+
|
6
|
+
def in_project_folder(&block)
|
7
|
+
project_folder = @active_project_folder || @tmp_root
|
8
|
+
FileUtils.chdir(project_folder, &block)
|
9
|
+
end
|
10
|
+
|
11
|
+
def in_home_folder(&block)
|
12
|
+
FileUtils.chdir(@home_path, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def force_local_lib_override(project_name = @project_name)
|
16
|
+
rakefile = File.read(File.join(project_name, 'Rakefile'))
|
17
|
+
File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
|
18
|
+
f << "$:.unshift('#{@lib_path}')\n"
|
19
|
+
f << rakefile
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup_active_project_folder project_name
|
24
|
+
@active_project_folder = File.join(@tmp_root, project_name)
|
25
|
+
@project_name = project_name
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
World(CommonHelpers)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../../lib/system-builder"
|
2
|
+
|
3
|
+
gem 'cucumber'
|
4
|
+
require 'cucumber'
|
5
|
+
gem 'rspec'
|
6
|
+
require 'spec'
|
7
|
+
|
8
|
+
Before do
|
9
|
+
@tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
10
|
+
@home_path = File.expand_path(File.join(@tmp_root, "home"))
|
11
|
+
FileUtils.rm_rf @tmp_root
|
12
|
+
FileUtils.mkdir_p @home_path
|
13
|
+
ENV['HOME'] = @home_path
|
14
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Matchers
|
2
|
+
def contain(expected)
|
3
|
+
simple_matcher("contain #{expected.inspect}") do |given, matcher|
|
4
|
+
matcher.failure_message = "expected #{given.inspect} to contain #{expected.inspect}"
|
5
|
+
matcher.negative_failure_message = "expected #{given.inspect} not to contain #{expected.inspect}"
|
6
|
+
given.index expected
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
World(Matchers)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
|
4
|
+
module SystemBuilder
|
5
|
+
VERSION = '0.0.3'
|
6
|
+
|
7
|
+
@@configurations = {}
|
8
|
+
|
9
|
+
def self.config(name, value = nil, &block)
|
10
|
+
value = (value or block.call)
|
11
|
+
puts "* load configuration #{name}"
|
12
|
+
@@configurations[name.to_s] = value
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.configuration(name)
|
16
|
+
@@configurations[name.to_s]
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'system_builder/core_ext'
|
22
|
+
require 'system_builder/image'
|
23
|
+
require 'system_builder/boot'
|
24
|
+
require 'system_builder/configurator'
|
@@ -0,0 +1,221 @@
|
|
1
|
+
class SystemBuilder::DebianBoot
|
2
|
+
|
3
|
+
attr_accessor :version, :mirror, :architecture
|
4
|
+
attr_accessor :exclude, :include
|
5
|
+
|
6
|
+
attr_reader :root
|
7
|
+
attr_reader :configurators
|
8
|
+
|
9
|
+
@@default_mirror = 'http://ftp.debian.org/debian'
|
10
|
+
def self.default_mirror=(mirror)
|
11
|
+
@@default_mirror = mirror
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(root)
|
15
|
+
@root = root
|
16
|
+
|
17
|
+
@version = :lenny
|
18
|
+
@mirror = @@default_mirror
|
19
|
+
@architecture = :i386
|
20
|
+
@exclude = []
|
21
|
+
@include = []
|
22
|
+
|
23
|
+
# kernel can't be installed by debootstrap
|
24
|
+
@configurators =
|
25
|
+
[ localhost_configurator,
|
26
|
+
apt_configurator,
|
27
|
+
kernel_configurator,
|
28
|
+
fstab_configurator,
|
29
|
+
timezone_configurator ]
|
30
|
+
@cleaners = [ apt_cleaner ]
|
31
|
+
end
|
32
|
+
|
33
|
+
def create
|
34
|
+
bootstrap
|
35
|
+
configure
|
36
|
+
clean
|
37
|
+
end
|
38
|
+
|
39
|
+
def bootstrap
|
40
|
+
unless File.exists?(root)
|
41
|
+
FileUtils::mkdir_p root
|
42
|
+
FileUtils::sudo "debootstrap", debbootstrap_options, version, root, mirror
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def configure
|
47
|
+
unless @configurators.empty?
|
48
|
+
chroot do |chroot|
|
49
|
+
@configurators.each do |configurator|
|
50
|
+
configurator.configure(chroot)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def clean
|
57
|
+
unless @cleaners.empty?
|
58
|
+
chroot do |chroot|
|
59
|
+
@cleaners.each do |cleaner|
|
60
|
+
cleaner.call(chroot)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def kernel_configurator
|
67
|
+
SystemBuilder::ProcConfigurator.new do |chroot|
|
68
|
+
chroot.image.open("/etc/kernel-img.conf") do |f|
|
69
|
+
f.puts "do_initrd = yes"
|
70
|
+
end
|
71
|
+
chroot.apt_install %w{linux-image-2.6-686 grub}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def fstab_configurator
|
76
|
+
SystemBuilder::ProcConfigurator.new do |chroot|
|
77
|
+
chroot.image.open("/etc/fstab") do |f|
|
78
|
+
%w{/tmp /var/run /var/log /var/lock /var/tmp}.each do |directory|
|
79
|
+
f.puts "tmpfs #{directory} tmpfs defaults,noatime 0 0"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def timezone_configurator
|
86
|
+
SystemBuilder::ProcConfigurator.new do |chroot|
|
87
|
+
# Use same timezone than build machine
|
88
|
+
chroot.image.install "/etc/", "/etc/timezone", "/etc/localtime"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def apt_configurator
|
93
|
+
# TODO see if this step is really needed
|
94
|
+
SystemBuilder::ProcConfigurator.new do |chroot|
|
95
|
+
chroot.image.install "/etc/apt", "/etc/apt/trusted.gpg"
|
96
|
+
chroot.sudo "apt-get update"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def apt_cleaner
|
101
|
+
Proc.new do |chroot|
|
102
|
+
chroot.sudo "apt-get clean"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def localhost_configurator
|
107
|
+
SystemBuilder::ProcConfigurator.new do |chroot|
|
108
|
+
chroot.image.open("/etc/hosts") do |f|
|
109
|
+
f.puts "127.0.0.1 localhost"
|
110
|
+
f.puts "::1 localhost ip6-localhost ip6-loopback"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def configure(&block)
|
116
|
+
@configurators << SystemBuilder::ProcConfigurator.new(block)
|
117
|
+
end
|
118
|
+
|
119
|
+
def debbootstrap_options
|
120
|
+
{
|
121
|
+
:arch => architecture,
|
122
|
+
:exclude => exclude.join(','),
|
123
|
+
:include => include.join(','),
|
124
|
+
:variant => :minbase
|
125
|
+
}.collect do |k,v|
|
126
|
+
["--#{k}", Array(v).join(',')] unless v.blank?
|
127
|
+
end.compact
|
128
|
+
end
|
129
|
+
|
130
|
+
def image(&block)
|
131
|
+
@image ||= Image.new(root)
|
132
|
+
|
133
|
+
if block_given?
|
134
|
+
yield @image
|
135
|
+
else
|
136
|
+
@image
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def chroot(&block)
|
141
|
+
@chroot ||= Chroot.new(image)
|
142
|
+
@chroot.execute &block
|
143
|
+
end
|
144
|
+
|
145
|
+
class Image
|
146
|
+
|
147
|
+
def initialize(root)
|
148
|
+
@root = root
|
149
|
+
end
|
150
|
+
|
151
|
+
def mkdir(directory)
|
152
|
+
FileUtils::sudo "mkdir -p #{expand_path(directory)}"
|
153
|
+
end
|
154
|
+
|
155
|
+
def install(target, *sources)
|
156
|
+
FileUtils::sudo "cp --preserve=mode,timestamps #{sources.join(' ')} #{expand_path(target)}"
|
157
|
+
end
|
158
|
+
|
159
|
+
def rsync(target, *sources)
|
160
|
+
options = (Hash === sources.last ? sources.pop : {})
|
161
|
+
rsync_options = options.collect { |k,v| "--#{k}=#{v}" }
|
162
|
+
FileUtils::sudo "rsync -av #{rsync_options.join(' ')} #{sources.join(' ')} #{expand_path(target)}"
|
163
|
+
end
|
164
|
+
|
165
|
+
def open(filename, &block)
|
166
|
+
Tempfile.open(File.basename(filename)) do |f|
|
167
|
+
yield f
|
168
|
+
f.close
|
169
|
+
|
170
|
+
File.chmod 0644, f.path
|
171
|
+
install filename, f.path
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def expand_path(path)
|
176
|
+
File.join(@root,path)
|
177
|
+
end
|
178
|
+
|
179
|
+
end
|
180
|
+
|
181
|
+
class Chroot
|
182
|
+
|
183
|
+
attr_reader :image
|
184
|
+
|
185
|
+
def initialize(image)
|
186
|
+
@image = image
|
187
|
+
end
|
188
|
+
|
189
|
+
def apt_install(*packages)
|
190
|
+
sudo "apt-get install --yes --force-yes #{packages.join(' ')}"
|
191
|
+
end
|
192
|
+
|
193
|
+
def cp(*arguments)
|
194
|
+
sudo "cp #{arguments.join(' ')}"
|
195
|
+
end
|
196
|
+
|
197
|
+
def sh(*arguments)
|
198
|
+
FileUtils::sudo "chroot #{image.expand_path('/')} sh -c \"LC_ALL=C #{arguments.join(' ')}\""
|
199
|
+
end
|
200
|
+
alias_method :sudo, :sh
|
201
|
+
|
202
|
+
def execute(&block)
|
203
|
+
begin
|
204
|
+
prepare_run
|
205
|
+
yield self
|
206
|
+
ensure
|
207
|
+
unprepare_run
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def prepare_run
|
212
|
+
FileUtils::sudo "mount proc #{image.expand_path('/proc')} -t proc"
|
213
|
+
end
|
214
|
+
|
215
|
+
def unprepare_run
|
216
|
+
FileUtils::sudo "umount #{image.expand_path('/proc')}"
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module SystemBuilder
|
4
|
+
class CLI
|
5
|
+
def self.execute(stdout, arguments=[])
|
6
|
+
options = {}
|
7
|
+
mandatory_options = %w(config)
|
8
|
+
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = <<-BANNER.gsub(/^ /,'')
|
11
|
+
Create and configure bootable systems
|
12
|
+
|
13
|
+
Usage: #{File.basename($0)} [options] image command
|
14
|
+
|
15
|
+
Options are:
|
16
|
+
BANNER
|
17
|
+
opts.separator ""
|
18
|
+
opts.on("-c", "--config=FILE", String,
|
19
|
+
"The file containing image and boot definitions") { |arg| options[:config] = arg }
|
20
|
+
opts.on("-h", "--help", "Show this help message.") { stdout.puts opts; exit }
|
21
|
+
|
22
|
+
opts.parse!(arguments)
|
23
|
+
|
24
|
+
if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
|
25
|
+
stdout.puts opts; exit
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
load options[:config]
|
30
|
+
|
31
|
+
image = SystemBuilder.configuration(arguments.unshift)
|
32
|
+
image.create
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module SystemBuilder
|
2
|
+
|
3
|
+
class ProcConfigurator
|
4
|
+
|
5
|
+
def initialize(proc = nil, &block)
|
6
|
+
@proc = (proc or block)
|
7
|
+
end
|
8
|
+
|
9
|
+
def configure(chroot)
|
10
|
+
@proc.call chroot
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
class PuppetConfigurator
|
16
|
+
|
17
|
+
attr_reader :manifest
|
18
|
+
|
19
|
+
def initialize(manifest = ".")
|
20
|
+
@manifest = manifest
|
21
|
+
end
|
22
|
+
|
23
|
+
def configure(chroot)
|
24
|
+
chroot.apt_install :puppet
|
25
|
+
chroot.image.open("/etc/default/puppet") do |f|
|
26
|
+
f.puts "START=no"
|
27
|
+
end
|
28
|
+
|
29
|
+
unless File.directory?(manifest)
|
30
|
+
chroot.image.install "/tmp/puppet.pp", manifest
|
31
|
+
chroot.sudo "puppet tmp/puppet.pp"
|
32
|
+
else
|
33
|
+
chroot.image.mkdir "/tmp/puppet"
|
34
|
+
|
35
|
+
chroot.image.rsync "/tmp/puppet", "#{manifest}/manifests", "#{manifest}/files", :exclude => "*~"
|
36
|
+
chroot.sudo "puppet tmp/puppet/manifests/site.pp"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class Numeric
|
2
|
+
|
3
|
+
def megabytes
|
4
|
+
self * 1024 * 1024
|
5
|
+
end
|
6
|
+
alias_method :megabyte, :megabytes
|
7
|
+
|
8
|
+
def in_megabytes
|
9
|
+
self.to_f / 1.megabyte
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
class Object
|
15
|
+
|
16
|
+
def blank?
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
class NilClass
|
23
|
+
|
24
|
+
def blank?
|
25
|
+
true
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
class Array
|
31
|
+
|
32
|
+
alias_method :blank?, :empty?
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
class String
|
37
|
+
|
38
|
+
alias_method :blank?, :empty?
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
module FileUtils
|
43
|
+
|
44
|
+
def sh(*cmd)
|
45
|
+
options = Hash === cmd.last ? cmd.pop : {}
|
46
|
+
puts "* #{cmd.join(' ')}"
|
47
|
+
raise "Command failed: #{$?}" unless system(cmd.join(' '))
|
48
|
+
end
|
49
|
+
module_function :sh
|
50
|
+
|
51
|
+
def sudo(*cmd)
|
52
|
+
sh ["sudo", *cmd]
|
53
|
+
end
|
54
|
+
module_function :sudo
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
3
|
+
class SystemBuilder::DiskImage
|
4
|
+
|
5
|
+
attr_accessor :boot, :size
|
6
|
+
attr_reader :file
|
7
|
+
|
8
|
+
def initialize(file)
|
9
|
+
@file = file
|
10
|
+
@size = 512.megabytes
|
11
|
+
end
|
12
|
+
|
13
|
+
def create
|
14
|
+
boot.create
|
15
|
+
# TODO
|
16
|
+
|
17
|
+
file_creation = (not File.exists?(file))
|
18
|
+
if file_creation
|
19
|
+
create_file
|
20
|
+
create_partition_table
|
21
|
+
format_root_fs
|
22
|
+
end
|
23
|
+
|
24
|
+
install_grub_files :stage_files => %w{e2fs_stage1_5 stage?}
|
25
|
+
|
26
|
+
sync_root_fs
|
27
|
+
install_grub if file_creation
|
28
|
+
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_file
|
33
|
+
FileUtils::sh "dd if=/dev/zero of=#{file} count=#{size.in_megabytes.to_i} bs=1M"
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_partition_table
|
37
|
+
FileUtils::sh "echo '63,' | /sbin/sfdisk --no-reread -uS -H16 -S63 #{file}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def format_root_fs
|
41
|
+
loop_device = "/dev/loop0"
|
42
|
+
begin
|
43
|
+
FileUtils::sudo "losetup -o #{fs_offset} #{loop_device} #{file}"
|
44
|
+
FileUtils::sudo "mke2fs -L #{fs_label} -jqF #{loop_device} #{fs_block_size}"
|
45
|
+
ensure
|
46
|
+
FileUtils::sudo "losetup -d #{loop_device}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def sync_root_fs
|
51
|
+
mount_dir = "/tmp/mount_root_fs"
|
52
|
+
FileUtils::mkdir_p mount_dir
|
53
|
+
|
54
|
+
begin
|
55
|
+
FileUtils::sudo "mount -o loop,offset=#{fs_offset} #{file} #{mount_dir}"
|
56
|
+
FileUtils::sudo "rsync -av --delete #{boot.root}/ #{mount_dir}"
|
57
|
+
ensure
|
58
|
+
FileUtils::sudo "umount #{mount_dir}"
|
59
|
+
end
|
60
|
+
|
61
|
+
FileUtils.touch file
|
62
|
+
end
|
63
|
+
|
64
|
+
def install_grub_files(options = {})
|
65
|
+
stage_files = Array(options[:stage_files]).flatten
|
66
|
+
|
67
|
+
boot.image do |image|
|
68
|
+
image.mkdir "/boot/grub"
|
69
|
+
|
70
|
+
install_grub_menu options
|
71
|
+
image.install "boot/grub", stage_files.collect { |f| '/usr/lib/grub/**/' + f }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def install_grub
|
76
|
+
IO.popen("sudo grub --device-map=/dev/null","w") { |grub|
|
77
|
+
grub.puts "device (hd0) #{file}"
|
78
|
+
grub.puts "root (hd0,0)"
|
79
|
+
grub.puts "setup (hd0)"
|
80
|
+
grub.puts "quit"
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
def install_grub_menu(options = {})
|
85
|
+
root = (options[:root] or "LABEL=#{fs_label}")
|
86
|
+
version = (options[:version] or Time.now.strftime("%Y%m%d%H%M"))
|
87
|
+
|
88
|
+
boot.image.open("/boot/grub/menu.lst") do |f|
|
89
|
+
f.puts "default 0"
|
90
|
+
f.puts "timeout 2"
|
91
|
+
f.puts "title #{version} Debian GNU/Linux"
|
92
|
+
f.puts "kernel /vmlinuz root=#{root} ro"
|
93
|
+
f.puts "initrd /initrd.img"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def convert(export_file, options = {})
|
98
|
+
unless FileUtils.uptodate? export_file, file
|
99
|
+
arguments = []
|
100
|
+
arguments << "-O #{options[:format]}" if options[:format]
|
101
|
+
FileUtils::sh "qemu-img convert -f raw #{file} #{arguments.join(' ')} #{export_file}"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def fs_block_size
|
106
|
+
linux_partition_info = `/sbin/sfdisk -l #{file}`.scan(%r{#{file}.*Linux}).first
|
107
|
+
linux_partition_info.split[4].to_i
|
108
|
+
end
|
109
|
+
|
110
|
+
def fs_offset
|
111
|
+
32256
|
112
|
+
end
|
113
|
+
|
114
|
+
def fs_label
|
115
|
+
"root"
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rake/tasklib'
|
2
|
+
|
3
|
+
class SystemBuilder::Task < Rake::TaskLib
|
4
|
+
|
5
|
+
attr_reader :name
|
6
|
+
|
7
|
+
def initialize(name, &block)
|
8
|
+
@name = name
|
9
|
+
|
10
|
+
@image =
|
11
|
+
if block_given?
|
12
|
+
block.call
|
13
|
+
else
|
14
|
+
SystemBuilder.config(name)
|
15
|
+
end
|
16
|
+
|
17
|
+
define
|
18
|
+
end
|
19
|
+
|
20
|
+
def define
|
21
|
+
namespace name do
|
22
|
+
desc "Create image #{name} in #{@image.file}"
|
23
|
+
task :dist do
|
24
|
+
@image.create
|
25
|
+
end
|
26
|
+
namespace :dist do
|
27
|
+
desc "Create vmwaire image in #{@image.file}.vdmk"
|
28
|
+
task :vmware do
|
29
|
+
@image.convert "#{@image.file}.vmdk", :format => "vmdk"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
task "dist:vmware" => "dist"
|
33
|
+
|
34
|
+
task :setup do
|
35
|
+
required_packages = []
|
36
|
+
required_packages << "qemu" # to convert image files
|
37
|
+
required_packages << "util-linux" # provides sfdisk
|
38
|
+
required_packages << "sudo"
|
39
|
+
required_packages << "debootstrap"
|
40
|
+
required_packages << "rsync"
|
41
|
+
# installing grub isn't a good idea
|
42
|
+
# required_packages << "grub"
|
43
|
+
|
44
|
+
FileUtils.sudo "apt-get install #{required_packages.join(' ')}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/system-builder.rb'}"
|
9
|
+
puts "Loading system-builder gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'system_builder/cli'
|
3
|
+
|
4
|
+
describe SystemBuilder::CLI, "execute" do
|
5
|
+
|
6
|
+
class ExitException < Exception; end;
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
SystemBuilder::CLI.stub!(:exit).and_raise(ExitException)
|
10
|
+
end
|
11
|
+
|
12
|
+
def system_builder(*arguments)
|
13
|
+
@stdout_io = StringIO.new
|
14
|
+
|
15
|
+
begin
|
16
|
+
SystemBuilder::CLI.execute(@stdout_io, arguments.flatten)
|
17
|
+
rescue ExitException
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
@stdout_io.rewind
|
22
|
+
@stdout = @stdout_io.read
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should print default output" do
|
26
|
+
system_builder "--help"
|
27
|
+
@stdout.should =~ /Usage: .* \[options\] image command/
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{system-builder}
|
5
|
+
s.version = "0.0.2"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Alban Peignier"]
|
9
|
+
s.date = %q{2009-09-02}
|
10
|
+
s.default_executable = %q{system-builder}
|
11
|
+
s.description = %q{FIX (describe your package)}
|
12
|
+
s.email = ["alban.peignier@free.fr"]
|
13
|
+
s.executables = ["system-builder"]
|
14
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt"]
|
15
|
+
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/system-builder", "examples/Rakefile", "examples/config.rb", "examples/manifests/classes/test.pp", "examples/manifests/site.pp", "features/development.feature", "features/step_definitions/common_steps.rb", "features/support/common.rb", "features/support/env.rb", "features/support/matchers.rb", "lib/system_builder.rb", "lib/system_builder/boot.rb", "lib/system_builder/cli.rb", "lib/system_builder/configurator.rb", "lib/system_builder/core_ext.rb", "lib/system_builder/image.rb", "lib/system_builder/task.rb", "script/console", "script/destroy", "script/generate", "spec/spec.opts", "spec/spec_helper.rb", "spec/system-builder_cli_spec.rb", "spec/system-builder_spec.rb", "system-builder.gemspec", "tasks/rspec.rake"]
|
16
|
+
s.homepage = %q{http://github.com/#{github_username}/#{project_name}}
|
17
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubyforge_project = %q{system-builder}
|
20
|
+
s.rubygems_version = %q{1.3.4}
|
21
|
+
s.summary = %q{FIX (describe your package)}
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 3
|
26
|
+
|
27
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
+
s.add_development_dependency(%q<hoe>, [">= 2.3.3"])
|
29
|
+
else
|
30
|
+
s.add_dependency(%q<hoe>, [">= 2.3.3"])
|
31
|
+
end
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<hoe>, [">= 2.3.3"])
|
34
|
+
end
|
35
|
+
end
|
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
5
|
+
require 'spec'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
rescue LoadError
|
10
|
+
puts <<-EOS
|
11
|
+
To use rspec for testing you must install rspec gem:
|
12
|
+
gem install rspec
|
13
|
+
EOS
|
14
|
+
exit(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run the specs under spec/models"
|
18
|
+
Spec::Rake::SpecTask.new do |t|
|
19
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: system-builder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alban Peignier
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-02 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hoe
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.3.3
|
24
|
+
version:
|
25
|
+
description: FIX (describe your package)
|
26
|
+
email:
|
27
|
+
- alban.peignier@free.fr
|
28
|
+
executables:
|
29
|
+
- system-builder
|
30
|
+
extensions: []
|
31
|
+
|
32
|
+
extra_rdoc_files:
|
33
|
+
- History.txt
|
34
|
+
- Manifest.txt
|
35
|
+
- PostInstall.txt
|
36
|
+
files:
|
37
|
+
- History.txt
|
38
|
+
- Manifest.txt
|
39
|
+
- PostInstall.txt
|
40
|
+
- README.rdoc
|
41
|
+
- Rakefile
|
42
|
+
- bin/system-builder
|
43
|
+
- examples/Rakefile
|
44
|
+
- examples/config.rb
|
45
|
+
- examples/manifests/classes/test.pp
|
46
|
+
- examples/manifests/site.pp
|
47
|
+
- features/development.feature
|
48
|
+
- features/step_definitions/common_steps.rb
|
49
|
+
- features/support/common.rb
|
50
|
+
- features/support/env.rb
|
51
|
+
- features/support/matchers.rb
|
52
|
+
- lib/system_builder.rb
|
53
|
+
- lib/system_builder/boot.rb
|
54
|
+
- lib/system_builder/cli.rb
|
55
|
+
- lib/system_builder/configurator.rb
|
56
|
+
- lib/system_builder/core_ext.rb
|
57
|
+
- lib/system_builder/image.rb
|
58
|
+
- lib/system_builder/task.rb
|
59
|
+
- script/console
|
60
|
+
- script/destroy
|
61
|
+
- script/generate
|
62
|
+
- spec/spec.opts
|
63
|
+
- spec/spec_helper.rb
|
64
|
+
- spec/system-builder_cli_spec.rb
|
65
|
+
- spec/system-builder_spec.rb
|
66
|
+
- system-builder.gemspec
|
67
|
+
- tasks/rspec.rake
|
68
|
+
has_rdoc: true
|
69
|
+
homepage: http://github.com/#{github_username}/#{project_name}
|
70
|
+
licenses: []
|
71
|
+
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options:
|
74
|
+
- --main
|
75
|
+
- README.rdoc
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: "0"
|
83
|
+
version:
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: "0"
|
89
|
+
version:
|
90
|
+
requirements: []
|
91
|
+
|
92
|
+
rubyforge_project: system-builder
|
93
|
+
rubygems_version: 1.3.5
|
94
|
+
signing_key:
|
95
|
+
specification_version: 3
|
96
|
+
summary: FIX (describe your package)
|
97
|
+
test_files: []
|
98
|
+
|