gitlab-development-kit 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gdk +79 -28
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96053977970c8478e0624219700a6748cd4ef7d2
|
4
|
+
data.tar.gz: 85a3186752629e1870a3e1986cd490cd166cc708
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2933695c15e0f485e2dd81b847ca5528df70f47a4c2bd0eb72250a1ef3d8c16d2cbfd910958372dabb94ee93b805d2afb63b1671380025f390a729ad852b416c
|
7
|
+
data.tar.gz: 9b5176933fbadf95fad1c64e7b2337d84ec8b9c19a12c01c85fd413e25cfd7af89c3516facb6dc21d788d23dbeeea750ac7539eb0807df662895d9467b83fb03
|
data/bin/gdk
CHANGED
@@ -1,37 +1,88 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require '
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
# Gitlab Development Kit CLI launcher
|
5
|
+
#
|
6
|
+
# Note to contributors: this script must not change (much) because it is
|
7
|
+
# installed outside the gitlab-development-kit repository with 'gem
|
8
|
+
# install'. Edit lib/gdk.rb to define new commands.
|
9
|
+
|
10
|
+
module GDK
|
11
|
+
DOTFILE = File.expand_path('~/.gdk.yml')
|
12
|
+
TRUSTED_KEY = 'trusted_directories'
|
13
|
+
|
14
|
+
def self.launcher_main
|
15
|
+
case ARGV.first
|
16
|
+
when 'init'
|
17
|
+
if ARGV.count > 2
|
18
|
+
puts "Usage: gdk init [DIR]"
|
19
|
+
return false
|
20
|
+
end
|
21
|
+
|
22
|
+
cmd = %W(git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git)
|
23
|
+
cmd << ARGV[1] if ARGV.count == 2
|
24
|
+
system(*cmd)
|
25
|
+
when 'trust'
|
26
|
+
if ARGV.count != 2
|
27
|
+
puts "Usage: gdk trust DIR"
|
28
|
+
return false
|
29
|
+
end
|
30
|
+
trust!(ARGV[1])
|
31
|
+
else
|
32
|
+
$gdk_root = find_root(Dir.pwd)
|
33
|
+
if $gdk_root.nil?
|
34
|
+
puts "Could not find GDK_ROOT in the current directory or any of its parents."
|
35
|
+
return false
|
36
|
+
end
|
37
|
+
puts "(in #{$gdk_root})"
|
38
|
+
|
39
|
+
if !trusted?($gdk_root)
|
40
|
+
puts <<-EOS.gsub(/^\s+\|/, '')
|
41
|
+
|
|
42
|
+
|This GitLab Development Kit root directory is not known to the "gdk"
|
43
|
+
|command. To mark it as trusted run:
|
44
|
+
|
|
45
|
+
|gdk trust #{$gdk_root}
|
46
|
+
|
|
47
|
+
EOS
|
48
|
+
return false
|
49
|
+
end
|
50
|
+
|
51
|
+
load(File.join($gdk_root, 'lib/gdk.rb'))
|
52
|
+
GDK::main
|
10
53
|
end
|
54
|
+
end
|
11
55
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
56
|
+
private
|
57
|
+
|
58
|
+
def self.find_root(current)
|
59
|
+
if File.exist?(File.join(current, 'GDK_ROOT'))
|
60
|
+
File.realpath(current)
|
61
|
+
elsif File.realpath(current) == '/'
|
62
|
+
nil
|
63
|
+
else
|
64
|
+
find_root(File.join(current, '..'))
|
20
65
|
end
|
21
|
-
puts "(in #{$gdk_root})"
|
22
|
-
load(File.join($gdk_root, 'lib/gdk.rb'))
|
23
|
-
GDK::main
|
24
66
|
end
|
25
|
-
end
|
26
67
|
|
27
|
-
def
|
28
|
-
|
29
|
-
File.realpath(
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
68
|
+
def self.trusted?(directory)
|
69
|
+
trusted_directories = load_dotfile[TRUSTED_KEY] || []
|
70
|
+
!!trusted_directories.include?(File.realpath(directory))
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.trust!(directory)
|
74
|
+
directory = File.realpath(directory)
|
75
|
+
config = load_dotfile
|
76
|
+
config[TRUSTED_KEY] ||= []
|
77
|
+
config[TRUSTED_KEY] << directory
|
78
|
+
puts "Adding #{directory} to #{TRUSTED_KEY} in #{DOTFILE}"
|
79
|
+
File.open(DOTFILE, 'w') { |f| YAML.dump(config, f) }
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.load_dotfile
|
84
|
+
File.open(DOTFILE, File::RDONLY | File::CREAT) { |f| YAML.load(f) } || {}
|
34
85
|
end
|
35
86
|
end
|
36
87
|
|
37
|
-
exit(
|
88
|
+
exit(GDK::launcher_main)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-development-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Vosmaer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: CLI for GitLab Development Kit.
|
14
14
|
email:
|