raykit 0.0.30 → 0.0.31

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d12c7d67d3b04b73083893af45ee5c224fa2e2c9368561a3d0861f6ad19f670d
4
- data.tar.gz: d8a280e18cc08b81f736970954336d5e4f9c4b879e1827828f537813469a9d74
3
+ metadata.gz: c15f887b0e8071870d55d787e0a45faad72b6520849d6c4689a9d1a73b25afc4
4
+ data.tar.gz: b5207c33bf5ae03518f947fce17969ba4791450a42988e4e2823ca177f8d05e7
5
5
  SHA512:
6
- metadata.gz: f2cdcd694608b721b088c6bae7b8df1961bcf6de987ed93bb377d44c94ad8b6f95dfbf356a281d805f8d79f4ee9c42cb5568f92083e52f52475f07a248dbc22c
7
- data.tar.gz: f65b0d4346335c2d1a402fc1bca1d9e84501160a5fb7fcd2c73940ae9110ef6d8915f363c90d7482e34f012abc93cfb7e4edf3feaf94b81490208305e8ac8bfd
6
+ metadata.gz: 464c8cd614674593f6b3068d7cf55f9f9478f7dc4abf9592942d71b465099ecdd36cedaea487989ba8ffe5675b9d52f1bc368ef6460725514d35c9f4aef8c5de
7
+ data.tar.gz: 350e05e0e136bce2529832c8119cde078f8c44fa09c4a7f4981fcc8fd376b3cb38a9dedf09c89bf1741512146bdc06c5a8c37455567ec412207ef44ddce1a657
@@ -9,13 +9,34 @@ module Raykit
9
9
  args = Options.new("world")
10
10
  opt_parser = OptionParser.new do |opts|
11
11
  opts.banner = "Usage: raykit [options]"
12
- opts.on('-l','--list','list remotes') do |list|
12
+ opts.on('-l','--list [PATTERN]','list remotes') do |pattern|
13
13
  Raykit::Git::remote_urls.each{|url|
14
- puts Rainbow(url).yellow.bright
14
+ if(pattern.nil? || url.include?(pattern))
15
+ puts Rainbow(url).yellow.bright
16
+ end
15
17
  }
16
18
  exit
17
19
  end
18
20
 
21
+ opts.on('-i','--import','import remotes') do |import|
22
+ puts 'scanning...'
23
+ scanned_remotes = Raykit::Git::scan_remote_urls
24
+ remotes = Raykit::Git::remote_urls
25
+ count = 0
26
+ scanned_remotes.each{|remote|
27
+ if(!remotes.include?(remote))
28
+ puts "imported " + Rainbow(remote).yellow.bright
29
+ remotes.insert(0,remote)
30
+ count = count + 1
31
+ end
32
+ }
33
+ if(count > 0)
34
+ puts 'updating Raykit::Git::remote_urls'
35
+ Raykit::Git::remote_urls = remotes
36
+ end
37
+ exit
38
+ end
39
+
19
40
  opts.on('-h','--help','help') do
20
41
  puts opts
21
42
  exit
@@ -29,7 +50,6 @@ module Raykit
29
50
 
30
51
  class Console
31
52
  def self.run
32
-
33
53
  if(ARGV.length == 0)
34
54
  Parser.parse %w[--help]
35
55
  0
@@ -24,6 +24,14 @@ module Raykit
24
24
  end
25
25
  log_dir
26
26
  end
27
+
28
+ def self.work_dir
29
+ work_dir = "#{Environment::root_dir}/work"
30
+ if(!Dir.exist?(work_dir))
31
+ Dir.mkdir(work_dir)
32
+ end
33
+ work_dir
34
+ end
27
35
  end
28
36
  end
29
37
 
@@ -78,5 +78,29 @@ module Raykit
78
78
  def self.list_remotes
79
79
  remote_urls.each{|url| puts url}
80
80
  end
81
+
82
+ def self.scan_remote_urls
83
+ remotes = Array.new
84
+ git_dirs = Array.new
85
+ Dir.chdir(Environment::work_dir) do
86
+ Dir.glob('**/.git'){|git_dir|
87
+ dir = File.expand_path('..',git_dir)
88
+ if(dir.length > 0)
89
+ git_dirs.insert(0,dir)
90
+ end
91
+
92
+ }
93
+ end
94
+
95
+ git_dirs.each{|git_dir|
96
+ Dir.chdir(git_dir) do
97
+ remote = get_remote
98
+ if(remote.length > 0)
99
+ remotes.insert(0,remote)
100
+ end
101
+ end
102
+ }
103
+ remotes
104
+ end
81
105
  end
82
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raykit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.30
4
+ version: 0.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow