Module: Gitcloudcli
- Defined in:
- lib/gitcloudcli.rb,
lib/gitcloudcli/version.rb,
lib/gitcloudcli/command/space.rb,
lib/gitcloudcli/command/config.rb,
lib/gitcloudcli/command/git/git.rb,
lib/gitcloudcli/command/git/gitee.rb,
lib/gitcloudcli/command/git/github.rb,
lib/gitcloudcli/command/git/gitlab.rb
Defined Under Namespace
Classes: Cli, CloudSpace, Git, Gitee, Github
Constant Summary
collapse
- VERSION =
"1.0.1"
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.configCover(configs) ⇒ Object
22
23
24
|
# File 'lib/gitcloudcli/command/config.rb', line 22
def configCover(configs)
YAML.dump(configs, Gitcloudcli.configFile("w"))
end
|
.configFile(model = "r") ⇒ Object
5
6
7
8
9
10
11
12
|
# File 'lib/gitcloudcli/command/config.rb', line 5
def configFile(model="r")
yaml_dir = Dir.home + "/.gitcloud"
yaml_name = "gitcloud.yaml"
if !Dir.exist?(yaml_dir)
Dir.mkdir(yaml_dir)
end
file = File.open(yaml_dir + "/#{yaml_name}", model)
end
|
.configHash ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/gitcloudcli/command/config.rb', line 14
def configHash
configs = YAML.load(Gitcloudcli.configFile("r"))
if !configs
configs = {}
end
return configs
end
|
.gitadapter(space = nil) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/gitcloudcli/command/config.rb', line 30
def gitadapter(space=nil)
remote = nil
token = nil
configHash.each do |key, value|
if space
if key==space
remote = value["remote"]
token = value["token"]
break
end
else
puts "space为空,默认使用#{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 "#{remote} 不支持"
end
else
puts "#{space} 不不存在"
end
end
|
Instance Method Details
#configModels ⇒ Object
26
27
28
|
# File 'lib/gitcloudcli/command/config.rb', line 26
def configModels
configs = Gitcloudcli.configHash
end
|