Sha256: abab31dd8adc4fc170531a2803f2475b6ef64792a08cbb508545704483bdc257
Contents?: true
Size: 1.43 KB
Versions: 5
Compression:
Stored size: 1.43 KB
Contents
#!/usr/bin/env ruby current_path = File.expand_path(File.dirname(__FILE__)) require "#{current_path}/../lib/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 Ginatra::Config[:git_dirs].flatten 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 exit end Ginatra::Directory.send(command, *args)
Version data entries
5 entries across 5 versions & 2 rubygems
Version | Path |
---|---|
lenary-ginatra-2.0.2 | bin/ginatra-directory |
ginatra-2.1.1 | bin/ginatra-directory |
ginatra-2.1.0 | bin/ginatra-directory |
ginatra-2.0.2 | bin/ginatra-directory |
ginatra-2.0.1 | bin/ginatra-directory |