gitlab-development-kit 0.2.4 → 0.2.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c08724cade5596b519cec789c57fd78a3768eb6
4
- data.tar.gz: 789b3739455ef0bb09656a197a26fd47699d2432
3
+ metadata.gz: ff26cd3455867518a1a5643f5281284d9cfe147e
4
+ data.tar.gz: 9b8cacd504980b0fbbff5319cac052ca824301d0
5
5
  SHA512:
6
- metadata.gz: 3455fc72970248142aa5f22dd79ad70fb3a1ef42a5d355824e51a3b42f5e1ef930f3f1cb572859f2279091a79e711d9782992f310ec768cd316983a4d3f1eb8c
7
- data.tar.gz: 96d32477fa3318284c1c861968c8da11d4c4d542789ebac88cd323d1c7ed9a8339d825c8d1fcb676b36694bf0b53544e081abd4ebf33e6e9c4ddd53703e3287f
6
+ metadata.gz: ab29297020e74599b09f296668f90df91b731032ecc8b631b165697f1fac45b49fe4bed091811eb21c431c3005b2038c0f5d864aa50d4f36b62cb175da2fdcbb
7
+ data.tar.gz: 61059b81659b30929b50f0ba63223bbdec36cc1cdb80ca1e7b629eb16a324de4d6bdd7ccc7dae0e8db395e10e58bc75eaeaa7d7be75f8a228344f82c819ca54f
data/bin/gdk CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'yaml'
3
3
 
4
- $:.unshift(File.expand_path('../../lib', __FILE__))
5
- require 'gitlab-development-kit'
4
+ $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
5
+ require 'gitlab_development_kit'
6
6
 
7
7
  # Gitlab Development Kit CLI launcher
8
8
  #
@@ -12,8 +12,8 @@ require 'gitlab-development-kit'
12
12
 
13
13
  module GDK
14
14
  DOTFILE = File.expand_path('~/.gdk.yml')
15
- TRUSTED_KEY = 'trusted_directories'
16
- ROOT_CHECK_FILE = '.gdk-install-root'
15
+ TRUSTED_KEY = 'trusted_directories'.freeze
16
+ ROOT_CHECK_FILE = '.gdk-install-root'.freeze
17
17
  DEFAULT_INIT_DIRECTORY = File.join(Dir.pwd, 'gitlab-development-kit')
18
18
 
19
19
  def self.launcher_main
@@ -22,12 +22,19 @@ module GDK
22
22
  puts "GitLab Development Kit gem version #{GDK::GEM_VERSION}"
23
23
  true
24
24
  when 'init'
25
- if ARGV.count > 2
25
+ if ARGV.count > 2 || (ARGV.count == 2 && (ARGV[1] == "-help" || ARGV[1] == "--help"))
26
26
  puts "Usage: gdk init [DIR]"
27
27
  return false
28
28
  end
29
29
  directory = ARGV.count == 2 ? ARGV[1] : DEFAULT_INIT_DIRECTORY
30
- cmd = %W(git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git #{directory})
30
+ if directory.start_with?('-')
31
+ puts <<-EOS.gsub(/^\s+\|/, '')
32
+ |The gdk directory cannot start with a dash ('-'). Did you mean:
33
+ |gdk init #{directory.sub(/^-+/,'')}
34
+ EOS
35
+ return false
36
+ end
37
+ cmd = %W[git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git #{directory}]
31
38
  system(*cmd) && trust!(directory) && remember!(directory)
32
39
  when 'trust'
33
40
  if ARGV.count != 2
@@ -49,9 +56,9 @@ module GDK
49
56
  EOS
50
57
  return false
51
58
  end
52
- puts "(in #{$gdk_root})"
59
+ warn "(in #{$gdk_root})"
53
60
 
54
- if !trusted?($gdk_root)
61
+ unless trusted?($gdk_root)
55
62
  puts <<-EOS.gsub(/^\s+\|/, '')
56
63
  |
57
64
  |This GitLab Development Kit root directory is not known to the "gdk"
@@ -64,12 +71,10 @@ module GDK
64
71
  end
65
72
 
66
73
  load(File.join($gdk_root, 'lib/gdk.rb'))
67
- GDK::main
74
+ GDK.main
68
75
  end
69
76
  end
70
77
 
71
- private
72
-
73
78
  def self.find_root(current)
74
79
  if File.exist?(File.join(current, 'GDK_ROOT'))
75
80
  File.realpath(current)
@@ -84,19 +89,26 @@ module GDK
84
89
  trusted_directories = load_dotfile[TRUSTED_KEY] || []
85
90
  !!trusted_directories.include?(File.realpath(directory))
86
91
  end
87
-
92
+
88
93
  def self.trust!(directory)
89
94
  directory = File.realpath(directory)
90
95
  config = load_dotfile
91
96
  config[TRUSTED_KEY] ||= []
92
- config[TRUSTED_KEY] << directory
93
- puts "Adding #{directory} to #{TRUSTED_KEY} in #{DOTFILE}"
94
- File.open(DOTFILE, 'w') { |f| YAML.dump(config, f) }
97
+
98
+ if config[TRUSTED_KEY].include?(directory)
99
+ puts "#{directory} is already in #{TRUSTED_KEY} in #{DOTFILE}"
100
+ else
101
+ config[TRUSTED_KEY] << directory
102
+ config[TRUSTED_KEY].uniq!
103
+ puts "Adding #{directory} to #{TRUSTED_KEY} in #{DOTFILE}"
104
+ File.open(DOTFILE, 'w') { |f| YAML.dump(config, f) }
105
+ end
106
+
95
107
  true
96
108
  end
97
109
 
98
110
  def self.load_dotfile
99
- File.open(DOTFILE, File::RDONLY | File::CREAT) { |f| YAML.load(f) } || {}
111
+ File.open(DOTFILE, File::RDONLY | File::CREAT) { |f| YAML.safe_load(f) } || {}
100
112
  end
101
113
 
102
114
  def self.remember!(directory)
@@ -110,4 +122,4 @@ module GDK
110
122
  end
111
123
  end
112
124
 
113
- exit(GDK::launcher_main)
125
+ exit(GDK.launcher_main)
@@ -0,0 +1,3 @@
1
+ module GDK
2
+ GEM_VERSION = '0.2.5'.freeze
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-development-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Vosmaer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-04 00:00:00.000000000 Z
11
+ date: 2018-10-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: CLI for GitLab Development Kit.
14
14
  email:
@@ -19,7 +19,7 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - bin/gdk
22
- - lib/gitlab-development-kit.rb
22
+ - lib/gitlab_development_kit.rb
23
23
  homepage: https://gitlab.com/gitlab-org/gitlab-development-kit
24
24
  licenses:
25
25
  - MIT
@@ -40,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
40
  version: '0'
41
41
  requirements: []
42
42
  rubyforge_project:
43
- rubygems_version: 2.5.1
43
+ rubygems_version: 2.5.2
44
44
  signing_key:
45
45
  specification_version: 4
46
46
  summary: CLI for GitLab Development Kit
@@ -1,3 +0,0 @@
1
- module GDK
2
- GEM_VERSION = '0.2.4'
3
- end