Sha256: 03cf366828eaba86baca4199ec43d44517e0fad7963796ad3a1a661c28af9b88
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
#!/usr/bin/env ruby require "bundler" Bundler.setup(:default) require "ginatra" require "logger" def logger return @logger if @logger @logger = Logger.new(STDOUT) @logger.level = Logger::INFO @logger.formatter = Proc.new {|s, t, n, msg| "[#{t}] #{msg}\n"} @logger end module Ginatra::Directory HELP = <<HELP Usage: ginatra-directory [ list | add <globs> | remove <globs> ] Commands: add - Adds the <globs> to the array of dirs that Ginatra looks in for repositories. remove - Removes the <globs> from the aforementioned array. list - Lists the globs Ginatra looks in for repositories HELP def self.add(globs) Ginatra::Config.load! Ginatra::Config[:git_dirs] += globs logger.info "Added #{globs.join(" ")} to your config" Ginatra::Config.dump! end def self.remove(globs) Ginatra::Config.load! globs.each do |glob| Ginatra::Config[:git_dirs].delete(glob) end logger.info "Removed #{globs.join(" ")} from your config" Ginatra::Config.dump! end def self.list(args) Ginatra::Config.load! puts "Directories Ginatra will look for repos in:" puts Ginatra::Config[:git_dirs].map{|r| " - #{r}"}.join("\n") puts "" end end command, args = ARGV[0], ARGV[1..-1] if command !~ /^(add|remove|list)$/ puts Ginatra::Directory::HELP else Ginatra::Directory.send(command, args) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ginatra-2.2.6 | bin/ginatra-directory |
ginatra-2.2.5 | bin/ginatra-directory |