gitlab-development-kit 0.2.12 → 0.2.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gdk +101 -64
- data/lib/gitlab_development_kit.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ea455a9185d9a48272280448034af98ee051740756dea1ed6545cec557fc957
|
4
|
+
data.tar.gz: 520cd43ae500977adade2d5bcf7d10ee09326c3ac56e8ec7a9b510ef8f0ef94b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c98398310d0c1eeda0d851dfded10ec22745e156b1550d7ad9a888eef399f37eede40f3e2a2f88963f756e2eac27fcc2af078959d27f7d93f43f92bb96c0245
|
7
|
+
data.tar.gz: 27c139a2d76cd03446c11e3c7bf0d071cfc5216ec28bb41d79faeef9e97acbc3b5ecb23a964480948f7fe0bf64622ae273a5683cfc35d344383d3947f0aefe0d
|
data/bin/gdk
CHANGED
@@ -13,95 +13,132 @@ require 'gitlab_development_kit'
|
|
13
13
|
# installed outside the gitlab-development-kit repository with 'gem
|
14
14
|
# install'. Edit lib/gdk.rb to define new commands.
|
15
15
|
module GDK
|
16
|
+
# TODO: Touching .gdk-install-root will be redundant shortly.
|
16
17
|
ROOT_CHECK_FILE = '.gdk-install-root'
|
17
18
|
DEFAULT_INIT_DIRECTORY = File.join(Dir.pwd, 'gitlab-development-kit')
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
puts 'Usage: gdk init [DIR]'
|
24
|
-
return false
|
20
|
+
module CommandBasic
|
21
|
+
class Main
|
22
|
+
def initialize(args)
|
23
|
+
@args = args
|
25
24
|
end
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
def run
|
27
|
+
return GDK::CommandBasic::Version.new.run if gdk_version?
|
28
|
+
return GDK::CommandBasic::Init.new(args[1..]).run if gdk_init?
|
29
|
+
|
30
|
+
if gdk_dir?
|
31
|
+
require(File.join(gdk_root, 'lib/gdk.rb'))
|
32
|
+
GDK.main
|
33
|
+
else
|
34
|
+
warn_not_gdk_dir
|
35
|
+
false
|
36
|
+
end
|
34
37
|
end
|
35
38
|
|
36
|
-
|
37
|
-
system(*cmd) && remember!(directory)
|
38
|
-
else
|
39
|
-
if print_version?
|
40
|
-
puts VERSION
|
39
|
+
private
|
41
40
|
|
42
|
-
|
41
|
+
attr_reader :args
|
42
|
+
|
43
|
+
def warn_not_gdk_dir
|
44
|
+
warn <<~NOT_A_GDK_DIR
|
45
|
+
|
46
|
+
The current working directory is not inside a gitlab-development-kit
|
47
|
+
installation. Use 'cd' to go to your gitlab-development-kit or create
|
48
|
+
a new one with 'gdk init'.
|
49
|
+
|
50
|
+
gdk init [DIRECTORY] # Default: #{DEFAULT_INIT_DIRECTORY}
|
51
|
+
|
52
|
+
NOT_A_GDK_DIR
|
43
53
|
end
|
44
54
|
|
45
|
-
|
46
|
-
|
55
|
+
def gdk_root
|
56
|
+
@gdk_root ||= find_root(Dir.pwd)
|
57
|
+
end
|
58
|
+
|
59
|
+
def gdk_dir?
|
60
|
+
!gdk_root.nil?
|
61
|
+
end
|
47
62
|
|
48
|
-
|
63
|
+
def gdk_version?
|
64
|
+
# If gdk_dir? == true, fall through to allow lib/gdk.rb to handle
|
65
|
+
%w[version --version].include?(args.first) && !gdk_dir?
|
49
66
|
end
|
50
67
|
|
51
|
-
|
52
|
-
|
68
|
+
def gdk_init?
|
69
|
+
args.first == 'init'
|
70
|
+
end
|
71
|
+
|
72
|
+
def find_root(current)
|
73
|
+
if File.exist?(File.join(current, 'GDK_ROOT'))
|
74
|
+
File.realpath(current)
|
75
|
+
elsif File.realpath(current) == '/'
|
76
|
+
nil
|
77
|
+
else
|
78
|
+
find_root(File.join(current, '..'))
|
79
|
+
end
|
80
|
+
end
|
53
81
|
end
|
54
|
-
end
|
55
82
|
|
56
|
-
|
57
|
-
|
83
|
+
class Version
|
84
|
+
def run
|
85
|
+
puts GDK::VERSION
|
86
|
+
true
|
87
|
+
end
|
88
|
+
end
|
58
89
|
|
59
|
-
|
60
|
-
|
61
|
-
|
90
|
+
class Init
|
91
|
+
def initialize(args)
|
92
|
+
@args = args
|
93
|
+
end
|
62
94
|
|
63
|
-
|
95
|
+
def run
|
96
|
+
warn("INFO: 'gdk init' is deprecated and will be removed in a future update.")
|
64
97
|
|
65
|
-
|
66
|
-
|
98
|
+
if show_help?
|
99
|
+
puts('Usage: gdk init [DIR]')
|
67
100
|
|
68
|
-
|
69
|
-
|
70
|
-
end
|
101
|
+
return true
|
102
|
+
end
|
71
103
|
|
72
|
-
|
73
|
-
|
74
|
-
|
104
|
+
directory = new_gdk_directory
|
105
|
+
if new_gdk_directory_invalid?(directory)
|
106
|
+
warn("ERROR: The proposed new GDK directory '#{directory}' is invalid because it begins with a dash.")
|
75
107
|
|
76
|
-
|
77
|
-
|
78
|
-
end
|
108
|
+
return false
|
109
|
+
end
|
79
110
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
111
|
+
if clone_gdk(directory)
|
112
|
+
puts("INFO: Successfully git cloned the GDK into '#{directory}'.")
|
113
|
+
true
|
114
|
+
else
|
115
|
+
warn("ERROR: An error occurred while attempting to git clone the GDK into '#{directory}'.")
|
116
|
+
false
|
117
|
+
end
|
118
|
+
end
|
89
119
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
end || {}
|
94
|
-
end
|
120
|
+
private
|
121
|
+
|
122
|
+
attr_reader :args
|
95
123
|
|
96
|
-
|
97
|
-
|
98
|
-
|
124
|
+
def show_help?
|
125
|
+
args.count > 1 || (args & %w[-help --help]).any?
|
126
|
+
end
|
127
|
+
|
128
|
+
def new_gdk_directory_invalid?(directory)
|
129
|
+
directory.start_with?('-')
|
130
|
+
end
|
131
|
+
|
132
|
+
def new_gdk_directory
|
133
|
+
args.count == 1 ? args.first : GDK::DEFAULT_INIT_DIRECTORY
|
134
|
+
end
|
135
|
+
|
136
|
+
def clone_gdk(directory)
|
137
|
+
cmd = "git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git #{directory}"
|
138
|
+
system(*cmd)
|
139
|
+
end
|
99
140
|
end
|
100
|
-
true
|
101
|
-
rescue StandardError => e
|
102
|
-
warn e
|
103
|
-
false
|
104
141
|
end
|
105
142
|
end
|
106
143
|
|
107
|
-
exit(GDK.
|
144
|
+
exit(GDK::CommandBasic::Main.new(ARGV).run)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Vosmaer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-06-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|