gitlab-development-kit 0.2.6 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gdk +75 -45
- data/lib/gitlab_development_kit.rb +4 -1
- metadata +22 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db463a96b5d0f8bca71fcb5ba61e019985403cfde2677fff138b507c355d2da7
|
4
|
+
data.tar.gz: ae4f0852a1e2d19c5999c75815742901dfaf1f397f50e8c58a24974c91cf03a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1372bb27ee7a8461a4c9dfcb0b7083eee84d420fedf94ebe4815290e7ee42b8b3aad9f3fb985b0140fabfe7eabf5f192d6d7f4b12426f999b500161734ef747e
|
7
|
+
data.tar.gz: 291032043e2f088398bbb06b7f44faf88154ef8e9f863877113d6004d9786108c4b8f04b90b26019bd4e153d542651ab80ac35e8579635a62f5de00952b4cd58
|
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,72 +12,97 @@ 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
|
-
when 'version'
|
22
|
-
puts "GitLab Development Kit gem version #{GDK::GEM_VERSION}"
|
23
|
-
true
|
24
23
|
when 'init'
|
25
|
-
if ARGV.count > 2 || (ARGV.count == 2 && (ARGV[1] ==
|
26
|
-
puts
|
24
|
+
if ARGV.count > 2 || (ARGV.count == 2 && (ARGV[1] == '-help' || ARGV[1] == '--help'))
|
25
|
+
puts 'Usage: gdk init [DIR]'
|
27
26
|
return false
|
28
27
|
end
|
28
|
+
|
29
29
|
directory = ARGV.count == 2 ? ARGV[1] : DEFAULT_INIT_DIRECTORY
|
30
30
|
if directory.start_with?('-')
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
warn <<~INVALID_GDK_DIR_NAME
|
32
|
+
The gdk directory cannot start with a dash ('-'). Did you mean:
|
33
|
+
gdk init #{directory.sub(/^-+/, '')}
|
34
|
+
INVALID_GDK_DIR_NAME
|
35
|
+
return false
|
36
36
|
end
|
37
|
+
|
37
38
|
cmd = %W[git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git #{directory}]
|
38
39
|
system(*cmd) && trust!(directory) && remember!(directory)
|
39
40
|
when 'trust'
|
40
41
|
if ARGV.count != 2
|
41
|
-
puts
|
42
|
+
puts 'Usage: gdk trust DIR'
|
42
43
|
return false
|
43
44
|
end
|
45
|
+
|
44
46
|
trust!(ARGV[1])
|
45
47
|
else
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
|
56
|
-
EOS
|
48
|
+
if print_version?
|
49
|
+
puts VERSION
|
50
|
+
|
51
|
+
return true
|
52
|
+
end
|
53
|
+
|
54
|
+
unless gdk_dir?
|
55
|
+
warn_not_gdk_dir
|
56
|
+
|
57
57
|
return false
|
58
58
|
end
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
|
64
|
-
|This GitLab Development Kit root directory is not known to the "gdk"
|
65
|
-
|command. To mark it as trusted run:
|
66
|
-
|
|
67
|
-
|gdk trust #{$gdk_root}
|
68
|
-
|
|
69
|
-
EOS
|
59
|
+
|
60
|
+
unless trusted?
|
61
|
+
warn_not_trusted_dir
|
62
|
+
|
70
63
|
return false
|
71
64
|
end
|
72
65
|
|
73
|
-
load(File.join(
|
66
|
+
load(File.join(gdk_root, 'lib/gdk.rb'))
|
74
67
|
GDK.main
|
75
68
|
end
|
76
69
|
end
|
77
70
|
|
71
|
+
def self.warn_not_gdk_dir
|
72
|
+
warn <<~NOT_A_GDK_DIR
|
73
|
+
|
74
|
+
The current working directory is not inside a gitlab-development-kit
|
75
|
+
installation. Use 'cd' to go to your gitlab-development-kit or create
|
76
|
+
a new one with 'gdk init'.
|
77
|
+
|
78
|
+
gdk init [DIRECTORY] # Default: #{DEFAULT_INIT_DIRECTORY}
|
79
|
+
|
80
|
+
NOT_A_GDK_DIR
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.warn_not_trusted_dir
|
84
|
+
warn <<~NOT_A_TRUSTED_GDK_DIR
|
85
|
+
|
86
|
+
This GitLab Development Kit root directory is not known to the "gdk"
|
87
|
+
command. To mark it as trusted run:
|
88
|
+
|
89
|
+
gdk trust #{gdk_root}
|
90
|
+
|
91
|
+
NOT_A_TRUSTED_GDK_DIR
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.gdk_root
|
95
|
+
@gdk_root ||= find_root(Dir.pwd)
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.gdk_dir?
|
99
|
+
!gdk_root.nil?
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.print_version?
|
103
|
+
%w[version --version].include?(ARGV.first) && !gdk_dir?
|
104
|
+
end
|
105
|
+
|
78
106
|
def self.find_root(current)
|
79
107
|
if File.exist?(File.join(current, 'GDK_ROOT'))
|
80
108
|
File.realpath(current)
|
@@ -85,9 +113,9 @@ module GDK
|
|
85
113
|
end
|
86
114
|
end
|
87
115
|
|
88
|
-
def self.trusted?
|
116
|
+
def self.trusted?
|
89
117
|
trusted_directories = load_dotfile[TRUSTED_KEY] || []
|
90
|
-
!!trusted_directories.include?(File.realpath(
|
118
|
+
!!trusted_directories.include?(File.realpath(gdk_root))
|
91
119
|
end
|
92
120
|
|
93
121
|
def self.trust!(directory)
|
@@ -108,16 +136,18 @@ module GDK
|
|
108
136
|
end
|
109
137
|
|
110
138
|
def self.load_dotfile
|
111
|
-
File.open(DOTFILE, File::RDONLY | File::CREAT)
|
139
|
+
File.open(DOTFILE, File::RDONLY | File::CREAT) do |f|
|
140
|
+
YAML.safe_load(f)
|
141
|
+
end || {}
|
112
142
|
end
|
113
143
|
|
114
144
|
def self.remember!(directory)
|
115
|
-
open("#{directory}/#{ROOT_CHECK_FILE}", 'w') do |f|
|
145
|
+
File.open("#{directory}/#{ROOT_CHECK_FILE}", 'w') do |f|
|
116
146
|
f.puts File.realpath(directory)
|
117
147
|
end
|
118
148
|
true
|
119
|
-
rescue =>
|
120
|
-
warn
|
149
|
+
rescue StandardError => e
|
150
|
+
warn e
|
121
151
|
false
|
122
152
|
end
|
123
153
|
end
|
metadata
CHANGED
@@ -1,18 +1,33 @@
|
|
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.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Vosmaer
|
8
|
+
- GitLab
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
12
|
+
date: 2021-04-20 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '12.0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '12.0'
|
13
28
|
description: CLI for GitLab Development Kit.
|
14
29
|
email:
|
15
|
-
-
|
30
|
+
- gitlab_rubygems@gitlab.com
|
16
31
|
executables:
|
17
32
|
- gdk
|
18
33
|
extensions: []
|
@@ -30,16 +45,16 @@ require_paths:
|
|
30
45
|
- lib
|
31
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
32
47
|
requirements:
|
33
|
-
- - "
|
48
|
+
- - ">="
|
34
49
|
- !ruby/object:Gem::Version
|
35
|
-
version: 2.
|
50
|
+
version: 2.7.2
|
36
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
52
|
requirements:
|
38
53
|
- - ">="
|
39
54
|
- !ruby/object:Gem::Version
|
40
55
|
version: '0'
|
41
56
|
requirements: []
|
42
|
-
rubygems_version: 3.
|
57
|
+
rubygems_version: 3.1.4
|
43
58
|
signing_key:
|
44
59
|
specification_version: 4
|
45
60
|
summary: CLI for GitLab Development Kit
|