gitlab-development-kit 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gdk +40 -35
- data/lib/gitlab_development_kit.rb +3 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf613de53ce1d786cd089d946aea46954738e639f0866836b6bddc69e8f9d804
|
4
|
+
data.tar.gz: f2f2481311a8e70c8ca803344b0383bfcbd24545f2fb13c7bde6203c79fd579b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 508f5077dbb2195433259bb651fe70e42133160399435510b8a5af8bd9d526d802370eb8bab8ecb40b538a185c7911ccc5bf1a3639d9ca9e854741c9cc5dda93
|
7
|
+
data.tar.gz: 4202049aecfdf6512e0dd7ee5140ec803cd8592b2ea32b6e81e29e113d0b81ed6d670eaee005b871564a718ac8028dd8fef69356d311338ad6fc81080ed2f9fd
|
data/bin/gdk
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
2
5
|
require 'yaml'
|
3
6
|
|
4
|
-
$LOAD_PATH.unshift(File.expand_path('
|
7
|
+
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
|
5
8
|
require 'gitlab_development_kit'
|
6
9
|
|
7
10
|
# Gitlab Development Kit CLI launcher
|
@@ -9,68 +12,68 @@ require 'gitlab_development_kit'
|
|
9
12
|
# Note to contributors: this script must not change (much) because it is
|
10
13
|
# installed outside the gitlab-development-kit repository with 'gem
|
11
14
|
# install'. Edit lib/gdk.rb to define new commands.
|
12
|
-
|
13
15
|
module GDK
|
14
16
|
DOTFILE = File.expand_path('~/.gdk.yml')
|
15
|
-
TRUSTED_KEY = 'trusted_directories'
|
16
|
-
ROOT_CHECK_FILE = '.gdk-install-root'
|
17
|
+
TRUSTED_KEY = 'trusted_directories'
|
18
|
+
ROOT_CHECK_FILE = '.gdk-install-root'
|
17
19
|
DEFAULT_INIT_DIRECTORY = File.join(Dir.pwd, 'gitlab-development-kit')
|
18
20
|
|
19
|
-
def self.launcher_main
|
21
|
+
def self.launcher_main # rubocop:disable Metrics/CyclomaticComplexity
|
20
22
|
case ARGV.first
|
21
23
|
when 'version'
|
22
24
|
puts "GitLab Development Kit gem version #{GDK::GEM_VERSION}"
|
23
25
|
true
|
24
26
|
when 'init'
|
25
|
-
if ARGV.count > 2 || (ARGV.count == 2 && (ARGV[1] ==
|
26
|
-
puts
|
27
|
+
if ARGV.count > 2 || (ARGV.count == 2 && (ARGV[1] == '-help' || ARGV[1] == '--help'))
|
28
|
+
puts 'Usage: gdk init [DIR]'
|
27
29
|
return false
|
28
30
|
end
|
29
31
|
directory = ARGV.count == 2 ? ARGV[1] : DEFAULT_INIT_DIRECTORY
|
30
32
|
if directory.start_with?('-')
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
warn <<~INVALID_GDK_DIR_NAME
|
34
|
+
The gdk directory cannot start with a dash ('-'). Did you mean:
|
35
|
+
gdk init #{directory.sub(/^-+/, '')}
|
36
|
+
INVALID_GDK_DIR_NAME
|
37
|
+
return false
|
36
38
|
end
|
37
39
|
cmd = %W[git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git #{directory}]
|
38
40
|
system(*cmd) && trust!(directory) && remember!(directory)
|
39
41
|
when 'trust'
|
40
42
|
if ARGV.count != 2
|
41
|
-
puts
|
43
|
+
puts 'Usage: gdk trust DIR'
|
42
44
|
return false
|
43
45
|
end
|
44
46
|
trust!(ARGV[1])
|
45
47
|
else
|
48
|
+
# rubocop:disable Style/GlobalVars
|
46
49
|
$gdk_root = find_root(Dir.pwd)
|
47
50
|
if $gdk_root.nil?
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
warn <<~NOT_A_GDK_DIR
|
52
|
+
|
53
|
+
The current working directory is not inside a gitlab-development-kit
|
54
|
+
installation. Use 'cd' to go to your gitlab-development-kit or create
|
55
|
+
a new one with 'gdk init'.
|
56
|
+
|
57
|
+
gdk init [DIRECTORY] # Default: #{DEFAULT_INIT_DIRECTORY}
|
58
|
+
|
59
|
+
NOT_A_GDK_DIR
|
57
60
|
return false
|
58
61
|
end
|
59
|
-
warn "(in #{$gdk_root})"
|
60
62
|
|
61
63
|
unless trusted?($gdk_root)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
64
|
+
warn <<~NOT_A_TRUSTED_GDK_DIR
|
65
|
+
|
66
|
+
This GitLab Development Kit root directory is not known to the "gdk"
|
67
|
+
command. To mark it as trusted run:
|
68
|
+
|
69
|
+
gdk trust #{$gdk_root}
|
70
|
+
|
71
|
+
NOT_A_TRUSTED_GDK_DIR
|
70
72
|
return false
|
71
73
|
end
|
72
74
|
|
73
75
|
load(File.join($gdk_root, 'lib/gdk.rb'))
|
76
|
+
# rubocop:enable Style/GlobalVars
|
74
77
|
GDK.main
|
75
78
|
end
|
76
79
|
end
|
@@ -108,16 +111,18 @@ module GDK
|
|
108
111
|
end
|
109
112
|
|
110
113
|
def self.load_dotfile
|
111
|
-
File.open(DOTFILE, File::RDONLY | File::CREAT)
|
114
|
+
File.open(DOTFILE, File::RDONLY | File::CREAT) do |f|
|
115
|
+
YAML.safe_load(f)
|
116
|
+
end || {}
|
112
117
|
end
|
113
118
|
|
114
119
|
def self.remember!(directory)
|
115
|
-
open("#{directory}/#{ROOT_CHECK_FILE}", 'w') do |f|
|
120
|
+
File.open("#{directory}/#{ROOT_CHECK_FILE}", 'w') do |f|
|
116
121
|
f.puts File.realpath(directory)
|
117
122
|
end
|
118
123
|
true
|
119
|
-
rescue =>
|
120
|
-
warn
|
124
|
+
rescue StandardError => e
|
125
|
+
warn e
|
121
126
|
false
|
122
127
|
end
|
123
128
|
end
|
metadata
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-development-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Vosmaer
|
8
|
+
- GitLab
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
@@ -12,7 +13,7 @@ date: 2020-06-18 00:00:00.000000000 Z
|
|
12
13
|
dependencies: []
|
13
14
|
description: CLI for GitLab Development Kit.
|
14
15
|
email:
|
15
|
-
-
|
16
|
+
- gitlab_rubygems@gitlab.com
|
16
17
|
executables:
|
17
18
|
- gdk
|
18
19
|
extensions: []
|