autoproj-git 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +10 -0
- data/autoproj-git.gemspec +27 -0
- data/lib/autoproj-git.rb +7 -0
- data/lib/autoproj/cli/git.rb +74 -0
- data/lib/autoproj/cli/main_git.rb +21 -0
- data/lib/autoproj/git/version.rb +5 -0
- metadata +119 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0d14c99cfb139fc6c403abf35ed3e8e77113a531
|
4
|
+
data.tar.gz: f2597732673b782d791c84e87ff5794f98d7e66e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0bbd6ceb553472908518e99b6bfc48739766d93e5d7096e29164d63aec9b277ba7cbc2e54c08677a79011ac3cd9d920da19d61e84d4a2ee5c6ede9bfc0e8f265
|
7
|
+
data.tar.gz: 060e474094d5d677b4cc572faafefd04d36c1c13e0e417f642c6239fe292ae8a34e52c6595b1e4f1b98d66713443c579a93c5f5200f68c8378ea2fa7d826157e
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Sylvain Joyeux
|
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,40 @@
|
|
1
|
+
# Autoproj::Git
|
2
|
+
|
3
|
+
An Autoproj plugin to add git-specific functionality to autoproj
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'autoproj-git'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install autoproj-git
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
The plugin can be accessed from the autoproj command line with
|
24
|
+
|
25
|
+
~~~
|
26
|
+
autoproj help git
|
27
|
+
~~~
|
28
|
+
|
29
|
+
## Development
|
30
|
+
|
31
|
+
After checking out the repo, run `bundle install` to install dependencies. Then, run `rake test` to run the tests.
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/doudou/autoproj-git.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
40
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'autoproj/git/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "autoproj-git"
|
8
|
+
spec.version = Autoproj::Git::VERSION
|
9
|
+
spec.authors = ["Sylvain Joyeux"]
|
10
|
+
spec.email = ["sylvain.joyeux@m4x.org"]
|
11
|
+
|
12
|
+
spec.summary = "git-aware plugin for autoproj"
|
13
|
+
spec.description = "This autoproj plugin provides git-specific functionality for autoproj, such as management of github-like PRs, automatic cleanup, ..."
|
14
|
+
spec.homepage = "https://github.com/doudou/autoproj-git"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "autoproj", "~> 2.0"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "minitest", "~> 5.0", ">= 5.0"
|
27
|
+
end
|
data/lib/autoproj-git.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'autoproj'
|
2
|
+
require 'autoproj/cli/inspection_tool'
|
3
|
+
require 'tty-table'
|
4
|
+
|
5
|
+
module Autoproj
|
6
|
+
module CLI
|
7
|
+
class Git < InspectionTool
|
8
|
+
def cleanup(user_selection, options = Hash.new)
|
9
|
+
initialize_and_load
|
10
|
+
source_packages, * =
|
11
|
+
finalize_setup(user_selection,
|
12
|
+
ignore_non_imported_packages: true)
|
13
|
+
git_packages = source_packages.map do |pkg_name|
|
14
|
+
pkg = ws.manifest.find_autobuild_package(pkg_name)
|
15
|
+
pkg if pkg.importer.kind_of?(Autobuild::Git)
|
16
|
+
end.compact
|
17
|
+
|
18
|
+
git_packages.each_with_index do |pkg, i|
|
19
|
+
cleanup_package(pkg, "[#{i}/#{git_packages.size}] ",
|
20
|
+
local: options[:local],
|
21
|
+
remove_obsolete_remotes: options[:remove_obsolete_remotes])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def git_gc(pkg, progress)
|
26
|
+
pkg.progress_start "#{progress}%s: gc", done_message: "#{progress}%s: gc" do
|
27
|
+
pkg.importer.run_git_bare(pkg, 'gc')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def git_all_remotes(pkg)
|
32
|
+
pkg.importer.run_git(pkg, 'config', '--list').
|
33
|
+
map do |line|
|
34
|
+
if match = /remote\.(.*)\.url=/.match(line)
|
35
|
+
match[1]
|
36
|
+
end
|
37
|
+
end.compact.to_set
|
38
|
+
end
|
39
|
+
|
40
|
+
def git_remote_prune(pkg, progress)
|
41
|
+
remotes = git_all_remotes(pkg)
|
42
|
+
remotes.each do |remote_name|
|
43
|
+
pkg.progress_start "#{progress}%s: pruning #{remote_name}", done_message: "#{progress}%s: pruned #{remote_name}" do
|
44
|
+
pkg.importer.run_git(pkg, 'remote', 'prune', remote_name)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def git_remove_obsolete_remotes(pkg, progress)
|
50
|
+
remotes = git_all_remotes(pkg)
|
51
|
+
pkg.importer.each_configured_remote do |remote_name, _|
|
52
|
+
remotes.delete(remote_name)
|
53
|
+
end
|
54
|
+
|
55
|
+
remotes.each do |remote_name|
|
56
|
+
pkg.progress_start "#{progress}%s: removing remote #{remote_name}", done_message: "#{progress}%s: removed remote #{remote_name}" do
|
57
|
+
pkg.importer.run_git(pkg, 'remote', 'rm', remote_name)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def cleanup_package(pkg, progress, options = Hash.new)
|
63
|
+
git_gc(pkg, progress)
|
64
|
+
|
65
|
+
if options[:remove_obsolete_remotes]
|
66
|
+
git_remove_obsolete_remotes(pkg, progress)
|
67
|
+
end
|
68
|
+
if !options[:local]
|
69
|
+
git_remote_prune(pkg, progress)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Autoproj
|
2
|
+
module CLI
|
3
|
+
# CLI interface for autoproj-git
|
4
|
+
class MainGit < Thor
|
5
|
+
desc 'cleanup [PACKAGES]', 'perform regular git cleanup operations on all packages'
|
6
|
+
option :local, type: :boolean,
|
7
|
+
default: false, desc: 'only perform operations that do not require network access'
|
8
|
+
option :remove_obsolete_remotes, type: :boolean,
|
9
|
+
default: false, desc: 'remove remotes that are not managed by autoproj'
|
10
|
+
def cleanup(*packages)
|
11
|
+
require 'autoproj/cli/git'
|
12
|
+
Autoproj.report(silent: true) do
|
13
|
+
cli = Git.new
|
14
|
+
args = cli.validate_options(packages, options)
|
15
|
+
cli.cleanup(*args)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: autoproj-git
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sylvain Joyeux
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: autoproj
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '5.0'
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '5.0'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '5.0'
|
75
|
+
description: This autoproj plugin provides git-specific functionality for autoproj,
|
76
|
+
such as management of github-like PRs, automatic cleanup, ...
|
77
|
+
email:
|
78
|
+
- sylvain.joyeux@m4x.org
|
79
|
+
executables: []
|
80
|
+
extensions: []
|
81
|
+
extra_rdoc_files: []
|
82
|
+
files:
|
83
|
+
- ".gitignore"
|
84
|
+
- ".travis.yml"
|
85
|
+
- Gemfile
|
86
|
+
- LICENSE.txt
|
87
|
+
- README.md
|
88
|
+
- Rakefile
|
89
|
+
- autoproj-git.gemspec
|
90
|
+
- lib/autoproj-git.rb
|
91
|
+
- lib/autoproj/cli/git.rb
|
92
|
+
- lib/autoproj/cli/main_git.rb
|
93
|
+
- lib/autoproj/git/version.rb
|
94
|
+
homepage: https://github.com/doudou/autoproj-git
|
95
|
+
licenses:
|
96
|
+
- MIT
|
97
|
+
metadata: {}
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.2.3
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: git-aware plugin for autoproj
|
118
|
+
test_files: []
|
119
|
+
has_rdoc:
|