assemblyline-cli 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assemblyline/cli.rb +37 -5
- data/lib/assemblyline/cli/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e4d9c5da410f82b87d264d272100f55a0cc8e71
|
4
|
+
data.tar.gz: 66eb2a8ccee7faa4f1b71fc128e025f5f1ed19eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de32c7559d592245e4e00dca60cae50262de03d8e88bc78faa3bd50f985c82f4e179e5644ddd153c810e3ddac9705e58887c3fa98b3c1c3cc647b645b7ba8245
|
7
|
+
data.tar.gz: 4b4c49b66c8add2fd3a041242d5b600c32416b8f9f50d83b1802e81121fe0ca8b160e5482f416020892fbbae461643defb33b6bcc76daf40f37587a112687ee7
|
data/lib/assemblyline/cli.rb
CHANGED
@@ -3,10 +3,14 @@ require 'thor'
|
|
3
3
|
|
4
4
|
module Assemblyline
|
5
5
|
class CLI < Thor
|
6
|
-
desc 'build
|
7
|
-
option :debug, type: :boolean
|
8
|
-
|
9
|
-
|
6
|
+
desc 'build GIT_URL or PATH', 'Build an assemblyline project from a git url or path'
|
7
|
+
option :debug, type: :boolean, default: false, desc: 'start assemblyline-builder with a tty'
|
8
|
+
option :push, type: :boolean, default: false, desc: 'push the built image to docker repo'
|
9
|
+
option :ref, type: :string, desc: 'merge this ref into master before building'
|
10
|
+
option :dev, type: :string, desc: 'use a local dev checkout of assemblyline-builder', banner: 'PATH'
|
11
|
+
def build(url_or_path)
|
12
|
+
init_local_mount url_or_path
|
13
|
+
exec "docker run --rm #{bind_mounts} #{env_flags} #{debug_flags} #{local_mount} #{assemblyline_builder} bin/build #{build_command(url_or_path)}" # rubocop:disable Metrics/LineLength
|
10
14
|
end
|
11
15
|
|
12
16
|
desc 'update', 'update assemblyline'
|
@@ -23,9 +27,37 @@ module Assemblyline
|
|
23
27
|
|
24
28
|
private
|
25
29
|
|
30
|
+
attr_reader :local_mount
|
31
|
+
|
32
|
+
def build_command(url_or_path)
|
33
|
+
if local_mount
|
34
|
+
"local_build #{push}#{sha}"
|
35
|
+
else
|
36
|
+
"build #{push}#{url_or_path} #{options[:ref]}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def push
|
41
|
+
return unless options[:push]
|
42
|
+
'--push '
|
43
|
+
end
|
44
|
+
|
45
|
+
def sha
|
46
|
+
`git rev-parse --short HEAD`.chomp
|
47
|
+
end
|
48
|
+
|
49
|
+
def init_local_mount(path)
|
50
|
+
return unless dir?(path)
|
51
|
+
@local_mount = "-v #{File.expand_path(Dir.pwd, path)}:/usr/assemblyline/local"
|
52
|
+
end
|
53
|
+
|
54
|
+
def dir?(path)
|
55
|
+
File.directory?(File.expand_path(Dir.pwd, path))
|
56
|
+
end
|
57
|
+
|
26
58
|
def debug_flags
|
27
59
|
return unless options[:debug]
|
28
|
-
|
60
|
+
'-ti'
|
29
61
|
end
|
30
62
|
|
31
63
|
def env_flags
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assemblyline-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Robinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.4.5
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: A super-lightweight wrapper to start assemblyline tasks
|