gitlab-development-kit 0.2.2 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/bin/gdk +68 -31
- data/lib/gitlab_development_kit.rb +5 -0
- metadata +11 -11
- data/lib/gitlab-development-kit.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
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,65 +1,83 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
2
5
|
require 'yaml'
|
3
6
|
|
4
|
-
|
5
|
-
require '
|
7
|
+
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
|
8
|
+
require 'gitlab_development_kit'
|
6
9
|
|
7
10
|
# Gitlab Development Kit CLI launcher
|
8
11
|
#
|
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
17
|
TRUSTED_KEY = 'trusted_directories'
|
18
|
+
ROOT_CHECK_FILE = '.gdk-install-root'
|
19
|
+
DEFAULT_INIT_DIRECTORY = File.join(Dir.pwd, 'gitlab-development-kit')
|
16
20
|
|
17
|
-
def self.launcher_main
|
21
|
+
def self.launcher_main # rubocop:disable Metrics/CyclomaticComplexity
|
18
22
|
case ARGV.first
|
19
23
|
when 'version'
|
20
24
|
puts "GitLab Development Kit gem version #{GDK::GEM_VERSION}"
|
21
25
|
true
|
22
26
|
when 'init'
|
23
|
-
if ARGV.count > 2
|
24
|
-
puts
|
27
|
+
if ARGV.count > 2 || (ARGV.count == 2 && (ARGV[1] == '-help' || ARGV[1] == '--help'))
|
28
|
+
puts 'Usage: gdk init [DIR]'
|
25
29
|
return false
|
26
30
|
end
|
27
|
-
directory = ARGV.count == 2 ? ARGV[1] :
|
28
|
-
|
29
|
-
|
31
|
+
directory = ARGV.count == 2 ? ARGV[1] : DEFAULT_INIT_DIRECTORY
|
32
|
+
if directory.start_with?('-')
|
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
|
38
|
+
end
|
39
|
+
cmd = %W[git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git #{directory}]
|
40
|
+
system(*cmd) && trust!(directory) && remember!(directory)
|
30
41
|
when 'trust'
|
31
42
|
if ARGV.count != 2
|
32
|
-
puts
|
43
|
+
puts 'Usage: gdk trust DIR'
|
33
44
|
return false
|
34
45
|
end
|
35
46
|
trust!(ARGV[1])
|
36
47
|
else
|
48
|
+
# rubocop:disable Style/GlobalVars
|
37
49
|
$gdk_root = find_root(Dir.pwd)
|
38
50
|
if $gdk_root.nil?
|
39
|
-
|
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
|
40
60
|
return false
|
41
61
|
end
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
EOS
|
62
|
+
|
63
|
+
unless trusted?($gdk_root)
|
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
|
53
72
|
return false
|
54
73
|
end
|
55
74
|
|
56
75
|
load(File.join($gdk_root, 'lib/gdk.rb'))
|
57
|
-
|
76
|
+
# rubocop:enable Style/GlobalVars
|
77
|
+
GDK.main
|
58
78
|
end
|
59
79
|
end
|
60
80
|
|
61
|
-
private
|
62
|
-
|
63
81
|
def self.find_root(current)
|
64
82
|
if File.exist?(File.join(current, 'GDK_ROOT'))
|
65
83
|
File.realpath(current)
|
@@ -74,20 +92,39 @@ module GDK
|
|
74
92
|
trusted_directories = load_dotfile[TRUSTED_KEY] || []
|
75
93
|
!!trusted_directories.include?(File.realpath(directory))
|
76
94
|
end
|
77
|
-
|
95
|
+
|
78
96
|
def self.trust!(directory)
|
79
97
|
directory = File.realpath(directory)
|
80
98
|
config = load_dotfile
|
81
99
|
config[TRUSTED_KEY] ||= []
|
82
|
-
|
83
|
-
|
84
|
-
|
100
|
+
|
101
|
+
if config[TRUSTED_KEY].include?(directory)
|
102
|
+
puts "#{directory} is already in #{TRUSTED_KEY} in #{DOTFILE}"
|
103
|
+
else
|
104
|
+
config[TRUSTED_KEY] << directory
|
105
|
+
config[TRUSTED_KEY].uniq!
|
106
|
+
puts "Adding #{directory} to #{TRUSTED_KEY} in #{DOTFILE}"
|
107
|
+
File.open(DOTFILE, 'w') { |f| YAML.dump(config, f) }
|
108
|
+
end
|
109
|
+
|
85
110
|
true
|
86
111
|
end
|
87
112
|
|
88
113
|
def self.load_dotfile
|
89
|
-
File.open(DOTFILE, File::RDONLY | File::CREAT)
|
114
|
+
File.open(DOTFILE, File::RDONLY | File::CREAT) do |f|
|
115
|
+
YAML.safe_load(f)
|
116
|
+
end || {}
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.remember!(directory)
|
120
|
+
File.open("#{directory}/#{ROOT_CHECK_FILE}", 'w') do |f|
|
121
|
+
f.puts File.realpath(directory)
|
122
|
+
end
|
123
|
+
true
|
124
|
+
rescue StandardError => e
|
125
|
+
warn e
|
126
|
+
false
|
90
127
|
end
|
91
128
|
end
|
92
129
|
|
93
|
-
exit(GDK
|
130
|
+
exit(GDK.launcher_main)
|
metadata
CHANGED
@@ -1,47 +1,47 @@
|
|
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
|
-
|
8
|
+
- GitLab
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
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: []
|
19
20
|
extra_rdoc_files: []
|
20
21
|
files:
|
21
22
|
- bin/gdk
|
22
|
-
- lib/
|
23
|
+
- lib/gitlab_development_kit.rb
|
23
24
|
homepage: https://gitlab.com/gitlab-org/gitlab-development-kit
|
24
25
|
licenses:
|
25
26
|
- MIT
|
26
27
|
metadata: {}
|
27
|
-
post_install_message:
|
28
|
+
post_install_message:
|
28
29
|
rdoc_options: []
|
29
30
|
require_paths:
|
30
31
|
- lib
|
31
32
|
required_ruby_version: !ruby/object:Gem::Requirement
|
32
33
|
requirements:
|
33
|
-
- - "
|
34
|
+
- - "~>"
|
34
35
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
36
|
+
version: 2.6.5
|
36
37
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
39
|
- - ">="
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
version: '0'
|
41
42
|
requirements: []
|
42
|
-
|
43
|
-
|
44
|
-
signing_key:
|
43
|
+
rubygems_version: 3.0.3
|
44
|
+
signing_key:
|
45
45
|
specification_version: 4
|
46
46
|
summary: CLI for GitLab Development Kit
|
47
47
|
test_files: []
|