module Gitcloudcli
Constants
- VERSION
Public Class Methods
configCover(configs)
click to toggle source
# File lib/gitcloudcli/command/config.rb, line 26 def configCover(configs) YAML.dump(configs, Gitcloudcli.configFile("w")) end
configFile(model="r")
click to toggle source
# File lib/gitcloudcli/command/config.rb, line 5 def configFile(model="r") yaml_dir = Dir.home + "/.gitcloudcli" yaml_name = "gitcloud.yaml" yaml_path = yaml_dir + "/#{yaml_name}" if !Dir.exist?(yaml_dir) Dir.mkdir(yaml_dir) end if !File.exist? yaml_path File.open(yaml_path, 'w').close end file = File.open(yaml_path, model) end
configHash()
click to toggle source
# File lib/gitcloudcli/command/config.rb, line 18 def configHash configs = YAML.load(Gitcloudcli.configFile("r")) if !configs configs = {} end return configs end
gitadapter(space=nil) { |github| ... }
click to toggle source
# File lib/gitcloudcli/command/config.rb, line 34 def gitadapter(space=nil) remote = nil token = nil configHash.each do |key, value| if space if key==space remote = value["remote"] token = value["token"] space = key break end else puts "SPACE is null,use default #{key}" remote = value["remote"] token = value["token"] break end end if remote if remote.to_s.include? "github.com" yield Gitcloudcli::Github.new(remote, token) else puts "#{space} #{remote} not supported" end else puts "git space is empty" end end
Public Instance Methods
configModels()
click to toggle source
# File lib/gitcloudcli/command/config.rb, line 30 def configModels configs = Gitcloudcli.configHash end
Private Instance Methods
configCover(configs)
click to toggle source
# File lib/gitcloudcli/command/config.rb, line 26 def configCover(configs) YAML.dump(configs, Gitcloudcli.configFile("w")) end
configFile(model="r")
click to toggle source
# File lib/gitcloudcli/command/config.rb, line 5 def configFile(model="r") yaml_dir = Dir.home + "/.gitcloudcli" yaml_name = "gitcloud.yaml" yaml_path = yaml_dir + "/#{yaml_name}" if !Dir.exist?(yaml_dir) Dir.mkdir(yaml_dir) end if !File.exist? yaml_path File.open(yaml_path, 'w').close end file = File.open(yaml_path, model) end
configHash()
click to toggle source
# File lib/gitcloudcli/command/config.rb, line 18 def configHash configs = YAML.load(Gitcloudcli.configFile("r")) if !configs configs = {} end return configs end
gitadapter(space=nil) { |github| ... }
click to toggle source
# File lib/gitcloudcli/command/config.rb, line 34 def gitadapter(space=nil) remote = nil token = nil configHash.each do |key, value| if space if key==space remote = value["remote"] token = value["token"] space = key break end else puts "SPACE is null,use default #{key}" remote = value["remote"] token = value["token"] break end end if remote if remote.to_s.include? "github.com" yield Gitcloudcli::Github.new(remote, token) else puts "#{space} #{remote} not supported" end else puts "git space is empty" end end