Skip to content

Commit

Permalink
Make gdk a gem
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobvosmaer committed Aug 8, 2016
1 parent aba0448 commit 1362366
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@
/.gitlab-shell-bundle
/.gitlab-bundle
/gdk
/*.gem
Empty file added GDK_ROOT
Empty file.
12 changes: 6 additions & 6 deletions HELP
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# GitLab Development Kit cheat sheet

./gdk run # Start everything
./gdk run db # Start enough to run tests
./gdk run app # Start GitLab, need './run db'
gdk run # Start everything
gdk run db # Start enough to run tests
gdk run app # Start GitLab, needs 'gdk run db'

./gdk install gitlab_repo=https://my-fork # Install everything
./gdk update # Pull application changes from Git
./gdk reconfigure # Delete and regenerate all config files created by GDK
gdk install gitlab_repo=https://my-fork # Install everything
gdk update # Pull application changes from Git
gdk reconfigure # Delete and regenerate all config files created by GDK

# Development admin account: root / 5iveL!fe
30 changes: 30 additions & 0 deletions bin/gdk
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env ruby
require 'fileutils'

def main
case ARGV.first
when 'init'
system(*%W(git clone -b gdk-cli https://gitlab.com/gitlab-org/gitlab-development-kit.git))
else
$gdk_root = find_root(Dir.pwd)
if $gdk_root.nil?
puts "Could not find GDK_ROOT in the current directory or any of its parents."
return false
end
puts "(in #{$gdk_root})"
load(File.join($gdk_root, 'lib/gdk.rb'))
GDK::main
end
end

def find_root(current)
if File.exist?(File.join(current, 'GDK_ROOT'))
File.realpath(current)
elsif File.realpath(current) == '/'
nil
else
find_root(File.join(current, '..'))
end
end

exit(main)
24 changes: 0 additions & 24 deletions gdk.rb

This file was deleted.

15 changes: 15 additions & 0 deletions gitlab-development-kit.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# coding: utf-8

Gem::Specification.new do |spec|
spec.name = "gitlab-development-kit"
spec.version = '0.1.0'
spec.authors = ["Jacob Vosmaer"]
spec.email = ["[email protected]"]

spec.summary = %q{CLI for GitLab Development Kit}
spec.description = %q{CLI for GitLab Development Kit.}
spec.homepage = "https://gitlab.com/gitlab-org/gitlab-development-kit"
spec.license = "MIT"
spec.files = []
spec.executables = ['gdk']
end
22 changes: 22 additions & 0 deletions lib/gdk.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module GDK
PROGNAME = 'gdk'

def self.main
case ARGV.shift
when 'run'
system('./run', *ARGV, chdir: $gdk_root)
when 'install'
system('make', *ARGV, chdir: $gdk_root)
when 'update'
system('make', 'update', chdir: $gdk_root)
when 'reconfigure'
system('make', 'clean-config', 'all', chdir: $gdk_root)
when 'help'
puts File.read(File.join($gdk_root, 'HELP'))
true
else
puts "Usage: #{PROGNAME} run|init|install|update|reconfigure|help [ARGS...]"
false
end
end
end

0 comments on commit 1362366

Please sign in to comment.