gtlab 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 005ace0fe0a4fa18c501473cff8781abddf728e2b03bce37d32d8b02a059dbfd
4
+ data.tar.gz: 455b391d3d5576a51ddb65feb5d29cf926877a2840464cd00e7169bd00fbd681
5
+ SHA512:
6
+ metadata.gz: 7abe0c1e4964eb2cfa30e380620fe37e9f0d1201cd7f068dc5f1f3d3517e408b38de31572d815df0c2022bcd10b66900c992670c498d57b573469f7b7d58ab9f
7
+ data.tar.gz: a0d6fa61210213fb80c46854aad9b2620c7f428ce9396484dc0bb240cb56da9d00d3c9fa244c1bd21a554b940e971eaaa4e546be8ee216bf050318484369f824
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
10
+ /.idea/
11
+ vendor/cache
12
+ .gitl
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 2.0.2
@@ -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 luobin02@baijiahulian.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
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in gitl.gemspec
4
+ gemspec
@@ -0,0 +1,42 @@
1
+ projects:
2
+
3
+ - name: tianxiao-base-iphone-sdk
4
+ # git: http://{username}:{password}@git.tianxiao100.com/tianxiao-ios/tianxiao/tianxiao-base-iphone-sdk.git
5
+ git: git@git.tianxiao100.com:tianxiao-ios/tianxiao/tianxiao-base-iphone-sdk.git
6
+
7
+ - name: tianxiao-iphone
8
+ git: git@git.tianxiao100.com:tianxiao-ios/tianxiao/tianxiao-iphone.git
9
+
10
+ - name: tianxiao-crm-iphone-sdk
11
+ git: git@git.tianxiao100.com:tianxiao-ios/tianxiao/tianxiao-crm-iphone-sdk.git
12
+
13
+ - name: tianxiao-netschool-iphone-sdk
14
+ git: git@git.tianxiao100.com:tianxiao-ios/tianxiao/tianxiao-netschool-iphone-sdk.git
15
+
16
+ - name: tianxiao-erp-iphone-sdk
17
+ git: git@git.tianxiao100.com:tianxiao-ios/tianxiao/tianxiao-erp-iphone-sdk.git
18
+
19
+ - name: tianxiao-marketing-iphone-sdk
20
+ git: git@git.tianxiao100.com:tianxiao-ios/tianxiao/tianxiao-marketing-iphone-sdk.git
21
+
22
+ - name: tianxiao-person-iphone-sdk
23
+ git: git@git.tianxiao100.com:tianxiao-ios/tianxiao/tianxiao-person-iphone-sdk.git
24
+
25
+ - name: tianxiao-im-iphone-sdk
26
+ git: git@git.tianxiao100.com:tianxiao-ios/tianxiao/tianxiao-im-iphone-sdk.git
27
+
28
+ - name: tianxiao-welive-iphone-sdk
29
+ git: git@git.tianxiao100.com:tianxiao-ios/tianxiao/tianxiao-welive-iphone-sdk.git
30
+
31
+ - name: tianxiao-bus-iphone-sdk
32
+ git: git@git.tianxiao100.com:tianxiao-ios/tianxiao/tianxiao-bus-iphone-sdk.git
33
+
34
+ - name: tianxiao-core-iphone-sdk
35
+ git: git@git.tianxiao100.com:tianxiao-ios/tianxiao/tianxiao-core-iphone-sdk.git
36
+
37
+ gitlab:
38
+ # GitLab api url. example http://git.tianxiao100.com/api/v4
39
+ endpoint: http://git.tianxiao100.com/api/v4
40
+ # set a your private token
41
+ # user's private token or OAuth2 access token
42
+ private_token: TODO
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 binluo
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.
@@ -0,0 +1,43 @@
1
+ # Gitl
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/gitl`. 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 'gitl'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install gitl
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. Then, run `rake test` to run the tests. 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]/gitl. 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 Gitl project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/gitl/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gitl"
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__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gitl'
4
+ require 'command'
5
+
6
+
7
+ Gitl::Command::run(ARGV)
8
+
@@ -0,0 +1,39 @@
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "gitl/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "gtlab"
7
+ spec.version = Gitl::VERSION
8
+ spec.authors = ["binluo"]
9
+ spec.email = ["luobin23628@163.com"]
10
+
11
+ spec.summary = %q{gitlab工具}
12
+ spec.description = %q{方便处理多个gitlab仓库}
13
+ spec.homepage = "https://github.com/luobin23628/gitl"
14
+ spec.license = "MIT"
15
+
16
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
17
+
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
20
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_dependency "gitlab", "~> 4.12.0"
32
+ spec.add_dependency "claide", "~> 1.0.2"
33
+ spec.add_dependency "colored2", "~>3.1.2 "
34
+ spec.add_dependency "git", "~>1.5.0 "
35
+
36
+ spec.add_development_dependency "bundler", "~> 2.0"
37
+ spec.add_development_dependency "rake", "~> 10.0"
38
+ spec.add_development_dependency "minitest", "~> 5.0"
39
+ end
@@ -0,0 +1,70 @@
1
+ require 'claide'
2
+ require 'config/work_space_config'
3
+
4
+ module Gitl
5
+ class Error < StandardError; end
6
+
7
+ class Command < CLAide::Command
8
+
9
+ require 'commands/init'
10
+ require 'commands/sync'
11
+ require 'commands/start'
12
+ require 'commands/review'
13
+ require 'commands/create_tag'
14
+ require 'commands/delete_tag'
15
+ require 'commands/create'
16
+
17
+ self.abstract_command = true
18
+ self.command = 'gitl'
19
+ self.version = VERSION
20
+ self.description = 'Gitl, the tianxiao gitlab manager.'
21
+
22
+ def self.run(argv)
23
+ help! 'You cannot run gitl as root.' if Process.uid == 0 && !Gem.win_platform?
24
+ super(argv)
25
+ end
26
+
27
+ def self.handle_exception(command, exception)
28
+ if exception.is_a?(Error) || exception.is_a?(Git::GitExecuteError)
29
+ puts exception.message.red
30
+ if command.nil? || command.verbose?
31
+ puts
32
+ puts(*exception.backtrace)
33
+ end
34
+ exit(1)
35
+ elsif exception.is_a?(Gitlab::Error::ResponseError)
36
+ if command.nil? || command.verbose?
37
+ puts(exception.message.red)
38
+ puts(*exception.backtrace)
39
+ else
40
+ puts exception.message.red
41
+ end
42
+ exit(1)
43
+ else
44
+ super
45
+ end
46
+ end
47
+
48
+ def self.report_error(exception)
49
+ case exception
50
+ when Interrupt
51
+ puts '[!] Cancelled'.red
52
+ exit(1)
53
+ when SystemExit
54
+ raise
55
+ else
56
+ raise exception
57
+ end
58
+ end
59
+
60
+ def info(message)
61
+ puts(message.green)
62
+ end
63
+
64
+ def error(message)
65
+ puts(message.red)
66
+ end
67
+
68
+ end
69
+
70
+ end
@@ -0,0 +1,2 @@
1
+ class Branch
2
+ end
@@ -0,0 +1,67 @@
1
+ require 'sub_command'
2
+ require "open-uri"
3
+ require 'pathname'
4
+
5
+ module Gitl
6
+ class Create < SubCommand
7
+
8
+ self.summary = '创建并配置Gitl.yml.'
9
+
10
+ self.description = <<-DESC
11
+ 创建并配置Gitl.yml.
12
+ DESC
13
+
14
+ def self.options
15
+ options = [
16
+ ["--config_url=[url]", "指定配置文件url地址"],
17
+ ].concat(super)
18
+ options.delete_if do |option|
19
+ option[0] =~ /^--config=/
20
+ end
21
+ options
22
+ end
23
+
24
+ def initialize(argv)
25
+ @config_url = argv.option('config_url')
26
+ super
27
+ end
28
+
29
+ def validate!
30
+ super
31
+ end
32
+
33
+ def run
34
+ local_config_path = "./Gitl.yml"
35
+ if File.exist?(local_config_path)
36
+ raise Error.new("'#{local_config_path}' exists.")
37
+ end
38
+
39
+ if @config_url.nil?
40
+ path = File.expand_path("../../Gitl.yml", File.dirname(__FILE__))
41
+ if File.exist?(path)
42
+ gitl_config = GitlConfig.load_file(path)
43
+ else
44
+ raise Error.new("'#{path}' not found.")
45
+ end
46
+ else
47
+ yml_response = nil
48
+ open(@config_url) do |http|
49
+ yml_response = http.read
50
+ end
51
+ gitl_config = GitlConfig.load_yml(yml_response)
52
+ end
53
+
54
+ begin
55
+ print "Input GitLab private token: "
56
+ private_token = STDIN.gets.chomp
57
+ end until private_token.length > 0
58
+
59
+ gitl_config.gitlab.private_token = private_token
60
+
61
+ File.open("./Gitl.yml", 'w') do |file|
62
+ Psych.dump(gitl_config.to_dictionary, file)
63
+ end
64
+
65
+ end
66
+ end
67
+ end