gitlab-development-kit 0.2.7 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/gdk +33 -56
  3. data/lib/gitlab_development_kit.rb +2 -1
  4. metadata +20 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf613de53ce1d786cd089d946aea46954738e639f0866836b6bddc69e8f9d804
4
- data.tar.gz: f2f2481311a8e70c8ca803344b0383bfcbd24545f2fb13c7bde6203c79fd579b
3
+ metadata.gz: fce4dd74b2f32c9cbf4519336c9b731158cb34c5570d83805fbeff74aab2c209
4
+ data.tar.gz: 3b86852c3e15145a1c5c4617a05827cb4b9b7159be8c684107e0e85f57a389a2
5
5
  SHA512:
6
- metadata.gz: 508f5077dbb2195433259bb651fe70e42133160399435510b8a5af8bd9d526d802370eb8bab8ecb40b538a185c7911ccc5bf1a3639d9ca9e854741c9cc5dda93
7
- data.tar.gz: 4202049aecfdf6512e0dd7ee5140ec803cd8592b2ea32b6e81e29e113d0b81ed6d670eaee005b871564a718ac8028dd8fef69356d311338ad6fc81080ed2f9fd
6
+ metadata.gz: 245d0650689fca386f65d623fce71c5a6884b65faddd731daedb622b39fa3e7c2677218be24709bebe7d9e091dc89263fe5f8b0b4fd82e46a1beb8e125bea12a
7
+ data.tar.gz: 14c63e2ab27736a16e7356f4b39b65f125949447f38cab27f90b99249a340f2ad876293b536d3d12544c6e56a380ebd15668bf8e727ccaea51fdd4a20fc2bfce
data/bin/gdk CHANGED
@@ -13,21 +13,17 @@ 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
- DOTFILE = File.expand_path('~/.gdk.yml')
17
- TRUSTED_KEY = 'trusted_directories'
18
16
  ROOT_CHECK_FILE = '.gdk-install-root'
19
17
  DEFAULT_INIT_DIRECTORY = File.join(Dir.pwd, 'gitlab-development-kit')
20
18
 
21
- def self.launcher_main # rubocop:disable Metrics/CyclomaticComplexity
19
+ def self.launcher_main
22
20
  case ARGV.first
23
- when 'version'
24
- puts "GitLab Development Kit gem version #{GDK::GEM_VERSION}"
25
- true
26
21
  when 'init'
27
22
  if ARGV.count > 2 || (ARGV.count == 2 && (ARGV[1] == '-help' || ARGV[1] == '--help'))
28
23
  puts 'Usage: gdk init [DIR]'
29
24
  return false
30
25
  end
26
+
31
27
  directory = ARGV.count == 2 ? ARGV[1] : DEFAULT_INIT_DIRECTORY
32
28
  if directory.start_with?('-')
33
29
  warn <<~INVALID_GDK_DIR_NAME
@@ -36,46 +32,49 @@ module GDK
36
32
  INVALID_GDK_DIR_NAME
37
33
  return false
38
34
  end
35
+
39
36
  cmd = %W[git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git #{directory}]
40
- system(*cmd) && trust!(directory) && remember!(directory)
41
- when 'trust'
42
- if ARGV.count != 2
43
- puts 'Usage: gdk trust DIR'
44
- return false
45
- end
46
- trust!(ARGV[1])
37
+ system(*cmd) && remember!(directory)
47
38
  else
48
- # rubocop:disable Style/GlobalVars
49
- $gdk_root = find_root(Dir.pwd)
50
- if $gdk_root.nil?
51
- warn <<~NOT_A_GDK_DIR
39
+ if print_version?
40
+ puts VERSION
52
41
 
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'.
42
+ return true
43
+ end
56
44
 
57
- gdk init [DIRECTORY] # Default: #{DEFAULT_INIT_DIRECTORY}
45
+ unless gdk_dir?
46
+ warn_not_gdk_dir
58
47
 
59
- NOT_A_GDK_DIR
60
48
  return false
61
49
  end
62
50
 
63
- unless trusted?($gdk_root)
64
- warn <<~NOT_A_TRUSTED_GDK_DIR
51
+ load(File.join(gdk_root, 'lib/gdk.rb'))
52
+ GDK.main
53
+ end
54
+ end
55
+
56
+ def self.warn_not_gdk_dir
57
+ warn <<~NOT_A_GDK_DIR
65
58
 
66
- This GitLab Development Kit root directory is not known to the "gdk"
67
- command. To mark it as trusted run:
59
+ The current working directory is not inside a gitlab-development-kit
60
+ installation. Use 'cd' to go to your gitlab-development-kit or create
61
+ a new one with 'gdk init'.
68
62
 
69
- gdk trust #{$gdk_root}
63
+ gdk init [DIRECTORY] # Default: #{DEFAULT_INIT_DIRECTORY}
70
64
 
71
- NOT_A_TRUSTED_GDK_DIR
72
- return false
73
- end
65
+ NOT_A_GDK_DIR
66
+ end
74
67
 
75
- load(File.join($gdk_root, 'lib/gdk.rb'))
76
- # rubocop:enable Style/GlobalVars
77
- GDK.main
78
- end
68
+ def self.gdk_root
69
+ @gdk_root ||= find_root(Dir.pwd)
70
+ end
71
+
72
+ def self.gdk_dir?
73
+ !gdk_root.nil?
74
+ end
75
+
76
+ def self.print_version?
77
+ %w[version --version].include?(ARGV.first) && !gdk_dir?
79
78
  end
80
79
 
81
80
  def self.find_root(current)
@@ -88,28 +87,6 @@ module GDK
88
87
  end
89
88
  end
90
89
 
91
- def self.trusted?(directory)
92
- trusted_directories = load_dotfile[TRUSTED_KEY] || []
93
- !!trusted_directories.include?(File.realpath(directory))
94
- end
95
-
96
- def self.trust!(directory)
97
- directory = File.realpath(directory)
98
- config = load_dotfile
99
- config[TRUSTED_KEY] ||= []
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
-
110
- true
111
- end
112
-
113
90
  def self.load_dotfile
114
91
  File.open(DOTFILE, File::RDONLY | File::CREAT) do |f|
115
92
  YAML.safe_load(f)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GDK
4
- GEM_VERSION = '0.2.7'
4
+ GEM_VERSION = '0.2.12'
5
+ VERSION = "GitLab Development Kit #{GEM_VERSION}"
5
6
  end
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.7
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Vosmaer
@@ -9,8 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-06-18 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2021-04-23 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'
14
28
  description: CLI for GitLab Development Kit.
15
29
  email:
16
30
  - gitlab_rubygems@gitlab.com
@@ -31,16 +45,16 @@ require_paths:
31
45
  - lib
32
46
  required_ruby_version: !ruby/object:Gem::Requirement
33
47
  requirements:
34
- - - "~>"
48
+ - - ">="
35
49
  - !ruby/object:Gem::Version
36
- version: 2.6.5
50
+ version: 2.7.2
37
51
  required_rubygems_version: !ruby/object:Gem::Requirement
38
52
  requirements:
39
53
  - - ">="
40
54
  - !ruby/object:Gem::Version
41
55
  version: '0'
42
56
  requirements: []
43
- rubygems_version: 3.0.3
57
+ rubygems_version: 3.1.4
44
58
  signing_key:
45
59
  specification_version: 4
46
60
  summary: CLI for GitLab Development Kit