sync_repositry 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/sync_repositry.rb +30 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a2220e3b48b820d981eed7de3d17da916d74d503
4
+ data.tar.gz: 5ef7596dca9455ea02406733754a1a5619e8c971
5
+ SHA512:
6
+ metadata.gz: a0ef6db92685f3b762e0f8b7fc1a6e1bb9c238a2618c76bc4b292bb18c28885caf4dd61f732b8153e1fb4b946eec4e8b6d9d85a736d942131e910be4c9e22303
7
+ data.tar.gz: 7a5e2c4d89cf4ec1cf592af896653f9201e427efa328667bfa46c721c4a2e1b5c0bd338f3a5c42e98109806dd99af5c1bf27b633aaf92d9c3865cee6cc7fb695
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby -wKU
2
+ require 'rugged'
3
+ require 'ruby-progressbar'
4
+
5
+ class SyncRepositry
6
+ def self.clone_at (url, path)
7
+ progressbar = ProgressBar.create( :format => "%a %b %c/%C\u{15E7}%i %p%% %t",
8
+ :progress_mark => '=',
9
+ :throttle_rate => 0.1,
10
+ :remainder_mark => "\u{FF65}",
11
+ :starting_at => 0)
12
+ # puts Rugged::Repository.attributes_name;
13
+ Rugged::Repository.clone_at(url, path, {
14
+ checkout_branch:'master',
15
+ transfer_progress:lambda { |total_objects, indexed_objects, received_objects, local_objects, total_deltas, indexed_deltas, received_bytes|
16
+ if received_objects == 0
17
+ progressbar.total = total_objects;
18
+ end
19
+ if (received_objects < total_objects) && (progressbar.progress < progressbar.total)
20
+ progressbar.increment;
21
+ end
22
+ }
23
+ });
24
+ end
25
+
26
+
27
+ def self.discover_root
28
+ File.dirname Rugged::Repository.discover.path
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sync_repositry
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - afei
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-02-24 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Ruby gem for sync github repositry
14
+ email: 1290657123@qq.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/sync_repositry.rb
20
+ homepage: https://github.com/afeiship/gem_sync_repositry
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.5.2
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Sync github repositry
44
+ test_files: []