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,41 @@
|
|
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 'fileutils'
|
23
|
+
require 'pathname'
|
24
|
+
require 'pi_customizer/build/environment/vagrant/vagrant'
|
25
|
+
|
26
|
+
module PiCustomizer
|
27
|
+
module Environment
|
28
|
+
RSpec.describe Vagrant do
|
29
|
+
|
30
|
+
let(:vagrant_env) {Vagrant.new(nil, nil)}
|
31
|
+
|
32
|
+
describe '#check' do
|
33
|
+
it 'checks for the existence of vagrant' do
|
34
|
+
expect(vagrant_env).to receive(:system).with('vagrant -v').and_return(true)
|
35
|
+
vagrant_env.check
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,29 @@
|
|
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 'rspec'
|
23
|
+
require 'pi_customizer/version'
|
24
|
+
|
25
|
+
describe PiCustomizer do
|
26
|
+
it 'has a version number' do
|
27
|
+
expect(PiCustomizer::VERSION).not_to be nil
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,74 @@
|
|
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_customizer/build/workspace/local_workspace'
|
23
|
+
require 'fileutils'
|
24
|
+
require 'pathname'
|
25
|
+
|
26
|
+
module PiCustomizer
|
27
|
+
module Workspace
|
28
|
+
RSpec.describe LocalWorkspace do
|
29
|
+
|
30
|
+
it 'uses default values for config_path and tmp_directory when no path is specified' do
|
31
|
+
#Given
|
32
|
+
#When
|
33
|
+
local_config = LocalWorkspace.new('', '', '')
|
34
|
+
#Then
|
35
|
+
expect(local_config.config_path.to_s).to eq DEFAULT_CONFIG_PATH
|
36
|
+
expect(local_config.workspace_directory.to_s).to eq DEFAULT_LOCAL_WORKSPACE_DIRECTORY
|
37
|
+
expect(local_config.modifier_gem_path).to be nil
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'accepts absolute paths for config_path and stores them as absolute paths' do
|
41
|
+
#Given
|
42
|
+
expected_cfg = '/home/test/cfg.json'
|
43
|
+
expected_tmp = '/home/test/tmp'
|
44
|
+
expected_mod = '/home/test/mod.gem'
|
45
|
+
#When
|
46
|
+
local_config = LocalWorkspace.new(expected_cfg, expected_tmp, expected_mod)
|
47
|
+
#Then
|
48
|
+
expect(local_config.config_path.to_s).to eq expected_cfg
|
49
|
+
expect(local_config.workspace_directory.to_s).to eq expected_tmp
|
50
|
+
expect(local_config.modifier_gem_path.to_s).to eq expected_mod
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'accepts relative paths for config_path and stores them as absolute paths' do
|
54
|
+
local_config = LocalWorkspace.new('a', 'b', 'c')
|
55
|
+
expect(local_config.config_path.to_s).to eq File.join(Dir.pwd, '/a')
|
56
|
+
expect(local_config.workspace_directory.to_s).to eq File.join(Dir.pwd, '/b')
|
57
|
+
expect(local_config.modifier_gem_path.to_s).to eq File.join(Dir.pwd, '/c')
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'allows us to check for value equality' do
|
61
|
+
local_config_1 = LocalWorkspace.new('a', 'b', 'c')
|
62
|
+
local_config_2 = LocalWorkspace.new('a', 'b', 'c')
|
63
|
+
expect(local_config_1==local_config_2).to be true
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'allows us to check for value inequality' do
|
67
|
+
local_config_1 = LocalWorkspace.new('a', 'b', 'c')
|
68
|
+
local_config_2 = LocalWorkspace.new('e', 'f', 'g')
|
69
|
+
expect(local_config_1==local_config_2).to be false
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,51 @@
|
|
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 'fileutils'
|
23
|
+
require 'pathname'
|
24
|
+
require 'pi_customizer/build/workspace/remote_workspace'
|
25
|
+
|
26
|
+
|
27
|
+
RSpec.describe PiCustomizer::Workspace::RemoteWorkspace do
|
28
|
+
|
29
|
+
let(:git_path) {'../pi-gen-test'}
|
30
|
+
let(:default_git) {'https://github.com/ottenwbe/pi_customizer.git'}
|
31
|
+
|
32
|
+
it 'allows us to check for parameter equality' do
|
33
|
+
remote_workspace_1 = PiCustomizer::Workspace::RemoteWorkspace.new('a', 'b', 'd')
|
34
|
+
remote_workspace_2 = PiCustomizer::Workspace::RemoteWorkspace.new('a', 'b', 'd')
|
35
|
+
expect(remote_workspace_1==remote_workspace_2).to be true
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'allows us to check for parameter inequality' do
|
39
|
+
remote_workspace_1 = PiCustomizer::Workspace::RemoteWorkspace.new('a', 'b')
|
40
|
+
remote_workspace_2 = PiCustomizer::Workspace::RemoteWorkspace.new('c', 'd')
|
41
|
+
expect(remote_workspace_1==remote_workspace_2).to be false
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'initializes with known default values' do
|
45
|
+
remote_workspace = PiCustomizer::Workspace::RemoteWorkspace.new()
|
46
|
+
expect(remote_workspace.workspace_directory).to eq PiCustomizer::Workspace::DEFAULT_REMOTE_WORKSPACE_DIRECTORY
|
47
|
+
expect(remote_workspace.git_path).to eq PiCustomizer::Workspace::DEFAULT_GIT_PATH
|
48
|
+
expect(remote_workspace.git_tag).to eq PiCustomizer::Workspace::DEFAULT_GIT_TAG
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,59 @@
|
|
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_customizer/write/image_writer'
|
23
|
+
require 'pi_customizer/utils/logex'
|
24
|
+
|
25
|
+
|
26
|
+
describe PiCustomizer::ImageWriter do
|
27
|
+
|
28
|
+
let(:zip_img_file) {File.dirname(__FILE__) + '/../../fixtures/image.zip'}
|
29
|
+
let(:img_file) {File.dirname(__FILE__) + '/../../fixtures/image.img'}
|
30
|
+
let(:tmp_folder) {File.dirname(__FILE__) + '/tmp'}
|
31
|
+
|
32
|
+
before do
|
33
|
+
FileUtils.mkdir_p tmp_folder
|
34
|
+
end
|
35
|
+
|
36
|
+
after do
|
37
|
+
FileUtils.rm_rf(tmp_folder)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'raises an error when the format is not correct' do
|
41
|
+
allow(PiCustomizer::ImageWriter).to receive(:dispatch_write)
|
42
|
+
expect {PiCustomizer::ImageWriter.new().write('test.txt', '/dev/null')}.to raise_error
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'uses dd to write an image to a device' do
|
46
|
+
#When
|
47
|
+
PiCustomizer::ImageWriter.new().write(img_file, tmp_folder + '/img.img')
|
48
|
+
#Then
|
49
|
+
expect(Pathname.new(tmp_folder + '/img.img')).to be_file
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'uses dd to write a zipped image to a device' do
|
53
|
+
#When
|
54
|
+
PiCustomizer::ImageWriter.new().write(zip_img_file, tmp_folder + '/zip.img')
|
55
|
+
#Then
|
56
|
+
expect(Pathname.new(tmp_folder + '/zip.img')).to be_file
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,93 @@
|
|
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 'fileutils'
|
23
|
+
require 'rspec'
|
24
|
+
require 'pi_customizer'
|
25
|
+
require 'pi_customizer/utils/logex'
|
26
|
+
require 'pi_customizer/version'
|
27
|
+
require 'pi_customizer/build/workspace/local_workspace'
|
28
|
+
require 'pi_customizer/utils/logex'
|
29
|
+
|
30
|
+
|
31
|
+
describe PiCustomizer::PiCustomizer do
|
32
|
+
|
33
|
+
context 'build' do
|
34
|
+
it 'starts a build when the command line parameter \'build\' is passed' do
|
35
|
+
expect(PiCustomizer::Environment).to receive(:builder_factory).with(anything(), anything(), anything(), anything())
|
36
|
+
PiCustomizer::PiCustomizer.start(%w(build ECHO -c tst))
|
37
|
+
end
|
38
|
+
it 'reads the modifier_gem_path parameter' do
|
39
|
+
expect(PiCustomizer::Environment).to receive(:builder_factory).with(anything(), PiCustomizer::Workspace::LocalWorkspace.new('cfg', '', 'mod'), anything(), anything())
|
40
|
+
PiCustomizer::PiCustomizer.start(%w(build ECHO --modifier_gem=mod --config_file=cfg))
|
41
|
+
end
|
42
|
+
it 'reads the local_workspace_dir parameter' do
|
43
|
+
expect(PiCustomizer::Environment).to receive(:builder_factory).with(anything(), PiCustomizer::Workspace::LocalWorkspace.new('cfg', 'tmp', ''), anything(), anything())
|
44
|
+
PiCustomizer::PiCustomizer.start(%w(build ECHO --local_workspace_dir=tmp --config_file=cfg))
|
45
|
+
end
|
46
|
+
it 'reads the config_path parameter' do
|
47
|
+
expect(PiCustomizer::Environment).to receive(:builder_factory).with(anything(), PiCustomizer::Workspace::LocalWorkspace.new('cfg', '', ''), anything(), anything())
|
48
|
+
PiCustomizer::PiCustomizer.start(%w(build ECHO --config_file=cfg))
|
49
|
+
end
|
50
|
+
it 'reads the remote_workspace_dir parameter' do
|
51
|
+
expect(PiCustomizer::Environment).to receive(:builder_factory).with(anything(), anything(), PiCustomizer::Workspace::RemoteWorkspace.new('rdir', ''), anything())
|
52
|
+
PiCustomizer::PiCustomizer.start(%w(build ECHO --remote_workspace_dir=rdir -c tst))
|
53
|
+
end
|
54
|
+
it 'reads the build_sources_git_url parameter' do
|
55
|
+
expect(PiCustomizer::Environment).to receive(:builder_factory).with(anything(), anything(), PiCustomizer::Workspace::RemoteWorkspace.new('', 'git'), anything())
|
56
|
+
PiCustomizer::PiCustomizer.start(%w(build ECHO --build_sources_git_url=git -c tst))
|
57
|
+
end
|
58
|
+
it 'logs unexpected errors' do
|
59
|
+
expect($logger).to receive(:error).with(anything())
|
60
|
+
allow(PiCustomizer::Environment).to receive(:builder_factory).and_throw('test throw')
|
61
|
+
PiCustomizer::PiCustomizer.start(%w(build NONE -c "tst"))
|
62
|
+
end
|
63
|
+
it 'does not start if no config is provided' do
|
64
|
+
expect(STDERR).to receive(:puts).with(anything())
|
65
|
+
PiCustomizer::PiCustomizer.start(%w(build ECHO))
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'v' do
|
70
|
+
it 'returns the app\'s version' do
|
71
|
+
expect(STDOUT).to receive(:puts).with(PiCustomizer::VERSION)
|
72
|
+
PiCustomizer::PiCustomizer.start(%w(v))
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context 'version' do
|
77
|
+
it 'returns the app\'s version' do
|
78
|
+
expect(STDOUT).to receive(:puts).with(PiCustomizer::VERSION)
|
79
|
+
PiCustomizer::PiCustomizer.start(%w(version))
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context 'write' do
|
84
|
+
it 'triggers the write of a given image to a given device' do
|
85
|
+
allow(PiCustomizer::ImageWriter).to receive(:dispatch_write)
|
86
|
+
expected_img = 'test.img'
|
87
|
+
expected_dev = '/dev/null'
|
88
|
+
expect_any_instance_of(PiCustomizer::ImageWriter).to receive(:write).with(expected_img, expected_dev)
|
89
|
+
PiCustomizer::PiCustomizer.start(['write', "#{expected_img}", "#{expected_dev}"])
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
data/version.rb
ADDED
@@ -0,0 +1,21 @@
|
|
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
|
+
VERSION = '0.4.0.pre.alpha'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pi_customizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1.pre.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Beate Ottenwälder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,70 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '12.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.8'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.8'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.16'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.16'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rdoc
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '6.1'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '6.1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: thor
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,41 +96,102 @@ dependencies:
|
|
96
96
|
version: '0.20'
|
97
97
|
description: The pi_customizer gem allows you to adapt Raspbian images to your needs!
|
98
98
|
email: ottenwbe.public@gmail.com
|
99
|
-
executables:
|
100
|
-
- pi_customizer
|
99
|
+
executables: []
|
101
100
|
extensions: []
|
102
101
|
extra_rdoc_files: []
|
103
102
|
files:
|
104
|
-
- ".
|
105
|
-
-
|
103
|
+
- ".gitignore"
|
104
|
+
- ".travis.yml"
|
105
|
+
- CODE_OF_CONDUCT.md
|
106
106
|
- LICENSE
|
107
107
|
- README.md
|
108
108
|
- Rakefile
|
109
109
|
- Vagrantfile
|
110
|
-
-
|
111
|
-
-
|
112
|
-
-
|
113
|
-
-
|
114
|
-
-
|
115
|
-
-
|
116
|
-
-
|
117
|
-
-
|
118
|
-
-
|
119
|
-
- lib/
|
120
|
-
- lib/
|
121
|
-
- lib/
|
122
|
-
- lib/
|
123
|
-
- lib/
|
124
|
-
- lib/
|
125
|
-
- lib/
|
126
|
-
- lib/
|
127
|
-
- lib/
|
128
|
-
- lib/
|
129
|
-
- lib/
|
130
|
-
- lib/
|
131
|
-
- lib/
|
132
|
-
- lib/
|
133
|
-
-
|
110
|
+
- docs/concept.md
|
111
|
+
- docs/incubation.md
|
112
|
+
- pi_build_modifier/.gitignore
|
113
|
+
- pi_build_modifier/.rspec
|
114
|
+
- pi_build_modifier/Gemfile
|
115
|
+
- pi_build_modifier/LICENSE.txt
|
116
|
+
- pi_build_modifier/README.md
|
117
|
+
- pi_build_modifier/Rakefile
|
118
|
+
- pi_build_modifier/bin/pi_build_modifier
|
119
|
+
- pi_build_modifier/lib/pi_build_modifier.rb
|
120
|
+
- pi_build_modifier/lib/pi_build_modifier/boot-files/boot.rb
|
121
|
+
- pi_build_modifier/lib/pi_build_modifier/boot-files/templates/07-resize-init.diff.erb
|
122
|
+
- pi_build_modifier/lib/pi_build_modifier/config/logex.rb
|
123
|
+
- pi_build_modifier/lib/pi_build_modifier/locale/locale_debconf.rb
|
124
|
+
- pi_build_modifier/lib/pi_build_modifier/locale/templates/00-debconf.erb
|
125
|
+
- pi_build_modifier/lib/pi_build_modifier/modifier/erb_mapper.rb
|
126
|
+
- pi_build_modifier/lib/pi_build_modifier/modifier/mapper.rb
|
127
|
+
- pi_build_modifier/lib/pi_build_modifier/modifier/pi_modifier.rb
|
128
|
+
- pi_build_modifier/lib/pi_build_modifier/modifier_task.rb
|
129
|
+
- pi_build_modifier/lib/pi_build_modifier/net-tweaks/templates/wpa_supplicant.conf.erb
|
130
|
+
- pi_build_modifier/lib/pi_build_modifier/net-tweaks/wifi_network.rb
|
131
|
+
- pi_build_modifier/lib/pi_build_modifier/sys_tweaks/run_modifier.rb
|
132
|
+
- pi_build_modifier/lib/pi_build_modifier/sys_tweaks/ssh.rb
|
133
|
+
- pi_build_modifier/lib/pi_build_modifier/sys_tweaks/templates/ssh.sh.erb
|
134
|
+
- pi_build_modifier/lib/pi_build_modifier/system/system_type.rb
|
135
|
+
- pi_build_modifier/lib/pi_build_modifier/version.rb
|
136
|
+
- pi_build_modifier/pi_build_modifier.gemspec
|
137
|
+
- pi_build_modifier/spec/fixtures/config.json
|
138
|
+
- pi_build_modifier/spec/pi_build_modifier/boot/boot_spec.rb
|
139
|
+
- pi_build_modifier/spec/pi_build_modifier/locale/locale_spec.rb
|
140
|
+
- pi_build_modifier/spec/pi_build_modifier/modifier/mapper_spec.rb
|
141
|
+
- pi_build_modifier/spec/pi_build_modifier/modifier/modifier_spec.rb
|
142
|
+
- pi_build_modifier/spec/pi_build_modifier/modifier_task_spec.rb
|
143
|
+
- pi_build_modifier/spec/pi_build_modifier/net-tweaks/wifi_network_spec.rb
|
144
|
+
- pi_build_modifier/spec/pi_build_modifier/sys_tweaks/run_modifier_spec.rb
|
145
|
+
- pi_build_modifier/spec/pi_build_modifier/sys_tweaks/ssh_spec.rb
|
146
|
+
- pi_build_modifier/spec/pi_build_modifier/system/system_spec.rb
|
147
|
+
- pi_build_modifier/spec/pi_build_modifier_spec.rb
|
148
|
+
- pi_build_modifier/spec/spec_helper.rb
|
149
|
+
- pi_customizer/.rspec
|
150
|
+
- pi_customizer/Gemfile
|
151
|
+
- pi_customizer/LICENSE
|
152
|
+
- pi_customizer/README.md
|
153
|
+
- pi_customizer/Rakefile
|
154
|
+
- pi_customizer/Vagrantfile
|
155
|
+
- pi_customizer/bin/pi_customizer
|
156
|
+
- pi_customizer/envs/aws/outputs.tf
|
157
|
+
- pi_customizer/envs/aws/pi-build-env.tf
|
158
|
+
- pi_customizer/envs/aws/variables.tf
|
159
|
+
- pi_customizer/envs/docker/Dockerfile
|
160
|
+
- pi_customizer/envs/sh/build-pi-img.sh
|
161
|
+
- pi_customizer/lib/pi_customizer.rb
|
162
|
+
- pi_customizer/lib/pi_customizer/build/builder/build_executor.rb
|
163
|
+
- pi_customizer/lib/pi_customizer/build/builder/builder.rb
|
164
|
+
- pi_customizer/lib/pi_customizer/build/builder/prepare_start_execute_builder.rb
|
165
|
+
- pi_customizer/lib/pi_customizer/build/builder/start_prepare_execute_builder.rb
|
166
|
+
- pi_customizer/lib/pi_customizer/build/environment/aws/aws.rb
|
167
|
+
- pi_customizer/lib/pi_customizer/build/environment/docker/docker.rb
|
168
|
+
- pi_customizer/lib/pi_customizer/build/environment/environment.rb
|
169
|
+
- pi_customizer/lib/pi_customizer/build/environment/environment_builder_factory.rb
|
170
|
+
- pi_customizer/lib/pi_customizer/build/environment/vagrant/templates/Vagrantfile.erb
|
171
|
+
- pi_customizer/lib/pi_customizer/build/environment/vagrant/vagrant.rb
|
172
|
+
- pi_customizer/lib/pi_customizer/build/environment/vagrant/vagrant_file.rb
|
173
|
+
- pi_customizer/lib/pi_customizer/build/workspace/local_workspace.rb
|
174
|
+
- pi_customizer/lib/pi_customizer/build/workspace/remote_workspace.rb
|
175
|
+
- pi_customizer/lib/pi_customizer/utils/logex.rb
|
176
|
+
- pi_customizer/lib/pi_customizer/version.rb
|
177
|
+
- pi_customizer/lib/pi_customizer/write/image_writer.rb
|
178
|
+
- pi_customizer/pi_customizer.gemspec
|
179
|
+
- pi_customizer/spec/fixtures/TestVagrantfile
|
180
|
+
- pi_customizer/spec/fixtures/image.img
|
181
|
+
- pi_customizer/spec/fixtures/image.zip
|
182
|
+
- pi_customizer/spec/pi_customizer/builder/build_executor_spec.rb
|
183
|
+
- pi_customizer/spec/pi_customizer/environment/aws_spec.rb
|
184
|
+
- pi_customizer/spec/pi_customizer/environment/environment_builder_factory_spec.rb
|
185
|
+
- pi_customizer/spec/pi_customizer/environment/environment_spec.rb
|
186
|
+
- pi_customizer/spec/pi_customizer/environment/vagrant/vagrant_file_spec.rb
|
187
|
+
- pi_customizer/spec/pi_customizer/environment/vagrant/vagrant_spec.rb
|
188
|
+
- pi_customizer/spec/pi_customizer/version_spec.rb
|
189
|
+
- pi_customizer/spec/pi_customizer/workspace/local_workspace_spec.rb
|
190
|
+
- pi_customizer/spec/pi_customizer/workspace/remote_workspace_spec.rb
|
191
|
+
- pi_customizer/spec/pi_customizer/write/image_writer_spec.rb
|
192
|
+
- pi_customizer/spec/pi_customizer_spec.rb
|
193
|
+
- pi_customizer/spec/spec_helper.rb
|
194
|
+
- version.rb
|
134
195
|
homepage: https://github.com/ottenwbe/pi-gen-environment.git
|
135
196
|
licenses:
|
136
197
|
- MIT
|
@@ -151,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
212
|
version: 1.3.1
|
152
213
|
requirements: []
|
153
214
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.7.
|
215
|
+
rubygems_version: 2.7.7
|
155
216
|
signing_key:
|
156
217
|
specification_version: 4
|
157
218
|
summary: The pi_customizer gem!
|