pi_customizer 0.3.0.pre.alpha → 0.3.1.pre.alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +24 -0
- data/.travis.yml +28 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/LICENSE +1 -1
- data/README.md +208 -2
- data/Rakefile +134 -6
- data/Vagrantfile +13 -2
- data/docs/concept.md +27 -0
- data/docs/incubation.md +38 -0
- data/pi_build_modifier/.gitignore +12 -0
- data/{.rspec → pi_build_modifier/.rspec} +0 -0
- data/pi_build_modifier/Gemfile +6 -0
- data/pi_build_modifier/LICENSE.txt +21 -0
- data/pi_build_modifier/README.md +3 -0
- data/pi_build_modifier/Rakefile +13 -0
- data/pi_build_modifier/bin/pi_build_modifier +25 -0
- data/pi_build_modifier/lib/pi_build_modifier.rb +53 -0
- data/pi_build_modifier/lib/pi_build_modifier/boot-files/boot.rb +64 -0
- data/pi_build_modifier/lib/pi_build_modifier/boot-files/templates/07-resize-init.diff.erb +5 -0
- data/pi_build_modifier/lib/pi_build_modifier/config/logex.rb +25 -0
- data/pi_build_modifier/lib/pi_build_modifier/locale/locale_debconf.rb +66 -0
- data/pi_build_modifier/lib/pi_build_modifier/locale/templates/00-debconf.erb +6 -0
- data/pi_build_modifier/lib/pi_build_modifier/modifier/erb_mapper.rb +72 -0
- data/pi_build_modifier/lib/pi_build_modifier/modifier/mapper.rb +49 -0
- data/pi_build_modifier/lib/pi_build_modifier/modifier/pi_modifier.rb +81 -0
- data/pi_build_modifier/lib/pi_build_modifier/modifier_task.rb +79 -0
- data/pi_build_modifier/lib/pi_build_modifier/net-tweaks/templates/wpa_supplicant.conf.erb +5 -0
- data/pi_build_modifier/lib/pi_build_modifier/net-tweaks/wifi_network.rb +124 -0
- data/pi_build_modifier/lib/pi_build_modifier/sys_tweaks/run_modifier.rb +63 -0
- data/pi_build_modifier/lib/pi_build_modifier/sys_tweaks/ssh.rb +61 -0
- data/pi_build_modifier/lib/pi_build_modifier/sys_tweaks/templates/ssh.sh.erb +8 -0
- data/pi_build_modifier/lib/pi_build_modifier/system/system_type.rb +84 -0
- data/pi_build_modifier/lib/pi_build_modifier/version.rb +23 -0
- data/pi_build_modifier/pi_build_modifier.gemspec +32 -0
- data/pi_build_modifier/spec/fixtures/config.json +26 -0
- data/pi_build_modifier/spec/pi_build_modifier/boot/boot_spec.rb +103 -0
- data/pi_build_modifier/spec/pi_build_modifier/locale/locale_spec.rb +87 -0
- data/pi_build_modifier/spec/pi_build_modifier/modifier/mapper_spec.rb +105 -0
- data/pi_build_modifier/spec/pi_build_modifier/modifier/modifier_spec.rb +83 -0
- data/pi_build_modifier/spec/pi_build_modifier/modifier_task_spec.rb +63 -0
- data/pi_build_modifier/spec/pi_build_modifier/net-tweaks/wifi_network_spec.rb +91 -0
- data/pi_build_modifier/spec/pi_build_modifier/sys_tweaks/run_modifier_spec.rb +74 -0
- data/pi_build_modifier/spec/pi_build_modifier/sys_tweaks/ssh_spec.rb +73 -0
- data/pi_build_modifier/spec/pi_build_modifier/system/system_spec.rb +66 -0
- data/pi_build_modifier/spec/pi_build_modifier_spec.rb +73 -0
- data/pi_build_modifier/spec/spec_helper.rb +10 -0
- data/pi_customizer/.rspec +2 -0
- data/{Gemfile → pi_customizer/Gemfile} +0 -0
- data/pi_customizer/LICENSE +21 -0
- data/pi_customizer/README.md +3 -0
- data/pi_customizer/Rakefile +13 -0
- data/pi_customizer/Vagrantfile +16 -0
- data/{bin → pi_customizer/bin}/pi_customizer +1 -1
- data/{envs → pi_customizer/envs}/aws/outputs.tf +0 -0
- data/{envs → pi_customizer/envs}/aws/pi-build-env.tf +0 -0
- data/{envs → pi_customizer/envs}/aws/variables.tf +0 -0
- data/{envs → pi_customizer/envs}/docker/Dockerfile +0 -0
- data/{envs → pi_customizer/envs}/sh/build-pi-img.sh +0 -0
- data/{lib → pi_customizer/lib}/pi_customizer.rb +7 -6
- data/{lib → pi_customizer/lib}/pi_customizer/build/builder/build_executor.rb +31 -2
- data/{lib → pi_customizer/lib}/pi_customizer/build/builder/builder.rb +4 -2
- data/{lib → pi_customizer/lib}/pi_customizer/build/builder/prepare_start_execute_builder.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/builder/start_prepare_execute_builder.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/aws/aws.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/docker/docker.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/environment.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/environment_builder_factory.rb +9 -3
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/vagrant/templates/Vagrantfile.erb +3 -7
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/vagrant/vagrant.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/vagrant/vagrant_file.rb +2 -2
- data/{lib → pi_customizer/lib}/pi_customizer/build/workspace/local_workspace.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/workspace/remote_workspace.rb +14 -4
- data/{lib → pi_customizer/lib}/pi_customizer/utils/logex.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/version.rb +2 -2
- data/{lib → pi_customizer/lib}/pi_customizer/write/image_writer.rb +1 -1
- data/{pi_customizer.gemspec → pi_customizer/pi_customizer.gemspec} +5 -5
- data/pi_customizer/spec/fixtures/TestVagrantfile +61 -0
- data/pi_customizer/spec/fixtures/image.img +1 -0
- data/pi_customizer/spec/fixtures/image.zip +0 -0
- data/pi_customizer/spec/pi_customizer/builder/build_executor_spec.rb +64 -0
- data/pi_customizer/spec/pi_customizer/environment/aws_spec.rb +57 -0
- data/pi_customizer/spec/pi_customizer/environment/environment_builder_factory_spec.rb +48 -0
- data/pi_customizer/spec/pi_customizer/environment/environment_spec.rb +75 -0
- data/pi_customizer/spec/pi_customizer/environment/vagrant/vagrant_file_spec.rb +63 -0
- data/pi_customizer/spec/pi_customizer/environment/vagrant/vagrant_spec.rb +41 -0
- data/pi_customizer/spec/pi_customizer/version_spec.rb +29 -0
- data/pi_customizer/spec/pi_customizer/workspace/local_workspace_spec.rb +74 -0
- data/pi_customizer/spec/pi_customizer/workspace/remote_workspace_spec.rb +51 -0
- data/pi_customizer/spec/pi_customizer/write/image_writer_spec.rb +59 -0
- data/pi_customizer/spec/pi_customizer_spec.rb +93 -0
- data/pi_customizer/spec/spec_helper.rb +10 -0
- data/version.rb +21 -0
- metadata +102 -41
@@ -0,0 +1,73 @@
|
|
1
|
+
# Copyright (c) 2017-2019 Beate Ottenwälder
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
require_relative 'spec_helper'
|
22
|
+
require 'pi_build_modifier'
|
23
|
+
require 'pi_build_modifier/version'
|
24
|
+
require 'pi_build_modifier/modifier_task'
|
25
|
+
|
26
|
+
RSpec.describe PiBuildModifier do
|
27
|
+
it 'has a version number' do
|
28
|
+
expect(PiBuildModifier::VERSION).not_to be nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
RSpec.describe PiBuildModifier::PiBuildModifier do
|
33
|
+
|
34
|
+
it 'informs about valid commands when called with no arguments' do
|
35
|
+
expect {PiBuildModifier::PiBuildModifier.start([])}.to output(/Commands/).to_stdout
|
36
|
+
end
|
37
|
+
|
38
|
+
context '#version' do
|
39
|
+
it 'informs about the current version' do
|
40
|
+
expect {PiBuildModifier::PiBuildModifier.start(%w(version))}.to output(/#{PiBuildModifier::VERSION}/).to_stdout
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context '#modify' do
|
45
|
+
|
46
|
+
let(:tmp_json_config) {'tmp_config.json'}
|
47
|
+
let(:tmp_workspace) {'tmp_space'}
|
48
|
+
|
49
|
+
before do
|
50
|
+
File.open(tmp_json_config, 'w') {|file| file.write('{}')}
|
51
|
+
FileUtils.mkdir_p tmp_workspace
|
52
|
+
end
|
53
|
+
|
54
|
+
after do
|
55
|
+
FileUtils.rm(tmp_json_config)
|
56
|
+
FileUtils.rm_rf tmp_workspace
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'is called by thor, when "pi_build_modifier modify" is called' do
|
60
|
+
expect_any_instance_of(PiBuildModifier::PiBuildModifier).to receive(:modify).with(tmp_json_config, tmp_workspace)
|
61
|
+
PiBuildModifier::PiBuildModifier.start(['modify', tmp_json_config, tmp_workspace])
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'triggers the modifier task' do
|
65
|
+
expect(PiBuildModifier::Task::Modifier).to receive(:new).with(tmp_json_config, tmp_workspace).and_return(PiBuildModifier::Task::Modifier.new(tmp_json_config, tmp_workspace))
|
66
|
+
expect_any_instance_of(PiBuildModifier::Task::Modifier).to receive(:execute)
|
67
|
+
PiBuildModifier::PiBuildModifier.start(['modify', tmp_json_config, tmp_workspace])
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017-2019 Beate Ottenwälder
|
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.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
lib = File.join(File.dirname(__FILE__), '/lib')
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'bundler/gem_tasks'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
|
+
task :default => :spec
|
10
|
+
|
11
|
+
rescue LoadError
|
12
|
+
puts 'RSpec or Bundler is not installed. This means rake is not able to execute tests!'
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure('2') do |config|
|
5
|
+
|
6
|
+
config.vm.box = "ubuntu/xenial64"
|
7
|
+
|
8
|
+
config.vm.provision 'shell', inline: <<-SHELL
|
9
|
+
sudo apt update
|
10
|
+
sudo apt -y install build-essential ruby-full
|
11
|
+
gem install bundler
|
12
|
+
cd /vagrant
|
13
|
+
bundle install
|
14
|
+
rake spec
|
15
|
+
SHELL
|
16
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
# Copyright (c) 2017-
|
3
|
+
# Copyright (c) 2017-2019 Beate Ottenwälder
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2019 Beate Ottenwälder
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -37,20 +37,21 @@ module PiCustomizer
|
|
37
37
|
##
|
38
38
|
# The build command can be called by a user to trigger a customized build of a pi image
|
39
39
|
|
40
|
-
desc 'build ENV', 'Build pi image on environment ENV (valid environments are
|
40
|
+
desc 'build ENV', 'Build pi image on environment ENV (valid environments are: VAGRANT).'
|
41
41
|
method_option :build_sources_git_url, :default => Workspace::DEFAULT_GIT_PATH, :aliases => '-g'
|
42
|
+
method_option :build_sources_git_tag, :default => Workspace::DEFAULT_GIT_TAG, :aliases => '-t'
|
42
43
|
method_option :remote_workspace_dir, :default => Workspace::DEFAULT_REMOTE_WORKSPACE_DIRECTORY, :aliases => '-w'
|
43
|
-
method_option :config_file, :
|
44
|
-
method_option :local_workspace_dir, :default => Workspace::DEFAULT_LOCAL_WORKSPACE_DIRECTORY, :aliases => '-
|
44
|
+
method_option :config_file, :aliases => '-c', :required => true
|
45
|
+
method_option :local_workspace_dir, :default => Workspace::DEFAULT_LOCAL_WORKSPACE_DIRECTORY, :aliases => '-l'
|
45
46
|
method_option :modifier_gem, :default => '', :aliases => '-m', :desc => 'Path to the modifier_gem. If not specified, the most recent gem from rubygems.org is downloaded.'
|
46
47
|
method_option :deploy_dir, :default => Dir.getwd, :aliases => '-d'
|
47
48
|
method_option :skip_steps, :type => :array, :aliases => '-s'
|
48
49
|
|
49
50
|
def build(env)
|
50
51
|
begin
|
51
|
-
remote_workspace = Workspace::RemoteWorkspace.new("#{options[:remote_workspace_dir]}", "#{options[:build_sources_git_url]}")
|
52
|
+
remote_workspace = Workspace::RemoteWorkspace.new("#{options[:remote_workspace_dir]}", "#{options[:build_sources_git_url]}", "#{options[:build_sources_git_tag]}")
|
52
53
|
local_workspace = Workspace::LocalWorkspace.new("#{options[:config_file]}", "#{options[:local_workspace_dir]}", "#{options[:modifier_gem]}")
|
53
|
-
builder = Environment::
|
54
|
+
builder = Environment::builder_factory(env, local_workspace, remote_workspace, options[:skip_steps])
|
54
55
|
builder.build
|
55
56
|
rescue Exception => e
|
56
57
|
$logger.error e.message
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2019 Beate Ottenwälder
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -18,7 +18,6 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
19
|
# SOFTWARE.
|
20
20
|
|
21
|
-
require 'pi_customizer/build/environment/environment_builder_factory'
|
22
21
|
require 'pi_customizer/utils/logex'
|
23
22
|
|
24
23
|
module PiCustomizer
|
@@ -37,51 +36,78 @@ module PiCustomizer
|
|
37
36
|
@skip_build_steps = convert_to_skip(skip_build_steps)
|
38
37
|
end
|
39
38
|
|
39
|
+
##
|
40
|
+
# check if a build environment is specified and then calls the check step for this environment
|
41
|
+
|
40
42
|
def check
|
41
43
|
check_env
|
42
44
|
@env.check
|
43
45
|
end
|
44
46
|
|
47
|
+
##
|
48
|
+
# execute the prepare step for the build environment
|
49
|
+
|
45
50
|
def prepare
|
46
51
|
unless @skip_build_steps.include?(:prepare)
|
47
52
|
@env.prepare
|
48
53
|
end
|
49
54
|
end
|
50
55
|
|
56
|
+
##
|
57
|
+
# execute the start step for the build environment
|
58
|
+
|
51
59
|
def start
|
52
60
|
unless @skip_build_steps.include?(:start)
|
53
61
|
@env.start
|
54
62
|
end
|
55
63
|
end
|
56
64
|
|
65
|
+
##
|
66
|
+
# execute the build_image step for the build environment
|
67
|
+
|
57
68
|
def build_image
|
58
69
|
unless @skip_build_steps.include?(:build_image)
|
59
70
|
@env.build_image
|
60
71
|
end
|
61
72
|
end
|
62
73
|
|
74
|
+
##
|
75
|
+
# publish the image from the build environment
|
76
|
+
|
63
77
|
def publish
|
64
78
|
unless @skip_build_steps.include?(:publish)
|
65
79
|
@env.publish
|
66
80
|
end
|
67
81
|
end
|
68
82
|
|
83
|
+
##
|
84
|
+
# clean_up the build environment
|
85
|
+
|
69
86
|
def clean_up
|
70
87
|
unless @skip_build_steps.include?(:clean_up)
|
71
88
|
@env.clean_up
|
72
89
|
end
|
73
90
|
end
|
74
91
|
|
92
|
+
##
|
93
|
+
# execute the stop step of the environment
|
94
|
+
|
75
95
|
def stop
|
76
96
|
unless @skip_build_steps.include?(:stop)
|
77
97
|
@env.stop
|
78
98
|
end
|
79
99
|
end
|
80
100
|
|
101
|
+
##
|
102
|
+
# execute the ensure step of an environment
|
103
|
+
|
81
104
|
def ensure
|
82
105
|
@env.ensure
|
83
106
|
end
|
84
107
|
|
108
|
+
##
|
109
|
+
# convert a list of stringified build steps to a list of symbols
|
110
|
+
|
85
111
|
private def convert_to_skip(skip_build_steps)
|
86
112
|
if skip_build_steps.nil?
|
87
113
|
skip_build_steps = Array.new
|
@@ -93,6 +119,9 @@ module PiCustomizer
|
|
93
119
|
skip_build_steps
|
94
120
|
end
|
95
121
|
|
122
|
+
##
|
123
|
+
# check if an environment is specified
|
124
|
+
|
96
125
|
private def check_env
|
97
126
|
if @env.nil?
|
98
127
|
raise 'No environment specified, please specify the "environment", e.g. Vagrant'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2019 Beate Ottenwälder
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -18,7 +18,6 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
19
|
# SOFTWARE.
|
20
20
|
|
21
|
-
require 'pi_customizer/build/environment/environment_builder_factory'
|
22
21
|
require 'pi_customizer/build/builder/build_executor'
|
23
22
|
|
24
23
|
module PiCustomizer
|
@@ -36,6 +35,9 @@ module PiCustomizer
|
|
36
35
|
@build_executor = BuildExecutor.new(environment,skip_build_steps)
|
37
36
|
end
|
38
37
|
|
38
|
+
##
|
39
|
+
# build orchestrates an environment and therefore the build process of an image
|
40
|
+
|
39
41
|
def build
|
40
42
|
begin
|
41
43
|
execute_builder
|
data/{lib → pi_customizer/lib}/pi_customizer/build/environment/environment_builder_factory.rb
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2019 Beate Ottenwälder
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -38,7 +38,10 @@ module PiCustomizer
|
|
38
38
|
ENV_DOCKER = 'DOCKER'
|
39
39
|
ENV_ECHO = 'ECHO'
|
40
40
|
|
41
|
-
|
41
|
+
##
|
42
|
+
# The builder_factory creates a builder for the selected environment env. The builder orchestrates the environment and the build process in the environment.
|
43
|
+
|
44
|
+
def Environment.builder_factory(env, local_workspace, remote_workspace, skip_build_steps)
|
42
45
|
|
43
46
|
environment = environment_factory(env, local_workspace, remote_workspace)
|
44
47
|
|
@@ -55,6 +58,9 @@ module PiCustomizer
|
|
55
58
|
env_builder
|
56
59
|
end
|
57
60
|
|
61
|
+
##
|
62
|
+
# The environment_factory creates an environment configuration tailored to the selected build environment env
|
63
|
+
|
58
64
|
def Environment.environment_factory(env, local_workspace, remote_workspace)
|
59
65
|
case env
|
60
66
|
when ENV_AWS
|
@@ -66,7 +72,7 @@ module PiCustomizer
|
|
66
72
|
when ENV_ECHO
|
67
73
|
environment = EnvironmentControl.new(remote_workspace, local_workspace)
|
68
74
|
else
|
69
|
-
$logger.
|
75
|
+
$logger.warn 'No valid environment (e.g., AWS or VAGRANT) defined!'
|
70
76
|
environment = EnvironmentControl.new(remote_workspace, local_workspace)
|
71
77
|
end
|
72
78
|
environment
|
data/{lib → pi_customizer/lib}/pi_customizer/build/environment/vagrant/templates/Vagrantfile.erb
RENAMED
@@ -15,14 +15,10 @@ $install_modifier_gem = <<SCRIPT
|
|
15
15
|
SCRIPT
|
16
16
|
|
17
17
|
$prepare = <<SCRIPT
|
18
|
+
rm -rf <%= workspace.workspace_directory %>
|
18
19
|
mkdir -p <%= workspace.workspace_directory %>
|
19
|
-
|
20
|
-
|
21
|
-
git pull <%= workspace.git_path %> <%= workspace.workspace_directory %> -r
|
22
|
-
else
|
23
|
-
echo 'git clone to workspace'
|
24
|
-
git clone <%= workspace.git_path %> <%= workspace.workspace_directory %>
|
25
|
-
fi
|
20
|
+
echo 'git clone to workspace'
|
21
|
+
git clone --branch <%= workspace.git_tag %> <%= workspace.git_path %> <%= workspace.workspace_directory %>
|
26
22
|
SCRIPT
|
27
23
|
|
28
24
|
$modify = <<SCRIPT
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2019 Beate Ottenwälder
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -35,7 +35,7 @@ module PiCustomizer
|
|
35
35
|
|
36
36
|
def initialize(config, workspace)
|
37
37
|
@vagrant_template_path = File.join(File.dirname(__FILE__), '/templates/Vagrantfile.erb')
|
38
|
-
@disk_size = '
|
38
|
+
@disk_size = '60GB'
|
39
39
|
@config_file_destination = '/vagrant/config.json'
|
40
40
|
@config = if config.nil?
|
41
41
|
Workspace::LocalWorkspace.new
|