gitcloudcli 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +22 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/gitcloud +3 -0
- data/bin/setup +8 -0
- data/gitcloudcli.gemspec +30 -0
- data/lib/gitcloudcli/command/config.rb +60 -0
- data/lib/gitcloudcli/command/git/git.rb +48 -0
- data/lib/gitcloudcli/command/git/gitee.rb +7 -0
- data/lib/gitcloudcli/command/git/github.rb +94 -0
- data/lib/gitcloudcli/command/git/gitlab.rb +7 -0
- data/lib/gitcloudcli/command/space.rb +40 -0
- data/lib/gitcloudcli/version.rb +3 -0
- data/lib/gitcloudcli.rb +51 -0
- metadata +162 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3b3c0dc7ecf716006a92a68aff0ee5259e4063aff1335bf379fba56b7a927d38
|
4
|
+
data.tar.gz: '0990893c80c7b13931f32323f8cb6389ea4049c0ebc6a8159a66939a68711021'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1f0e1ab5aa2159c2893b866a4b62f9eb04329617878c1bd9fc7839d64da9858fe3cf8b60acf7a781cb8a7c55aa1f00db7dfdb9d0c8ad3fdec4ee79476c654316
|
7
|
+
data.tar.gz: 37ffdbb87fb91c98231de774caf35a1dab370ff14b343165f775f7dc5a2edf67420cf3ecfef854316fd613caf3ec535463c73b529389b1abf3518ba6b8f99094
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at onethousandpiece@126.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
gitcloudcli (1.0.0)
|
5
|
+
thor
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
rake (10.5.0)
|
11
|
+
thor (0.20.3)
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
ruby
|
15
|
+
|
16
|
+
DEPENDENCIES
|
17
|
+
bundler (~> 1.7)
|
18
|
+
gitcloudcli!
|
19
|
+
rake (~> 10.0)
|
20
|
+
|
21
|
+
BUNDLED WITH
|
22
|
+
1.17.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 zhangheng
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Gitcloudcli
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gitcloudcli`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'gitcloudcli'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install gitcloudcli
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gitcloudcli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the Gitcloudcli project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/gitcloudcli/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "gitcloudcli"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/gitcloud
ADDED
data/bin/setup
ADDED
data/gitcloudcli.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "gitcloudcli/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gitcloudcli"
|
8
|
+
spec.version = Gitcloudcli::VERSION
|
9
|
+
spec.authors = ["zhangheng"]
|
10
|
+
spec.email = ["onethousandpiece@126.com"]
|
11
|
+
|
12
|
+
spec.summary = "Git场库文件操作"
|
13
|
+
spec.description = "Git场库文件操作。增删改查操作"
|
14
|
+
spec.homepage = "https://github.com/monkeyheng/GitCloudCLI"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = ["gitcloud"]
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
|
25
|
+
spec.add_dependency "thor"
|
26
|
+
spec.add_dependency "json"
|
27
|
+
spec.add_dependency "base64"
|
28
|
+
spec.add_dependency "net/http"
|
29
|
+
spec.add_dependency "yaml"
|
30
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "gitcloudcli/command/git/github"
|
3
|
+
|
4
|
+
module Gitcloudcli
|
5
|
+
def configFile(model="r")
|
6
|
+
yaml_dir = Dir.home + "/.gitcloud"
|
7
|
+
yaml_name = "gitcloud.yaml"
|
8
|
+
if !Dir.exist?(yaml_dir)
|
9
|
+
Dir.mkdir(yaml_dir)
|
10
|
+
end
|
11
|
+
file = File.open(yaml_dir + "/#{yaml_name}", model)
|
12
|
+
end
|
13
|
+
|
14
|
+
def configHash
|
15
|
+
configs = YAML.load(Gitcloudcli.configFile("r"))
|
16
|
+
if !configs
|
17
|
+
configs = {}
|
18
|
+
end
|
19
|
+
return configs
|
20
|
+
end
|
21
|
+
|
22
|
+
def configCover(configs)
|
23
|
+
YAML.dump(configs, Gitcloudcli.configFile("w"))
|
24
|
+
end
|
25
|
+
|
26
|
+
def configModels
|
27
|
+
configs = Gitcloudcli.configHash
|
28
|
+
end
|
29
|
+
|
30
|
+
def gitadapter(space=nil)
|
31
|
+
remote = nil
|
32
|
+
token = nil
|
33
|
+
configHash.each do |key, value|
|
34
|
+
if space
|
35
|
+
if key==space
|
36
|
+
remote = value["remote"]
|
37
|
+
token = value["token"]
|
38
|
+
break
|
39
|
+
end
|
40
|
+
else
|
41
|
+
puts "space为空,默认使用#{key}"
|
42
|
+
remote = value["remote"]
|
43
|
+
token = value["token"]
|
44
|
+
break
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
if remote
|
49
|
+
if remote.to_s.include? "github.com"
|
50
|
+
yield Gitcloudcli::Github.new(remote, token)
|
51
|
+
else
|
52
|
+
puts "#{remote} 不支持"
|
53
|
+
end
|
54
|
+
else
|
55
|
+
puts "#{space} 不不存在"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
module_function :configFile, :configCover, :configHash, :gitadapter
|
60
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "net/http"
|
2
|
+
|
3
|
+
module Gitcloudcli
|
4
|
+
class Git
|
5
|
+
|
6
|
+
def list(dir=nil, infos=[]) end
|
7
|
+
|
8
|
+
def info(remote_path, infos=[]) end
|
9
|
+
|
10
|
+
def upload(local_path, filename=nil, message=nil, infos=[]) end
|
11
|
+
|
12
|
+
def delete(remote_path, message=nil) end
|
13
|
+
|
14
|
+
def request(method, urlStr, header, formdata, body)
|
15
|
+
if urlStr
|
16
|
+
uri = URI.parse(URI.encode(urlStr))
|
17
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
18
|
+
http.use_ssl = true
|
19
|
+
else
|
20
|
+
raise "urlStr not give"
|
21
|
+
end
|
22
|
+
|
23
|
+
if !header
|
24
|
+
header={}
|
25
|
+
end
|
26
|
+
|
27
|
+
if method==:GET
|
28
|
+
request = Net::HTTP::Get.new(uri.request_uri, header)
|
29
|
+
elsif method==:POST
|
30
|
+
request = Net::HTTP::Post.new(uri.request_uri, header)
|
31
|
+
elsif method==:PUT
|
32
|
+
request = Net::HTTP::Put.new(uri.request_uri, header)
|
33
|
+
elsif method==:DELETE
|
34
|
+
request = Net::HTTP::Delete.new(uri.request_uri, header)
|
35
|
+
else
|
36
|
+
raise "unsuppose method #{method}"
|
37
|
+
end
|
38
|
+
|
39
|
+
if body
|
40
|
+
request.body = body
|
41
|
+
end
|
42
|
+
if formdata
|
43
|
+
request.form_data = formdata
|
44
|
+
end
|
45
|
+
response = http.request(request)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require "gitcloudcli/command/git/git"
|
2
|
+
require 'base64'
|
3
|
+
require "json"
|
4
|
+
require "net/http"
|
5
|
+
|
6
|
+
module Gitcloudcli
|
7
|
+
class Github < Git
|
8
|
+
def initialize(url, token)
|
9
|
+
uri = URI::parse(url)
|
10
|
+
result = uri.path.to_s.split("/")
|
11
|
+
@username=result[1]
|
12
|
+
@repo=result[2].to_s.split(".")[0]
|
13
|
+
@token=token
|
14
|
+
end
|
15
|
+
|
16
|
+
def list(dir, infos=[])
|
17
|
+
_dir = dir ? dir: ""
|
18
|
+
response = request(:GET, "https://api.github.com/repos/#{@username}/#{@repo}/contents/#{_dir}", nil, nil, nil)
|
19
|
+
if response.code != "200"
|
20
|
+
puts "查询失败 #{dir} #{response.code} #{response.body}"
|
21
|
+
elsif block_given?
|
22
|
+
yield JSON.parse(response.body)
|
23
|
+
else
|
24
|
+
result = JSON.parse(response.body)
|
25
|
+
result.each do |value|
|
26
|
+
puts "每个文件的信息 #{value.keys}"
|
27
|
+
break
|
28
|
+
end
|
29
|
+
result.each do |value|
|
30
|
+
if value["type"]=="dir"
|
31
|
+
puts "#{value["name"]}/ #{value.values_at(*infos)}"
|
32
|
+
else
|
33
|
+
puts "#{value["name"]} #{value["download_url"]} #{value.values_at(*infos)}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def info(remote_path, infos=[])
|
40
|
+
response = request(:GET, "https://api.github.com/repos/#{@username}/#{@repo}/contents/#{remote_path}",nil, nil, nil)
|
41
|
+
if response.code!="200"
|
42
|
+
puts "查询失败 #{remote_path} #{response.code} #{response.body}"
|
43
|
+
elsif block_given?
|
44
|
+
yield JSON.parse(response.body)
|
45
|
+
else
|
46
|
+
result = JSON.parse(response.body)
|
47
|
+
puts "#{result["name"]} #{result["download_url"]}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def upload(local_path, path=nil, message=nil, infos=[])
|
52
|
+
file = open(local_path)
|
53
|
+
content = Base64.encode64(file.read)
|
54
|
+
path = path ? path : local_path.to_s.split("/").last
|
55
|
+
message = message ? message : "upload #{path}"
|
56
|
+
paramters={
|
57
|
+
"content" => content,
|
58
|
+
"message" => message
|
59
|
+
}
|
60
|
+
response = request(:PUT, "https://api.github.com/repos/#{@username}/#{@repo}/contents/#{path}?access_token=#{@token}", {"Content-Type" => "text/json"}, nil ,paramters.to_json)
|
61
|
+
if response.code=="201"
|
62
|
+
result = JSON.parse(response.body)
|
63
|
+
puts "上传成功:#{path} #{local_path}"
|
64
|
+
result["content"].each do |key, value|
|
65
|
+
if infos and infos.length > 0
|
66
|
+
if infos.include? key
|
67
|
+
puts "#{key}: #{value}"
|
68
|
+
end
|
69
|
+
else
|
70
|
+
puts "#{key}: #{value}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
else
|
74
|
+
puts "上传失败 #{response.code} #{response.body}"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def delete(remote_path, message=nil)
|
79
|
+
info(remote_path) do |value|
|
80
|
+
sha=value["sha"]
|
81
|
+
paramters={
|
82
|
+
"sha" => sha,
|
83
|
+
"message" => message ? message : "remove #{remote_path}"
|
84
|
+
}
|
85
|
+
response = request(:DELETE, "https://api.github.com/repos/#{@username}/#{@repo}/contents/#{remote_path}?access_token=#{@token}", {"Content-Type" => "text/json"}, nil ,paramters.to_json)
|
86
|
+
if response.code!="200"
|
87
|
+
puts "删除失败 #{response.code} #{response.body}"
|
88
|
+
else
|
89
|
+
puts "删除 #{remote_path} 成功"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "gitcloudcli/command/config"
|
3
|
+
|
4
|
+
module Gitcloudcli
|
5
|
+
# 空间操作
|
6
|
+
class CloudSpace < Thor
|
7
|
+
desc "list", "列出当前的Git空间"
|
8
|
+
def list
|
9
|
+
configs = Gitcloudcli.configHash
|
10
|
+
configs.each do |key|
|
11
|
+
puts "#{key[0]} #{key[1]["remote"]}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "add NAME URL TOKEN", "添加Git空间"
|
16
|
+
def add(name, url, token)
|
17
|
+
configs = Gitcloudcli.configHash
|
18
|
+
if configs[name]
|
19
|
+
puts "#{name} 已经存在"
|
20
|
+
return
|
21
|
+
end
|
22
|
+
configs[name] = {
|
23
|
+
"remote"=>url,
|
24
|
+
"token"=>token
|
25
|
+
}
|
26
|
+
Gitcloudcli.configCover(configs)
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "remove NAME", "删除Git空间"
|
30
|
+
def remove(name)
|
31
|
+
configs = Gitcloudcli.configHash
|
32
|
+
if !configs[name]
|
33
|
+
puts "#{name} 不存在"
|
34
|
+
return
|
35
|
+
end
|
36
|
+
configs.delete(name)
|
37
|
+
Gitcloudcli.configCover(configs)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/gitcloudcli.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require "gitcloudcli/version"
|
2
|
+
require "gitcloudcli/command/space"
|
3
|
+
require "gitcloudcli/command/config"
|
4
|
+
require "thor"
|
5
|
+
|
6
|
+
module Gitcloudcli
|
7
|
+
# 命令行入口
|
8
|
+
class Cli < Thor
|
9
|
+
desc "list", "展示远端根目录所有文件信息"
|
10
|
+
option :space, :desc=>"需要查询的空间"
|
11
|
+
option :dir, :desc=>"空间路径"
|
12
|
+
option :infos, :desc=>"输出入的文件信息关键字", :type=>:array
|
13
|
+
def list()
|
14
|
+
Gitcloudcli.gitadapter(options[:space]) do |git|
|
15
|
+
git.list(options[:dir], options[:infos])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "info PATH", "展示远端文件信息"
|
20
|
+
option :space, :desc=>"需要查询的空间"
|
21
|
+
option :infos, :desc=>"输出入的文件信息关键字", :type=>:array
|
22
|
+
def info(path)
|
23
|
+
Gitcloudcli.gitadapter(options[:space]) do |git|
|
24
|
+
git.info(path, options[:infos])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "upload LOCALPATH", "上传本地文件"
|
29
|
+
option :space, :desc=>"需要查询的空间"
|
30
|
+
option :path, :desc=>"上传的远端路径 example:dirname/filename or filename"
|
31
|
+
option :message, :desc=>"本次操作的commit信息"
|
32
|
+
option :infos, :desc=>"输出入的文件信息关键字", :type=>:array
|
33
|
+
def upload(local_path)
|
34
|
+
Gitcloudcli.gitadapter(options[:space]) do |git|
|
35
|
+
git.upload(local_path, options[:path], options[:message], options[:infos])
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "delete PATH", "删除远端文件"
|
40
|
+
option :space, :desc=>"需要查询的空间"
|
41
|
+
option :message, :desc=>"本次操作的commit信息"
|
42
|
+
def delete(path)
|
43
|
+
Gitcloudcli.gitadapter(options[:space]) do |git|
|
44
|
+
git.delete(path, options[:message])
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "space [COMMAND]", "增加,删除,列出当前可操作的Git空间"
|
49
|
+
subcommand "space", Gitcloudcli::CloudSpace
|
50
|
+
end
|
51
|
+
end
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gitcloudcli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- zhangheng
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-12-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: base64
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: net/http
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yaml
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Git场库文件操作。增删改查操作
|
112
|
+
email:
|
113
|
+
- onethousandpiece@126.com
|
114
|
+
executables:
|
115
|
+
- gitcloud
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- CODE_OF_CONDUCT.md
|
121
|
+
- Gemfile
|
122
|
+
- Gemfile.lock
|
123
|
+
- LICENSE.txt
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- bin/console
|
127
|
+
- bin/gitcloud
|
128
|
+
- bin/setup
|
129
|
+
- gitcloudcli.gemspec
|
130
|
+
- lib/gitcloudcli.rb
|
131
|
+
- lib/gitcloudcli/command/config.rb
|
132
|
+
- lib/gitcloudcli/command/git/git.rb
|
133
|
+
- lib/gitcloudcli/command/git/gitee.rb
|
134
|
+
- lib/gitcloudcli/command/git/github.rb
|
135
|
+
- lib/gitcloudcli/command/git/gitlab.rb
|
136
|
+
- lib/gitcloudcli/command/space.rb
|
137
|
+
- lib/gitcloudcli/version.rb
|
138
|
+
homepage: https://github.com/monkeyheng/GitCloudCLI
|
139
|
+
licenses:
|
140
|
+
- MIT
|
141
|
+
metadata: {}
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 2.7.8
|
159
|
+
signing_key:
|
160
|
+
specification_version: 4
|
161
|
+
summary: Git场库文件操作
|
162
|
+
test_files: []
|