sombrero 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/package.json +1 -1
- data/app/webpack.config.js +1 -2
- data/docker/base/build.sh +2 -4
- data/docker/{cleanup → skel/cleanup.sh} +0 -0
- data/lib/sombrero/cli/app/install.rb +21 -22
- data/lib/sombrero/cli/app/update.rb +12 -6
- data/lib/sombrero/cli/assertions.rb +60 -0
- data/lib/sombrero/cli/docker/build.rb +7 -27
- data/lib/sombrero/cli/docker/install.rb +7 -9
- data/lib/sombrero/cli/docker/update.rb +24 -0
- data/lib/sombrero/cli/docker.rb +2 -0
- data/lib/sombrero/cli/generator.rb +15 -0
- data/lib/sombrero/cli/helpers.rb +47 -0
- data/lib/sombrero/cli.rb +136 -70
- data/lib/sombrero/rtcp_controller.rb +0 -12
- data/sombrero.gemspec +1 -1
- metadata +8 -22
- data/.gitignore +0 -10
- data/LICENSE.txt +0 -21
- data/README.md +0 -41
- data/app/core/client/activity_observer.coffee +0 -37
- data/app/core/client/api.coffee +0 -248
- data/app/core/client/channels.coffee +0 -37
- data/app/core/client/load.coffee +0 -20
- data/app/core/client/page.coffee +0 -68
- data/app/core/client/polyfills/array.compact.coffee +0 -4
- data/app/core/client/polyfills/array.compact_join.coffee +0 -4
- data/app/core/client/polyfills/number.to_money.coffee +0 -3
- data/app/core/client/polyfills/string.capitalize.coffee +0 -4
- data/app/core/client/polyfills/string.strip.coffee +0 -5
- data/app/core/client/polyfills.coffee +0 -6
- data/app/core/client/render.coffee +0 -57
- data/app/core/client/util/alert.coffee +0 -50
- data/app/core/client/util/datetime.coffee +0 -47
- data/app/core/client/util.coffee +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5b002e39512744bcfd75b264bf2cd820fcff6a6
|
4
|
+
data.tar.gz: 626e16bd372b366c5ffb30cddbb8d2cb1756e704
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e14d044b87844c5fca8b44a028832fadf43981bc91d5d14b718cb14e7ec51d2d56771f4c29d5dcab4a2592aa073c9a08bba07e3203911104dce58172565517a
|
7
|
+
data.tar.gz: 51f1eaf67c0313e120428138de8f78a410af012021daf46b7a383832048e6918760d12e3232f6a2f29b89b5e6b20b77da6de37cb285962198ce3011f3414e788
|
data/app/package.json
CHANGED
data/app/webpack.config.js
CHANGED
data/docker/base/build.sh
CHANGED
@@ -15,11 +15,9 @@ echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
|
|
15
15
|
apk update
|
16
16
|
apk upgrade
|
17
17
|
|
18
|
-
apk add build-base runit nmap-ncat
|
18
|
+
apk add build-base runit curl nmap-ncat \
|
19
19
|
ruby ruby-dev ruby-irb ruby-io-console ruby-bigdecimal \
|
20
|
-
nodejs nodejs-dev
|
21
|
-
redis libpq postgresql-dev \
|
22
|
-
imagemagick imagemagick-dev
|
20
|
+
nodejs nodejs-dev
|
23
21
|
|
24
22
|
curl -fsSL curl.haxx.se/ca/cacert.pem -o "$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')"
|
25
23
|
echo 'gem: --no-ri --no-rdoc' > /root/.gemrc
|
File without changes
|
@@ -2,34 +2,33 @@ module Sombrero
|
|
2
2
|
class CLI
|
3
3
|
class App
|
4
4
|
class Install
|
5
|
-
include
|
5
|
+
include Helpers
|
6
6
|
|
7
|
-
def initialize dir, namespace
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
def initialize dir, namespace: nil, working_dir_opted: false
|
8
|
+
install(dir, working_dir_opted)
|
9
|
+
make_executable(dir / 'core/generate_webpack_setup.rb', dir / 'core/generate_controllers_map.rb')
|
10
|
+
add_namespace(dir, namespace) if namespace
|
11
|
+
puts "Done. All files installed into #{dir}"
|
11
12
|
end
|
12
13
|
|
13
|
-
def install dir,
|
14
|
-
src =
|
14
|
+
def install dir, working_dir_opted
|
15
|
+
src = working_dir_opted ? BASE_DIR.to_path + '/.' : BASE_DIR
|
15
16
|
FileUtils.cp_r(src, dir)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_namespace dir, namespace
|
20
|
+
%w[
|
21
|
+
base/base_controller.rb
|
22
|
+
base/rtcp_controller.rb
|
23
|
+
config/config.rb
|
24
|
+
].each do |file|
|
25
|
+
code = File.read(dir / file)
|
26
|
+
File.open dir / file, 'w' do |f|
|
27
|
+
f.puts "module #{namespace}"
|
28
|
+
code.split("\n").each {|l| f.puts " #{l}"}
|
29
|
+
f.puts "end"
|
30
30
|
end
|
31
31
|
end
|
32
|
-
puts "Done. All files installed into #{dir}"
|
33
32
|
end
|
34
33
|
|
35
34
|
end
|
@@ -2,18 +2,24 @@ module Sombrero
|
|
2
2
|
class CLI
|
3
3
|
class App
|
4
4
|
class Update
|
5
|
+
include Helpers
|
5
6
|
|
6
7
|
def initialize dir
|
7
|
-
|
8
|
-
|
8
|
+
FileUtils.rm_rf(dir / 'core')
|
9
|
+
Dir.chdir BASE_DIR do
|
9
10
|
|
10
|
-
|
11
|
+
Dir['**/*'].select {|e| File.file?(e)}.each do |file|
|
12
|
+
next if File.file?(dir / file)
|
13
|
+
create_dirname_for(dir / file)
|
14
|
+
puts "Installing #{File.basename(dir)}/#{file}"
|
15
|
+
FileUtils.cp(file, dir / file)
|
16
|
+
end
|
11
17
|
|
18
|
+
end
|
19
|
+
make_executable(dir / 'core/generate_webpack_setup.rb', dir / 'core/generate_controllers_map.rb')
|
20
|
+
puts "Done"
|
12
21
|
end
|
13
22
|
|
14
|
-
def update
|
15
|
-
|
16
|
-
end
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Sombrero
|
2
|
+
class CLI
|
3
|
+
module Assertions
|
4
|
+
|
5
|
+
def assert_directory_provided dir
|
6
|
+
return if dir
|
7
|
+
fatal_error! "Please provide a directory"
|
8
|
+
end
|
9
|
+
|
10
|
+
def assert_installable_dir dir, working_dir_opted
|
11
|
+
if working_dir_opted
|
12
|
+
assert_empty_directory(dir)
|
13
|
+
else
|
14
|
+
assert_directory_does_not_exists(dir)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def assert_is_docker_dir dir
|
19
|
+
return if File.exists?(dir / Docker::CONFIG_FILE)
|
20
|
+
fatal_error! "#{dir} does not look like a Sombrero docker dir"
|
21
|
+
end
|
22
|
+
|
23
|
+
def assert_is_app_dir dir
|
24
|
+
return if %w[
|
25
|
+
core
|
26
|
+
base/api
|
27
|
+
config
|
28
|
+
].all? {|e| File.exists?(dir / e)}
|
29
|
+
fatal_error! "#{dir} does not look like a Sombrero app dir"
|
30
|
+
end
|
31
|
+
|
32
|
+
def assert_empty_directory dir
|
33
|
+
return if Dir[dir / '*'].empty?
|
34
|
+
fatal_error! "#{dir} should be empty"
|
35
|
+
end
|
36
|
+
|
37
|
+
def assert_directory_exists dir
|
38
|
+
return if File.directory?(dir)
|
39
|
+
fatal_error! "#{dir} should be a directory"
|
40
|
+
end
|
41
|
+
|
42
|
+
def assert_directory_does_not_exists dir
|
43
|
+
return unless File.exists?(dir)
|
44
|
+
fatal_error! "#{dir} already exists"
|
45
|
+
end
|
46
|
+
|
47
|
+
def assert_config_file_exists dir
|
48
|
+
return if File.file?(dir / Docker::CONFIG_FILE)
|
49
|
+
fatal_error! "#{dir / Docker::CONFIG_FILE} file is missing"
|
50
|
+
end
|
51
|
+
|
52
|
+
def assert_valid_api_name_given api_name
|
53
|
+
api_name || fatal_error!('Please provide api name')
|
54
|
+
api_name =~ /\W/ && fatal_error!('Api name should contain only alphanumerics')
|
55
|
+
api_name =~ /\A[a-z]/i || fatal_error!('Api name should start with a letter')
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -3,11 +3,8 @@ module Sombrero
|
|
3
3
|
module Docker
|
4
4
|
class Build
|
5
5
|
|
6
|
-
def initialize dir,
|
7
|
-
check_working_dir(dir)
|
8
|
-
|
6
|
+
def initialize dir, update_runner_only: false, push_opted: false
|
9
7
|
Dir.chdir dir do
|
10
|
-
check_config_file
|
11
8
|
|
12
9
|
config = load_config
|
13
10
|
validate_config(config)
|
@@ -20,42 +17,25 @@ module Sombrero
|
|
20
17
|
|
21
18
|
app_dir = Pathname.new(File.expand_path(config['APP_DIR']))
|
22
19
|
|
23
|
-
|
20
|
+
if update_runner_only
|
21
|
+
puts "Skipping image building"
|
22
|
+
else
|
24
23
|
prepare_build(build_dir, app_dir)
|
25
24
|
|
26
25
|
image_built = build_image(build_dir, config['IMAGE_NAME'], config['BUILD_OPTS'])
|
27
26
|
|
28
|
-
if image_built && push_opted
|
27
|
+
if image_built && push_opted
|
29
28
|
push_image(config['IMAGE_NAME'])
|
30
29
|
end
|
31
30
|
end
|
32
31
|
|
32
|
+
puts "Installing run script"
|
33
33
|
install_run_script(app_dir, *config.values_at('IMAGE_NAME', 'CONTAINER_NAME', 'RUN_SCRIPT', 'RUN_OPTS'))
|
34
34
|
|
35
35
|
FileUtils.rm_rf(build_dir)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
def push_opted? args
|
40
|
-
args.find {|a| a == '-p'}
|
41
|
-
end
|
42
|
-
|
43
|
-
def skip_build? args
|
44
|
-
args.find {|a| a == '-u'}
|
45
|
-
end
|
46
|
-
|
47
|
-
def check_working_dir dir
|
48
|
-
return if File.directory?(dir)
|
49
|
-
puts "#{dir} should be a directory"
|
50
|
-
exit 1
|
51
|
-
end
|
52
|
-
|
53
|
-
def check_config_file
|
54
|
-
return if File.file?(CONFIG_FILE)
|
55
|
-
puts "#{dir}/config.yml file is missing"
|
56
|
-
exit 1
|
57
|
-
end
|
58
|
-
|
59
39
|
def load_config
|
60
40
|
YAML.load(File.read(CONFIG_FILE))
|
61
41
|
end
|
@@ -117,7 +97,7 @@ module Sombrero
|
|
117
97
|
end
|
118
98
|
|
119
99
|
def install_cleanup_file dir
|
120
|
-
FileUtils.cp(
|
100
|
+
FileUtils.cp(CLEANUP_FILE, dir / 'build/cleanup')
|
121
101
|
end
|
122
102
|
|
123
103
|
def prepare_build dir, app_dir
|
@@ -2,19 +2,17 @@ module Sombrero
|
|
2
2
|
class CLI
|
3
3
|
module Docker
|
4
4
|
class Install
|
5
|
-
include
|
5
|
+
include Helpers
|
6
6
|
|
7
|
-
def initialize dir
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
def initialize dir, working_dir_opted: false
|
8
|
+
install(dir, working_dir_opted)
|
9
|
+
make_executable(dir / PREPARE_BUILD_FILE)
|
10
|
+
puts "Done. All files installed into #{dir}"
|
11
11
|
end
|
12
12
|
|
13
|
-
def install dir
|
14
|
-
src =
|
13
|
+
def install dir, working_dir_opted
|
14
|
+
src = working_dir_opted ? BASE_DIR.to_path + '/skel/.' : BASE_DIR / 'skel'
|
15
15
|
FileUtils.cp_r(src, dir)
|
16
|
-
FileUtils.chmod('+x', dir / PREPARE_BUILD_FILE)
|
17
|
-
puts "Done. All files installed into #{dir}"
|
18
16
|
end
|
19
17
|
|
20
18
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sombrero
|
2
|
+
class CLI
|
3
|
+
module Docker
|
4
|
+
class Update
|
5
|
+
include Helpers
|
6
|
+
|
7
|
+
def initialize dir
|
8
|
+
Dir.chdir BASE_DIR / 'skel' do
|
9
|
+
|
10
|
+
Dir['**/*'].select {|e| File.file?(e)}.each do |file|
|
11
|
+
next if File.file?(dir / file)
|
12
|
+
create_dirname_for(dir / file)
|
13
|
+
puts "Installing #{File.basename(dir)}/#{file}"
|
14
|
+
FileUtils.cp(file, dir / file)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
puts "Done"
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/sombrero/cli/docker.rb
CHANGED
@@ -6,9 +6,11 @@ module Sombrero
|
|
6
6
|
START_FILE = './start.sh'.freeze
|
7
7
|
PREPARE_BUILD_FILE = './prepare_build.sh'.freeze
|
8
8
|
BUILD_FILE = './build.sh'.freeze
|
9
|
+
CLEANUP_FILE = './cleanup.sh'.freeze
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
14
|
require 'sombrero/cli/docker/install'
|
14
15
|
require 'sombrero/cli/docker/build'
|
16
|
+
require 'sombrero/cli/docker/update'
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Sombrero
|
2
|
+
class CLI
|
3
|
+
module Helpers
|
4
|
+
|
5
|
+
def display_error error
|
6
|
+
puts "", "\t::: #{error} :::", ""
|
7
|
+
end
|
8
|
+
|
9
|
+
def fatal_error! error, exit_code = 1
|
10
|
+
display_error(error)
|
11
|
+
exit exit_code
|
12
|
+
end
|
13
|
+
|
14
|
+
def expanded_path *path
|
15
|
+
Pathname.new(File.expand_path(File.join(*path.map(&:to_s))))
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_dirname_for dir
|
19
|
+
FileUtils.mkdir_p(File.dirname(dir))
|
20
|
+
end
|
21
|
+
|
22
|
+
def make_executable *entries
|
23
|
+
entries.flatten.each {|e| FileUtils.chmod('+x', e)}
|
24
|
+
end
|
25
|
+
|
26
|
+
def working_dir_opted? opted_dir
|
27
|
+
opted_dir == '.'
|
28
|
+
end
|
29
|
+
|
30
|
+
def extract_namespace args
|
31
|
+
return unless index = args.index('-n')
|
32
|
+
return unless namespace = args[index + 1]
|
33
|
+
if namespace =~ /::/
|
34
|
+
fatal_error! "Nested namespaces not supported"
|
35
|
+
end
|
36
|
+
if namespace =~ /\W/
|
37
|
+
fatal_error! "Namespace may contain only alphanumerics"
|
38
|
+
end
|
39
|
+
unless namespace =~ /\A[A-Z]/
|
40
|
+
fatal_error! "Namespace should start with a capital letter"
|
41
|
+
end
|
42
|
+
namespace
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/sombrero/cli.rb
CHANGED
@@ -2,110 +2,175 @@ require 'fileutils'
|
|
2
2
|
require 'pathname'
|
3
3
|
require 'yaml'
|
4
4
|
require 'pty'
|
5
|
+
require 'sombrero/cli/helpers'
|
6
|
+
require 'sombrero/cli/assertions'
|
5
7
|
|
6
8
|
module Sombrero
|
7
9
|
BASE_DIR = Pathname.new(File.expand_path('../../..', __FILE__)).freeze
|
8
10
|
|
9
11
|
class CLI
|
10
|
-
|
11
|
-
|
12
|
-
def ensure_dirname_exists dir
|
13
|
-
FileUtils.mkdir_p(File.dirname(dir))
|
14
|
-
end
|
15
|
-
|
16
|
-
def assert_installable_dir dir
|
17
|
-
if dir.to_path == '.'
|
18
|
-
assert_empty_dir(dir)
|
19
|
-
else
|
20
|
-
assert_dir_does_not_exists(dir)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def assert_empty_dir dir
|
25
|
-
return if Dir[dir / '*'].empty?
|
26
|
-
puts "", "\t::: #{dir} should be empty :::", ""
|
27
|
-
exit 1
|
28
|
-
end
|
29
|
-
|
30
|
-
def assert_dir_does_not_exists dir
|
31
|
-
return unless File.exists?(dir)
|
32
|
-
puts "", "\t::: #{dir} already exists :::", ""
|
33
|
-
exit 1
|
34
|
-
end
|
35
|
-
end
|
12
|
+
include Helpers
|
13
|
+
include Assertions
|
36
14
|
|
37
15
|
def initialize args
|
38
16
|
case command = args[0]
|
39
17
|
when 'a', 'app'
|
40
18
|
app(args)
|
19
|
+
when 'g', 'gen', 'generate'
|
20
|
+
generator(args)
|
41
21
|
when 'd', 'docker'
|
42
22
|
docker(args)
|
23
|
+
when nil, '-h', '--help'
|
24
|
+
usage
|
43
25
|
else
|
44
|
-
|
26
|
+
display_error "Unknown command #{command}"
|
27
|
+
usage
|
45
28
|
end
|
46
29
|
end
|
47
30
|
|
48
|
-
def app args
|
49
|
-
missing_destination_error! unless args[2]
|
50
|
-
dir = Pathname.new(args[2])
|
51
31
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
32
|
+
def usage
|
33
|
+
puts "
|
34
|
+
=== Install a new app ===
|
35
|
+
$ sombrero [app || a] [install || i] [dir || .]
|
36
|
+
|
37
|
+
=== Update existing app ===
|
38
|
+
$ sombrero [app || a] [update || u] [dir || .]
|
39
|
+
|
40
|
+
=== Generate a new API ===
|
41
|
+
$ sombrero [generate || g] [api || a] [api name] [dir || .]
|
42
|
+
|
43
|
+
=== Install Docker recipes ===
|
44
|
+
$ sombrero [docker || d] [install || i] [dir || .]
|
45
|
+
|
46
|
+
=== Update Docker recipes ===
|
47
|
+
$ sombrero [docker || d] [update || u] [dir || .]
|
48
|
+
|
49
|
+
=== Build Docker image and install run script ===
|
50
|
+
$ sombrero [docker || d] [build || b] [dir || .] [-u] [-p]
|
51
|
+
If -u option provided it will only update the run script without building the image.
|
52
|
+
If -p option provided it will try to push the image to Docker registry after successful build.
|
53
|
+
|
54
|
+
=== Usage ===
|
55
|
+
$ sombrero [-h || --help]
|
56
|
+
".split("\n").map {|l| "\t" + l.strip}.join("\n")
|
60
57
|
end
|
61
58
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
59
|
+
|
60
|
+
begin # App
|
61
|
+
def app args
|
62
|
+
opted_dir = args[2]
|
63
|
+
assert_directory_provided(opted_dir)
|
64
|
+
dir = expanded_path(opted_dir)
|
65
|
+
|
66
|
+
case instruction = args[1]
|
67
|
+
when 'i', 'install'
|
68
|
+
|
69
|
+
app_install(dir, {
|
70
|
+
working_dir_opted: working_dir_opted?(opted_dir),
|
71
|
+
namespace: extract_namespace(args)
|
72
|
+
})
|
73
|
+
|
74
|
+
when 'u', 'update'
|
75
|
+
|
76
|
+
app_update(dir)
|
77
|
+
|
78
|
+
else
|
79
|
+
unknown_instruction_error!(instruction, 'install (or i)', 'update (or u)')
|
80
|
+
end
|
68
81
|
end
|
69
|
-
|
70
|
-
|
71
|
-
|
82
|
+
|
83
|
+
def app_install dir, opts
|
84
|
+
create_dirname_for(dir)
|
85
|
+
assert_installable_dir(dir, opts[:working_dir_opted])
|
86
|
+
App::Install.new(dir, opts)
|
72
87
|
end
|
73
|
-
|
74
|
-
|
75
|
-
|
88
|
+
|
89
|
+
def app_update dir
|
90
|
+
assert_is_app_dir(dir)
|
91
|
+
App::Update.new(dir)
|
76
92
|
end
|
77
|
-
namespace
|
78
93
|
end
|
79
94
|
|
80
|
-
def docker args
|
81
|
-
missing_destination_error! unless args[2]
|
82
|
-
dir = Pathname.new(args[2])
|
83
95
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
96
|
+
begin # Generator
|
97
|
+
def generator args
|
98
|
+
|
99
|
+
case instruction = args[1]
|
100
|
+
when 'api', 'a'
|
101
|
+
api_name = args[2]
|
102
|
+
assert_valid_api_name_given(api_name)
|
103
|
+
|
104
|
+
app_dir = args[3]
|
105
|
+
assert_directory_provided(app_dir)
|
106
|
+
app_dir = expanded_path(app_dir)
|
107
|
+
assert_is_app_dir(app_dir)
|
108
|
+
|
109
|
+
gen_dir = app_dir / 'generators/api'
|
110
|
+
assert_directory_exists(gen_dir)
|
111
|
+
|
112
|
+
api_dir = app_dir / "base/api/#{api_name}"
|
113
|
+
assert_directory_does_not_exists(api_dir)
|
114
|
+
|
115
|
+
Generator::API.new(gen_dir, api_dir, api_name)
|
116
|
+
else
|
117
|
+
unknown_instruction_error!(instruction, 'api (or a)')
|
118
|
+
end
|
91
119
|
end
|
92
120
|
end
|
93
121
|
|
94
|
-
def missing_destination_error!
|
95
|
-
puts "", "\t::: Please provide a directory to install files into :::", ""
|
96
|
-
exit 1
|
97
|
-
end
|
98
122
|
|
99
|
-
|
100
|
-
|
101
|
-
|
123
|
+
begin # Docker
|
124
|
+
def docker args
|
125
|
+
opted_dir = args[2]
|
126
|
+
assert_directory_provided(opted_dir)
|
127
|
+
dir = expanded_path(opted_dir)
|
128
|
+
|
129
|
+
case instruction = args[1]
|
130
|
+
when 'i', 'install'
|
131
|
+
|
132
|
+
docker_install(dir, working_dir_opted: working_dir_opted?(opted_dir))
|
133
|
+
|
134
|
+
when 'b', 'build'
|
135
|
+
|
136
|
+
docker_build(dir, {
|
137
|
+
update_runner_only: args.find {|a| a == '-u'},
|
138
|
+
push_opted: args.find {|a| a == '-p'}
|
139
|
+
})
|
140
|
+
|
141
|
+
when 'u', 'update'
|
142
|
+
|
143
|
+
docker_update(dir)
|
144
|
+
|
145
|
+
else
|
146
|
+
unknown_instruction_error!(instruction, 'install (or i)', 'build (or b)', 'update (or u)')
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def docker_install dir, opts
|
151
|
+
create_dirname_for(dir)
|
152
|
+
assert_installable_dir(dir, opts[:working_dir_opted])
|
153
|
+
Docker::Install.new(dir, opts)
|
154
|
+
end
|
155
|
+
|
156
|
+
def docker_build dir, opts
|
157
|
+
assert_directory_exists(dir)
|
158
|
+
assert_config_file_exists(dir)
|
159
|
+
Docker::Build.new(dir, opts)
|
160
|
+
end
|
161
|
+
|
162
|
+
def docker_update dir
|
163
|
+
assert_is_docker_dir(dir)
|
164
|
+
Docker::Update.new(dir)
|
165
|
+
end
|
102
166
|
end
|
103
167
|
|
168
|
+
|
104
169
|
def unknown_instruction_error! instruction, *available_instructions
|
105
|
-
|
106
|
-
exit 1
|
170
|
+
fatal_error! "Unknown instruction #{instruction}. Use one of #{available_instructions*', '}"
|
107
171
|
end
|
108
172
|
|
173
|
+
|
109
174
|
def self.run cmd
|
110
175
|
puts "", "$ #{cmd}"
|
111
176
|
PTY.spawn cmd do |r, w, pid|
|
@@ -125,4 +190,5 @@ module Sombrero
|
|
125
190
|
end
|
126
191
|
|
127
192
|
require 'sombrero/cli/app'
|
193
|
+
require 'sombrero/cli/generator'
|
128
194
|
require 'sombrero/cli/docker'
|
@@ -1,15 +1,3 @@
|
|
1
|
-
# dirty hack until this is merged and released
|
2
|
-
# github.com/ngauthier/tubesock/pull/50
|
3
|
-
class Tubesock
|
4
|
-
def close!
|
5
|
-
if @socket.respond_to?(:closed?)
|
6
|
-
@socket.close unless @socket.closed?
|
7
|
-
else
|
8
|
-
@socket.close
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
1
|
module Sombrero
|
14
2
|
class RTCPController < BaseController
|
15
3
|
attr_reader :socket
|