Class: Raykit::Console
- Inherits:
-
Object
- Object
- Raykit::Console
- Defined in:
- lib/raykit/console.rb
Overview
The implementation for the raykit console application
Class Method Summary collapse
Class Method Details
.import(hash) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/raykit/console.rb', line 77 def self.import(hash) puts 'scanning...' scanned_remotes = Raykit::Git::scan_remote_urls remotes = Raykit::Git::remote_urls count = 0 scanned_remotes.each{|remote| if(!remotes.include?(remote)) puts "imported " + Rainbow(remote).yellow.bright remotes.insert(0,remote) count = count + 1 end } if(count > 0) puts 'updating Raykit::Git::remote_urls' Raykit::Git::remote_urls = remotes end end |
.list(hash) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/raykit/console.rb', line 65 def self.list(hash) pattern=nil if(hash.include?(:pattern)) pattern=hash[:pattern] end Raykit::Git::remote_urls.each{|url| if(pattern.nil? || url.include?(pattern)) puts Rainbow(url).yellow.bright end } end |
.rake(hash) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/raykit/console.rb', line 95 def self.rake(hash) Raykit::Git::remote_urls.each{|remote| if(remote.include?(hash[:pattern])) begin puts "remote: #{remote}" cmd = Raykit::Rake::run(remote,'master') elapsed_str = Timer.get_elapsed_str(cmd.elapsed) if(cmd.exitstatus == 0) puts elapsed_str + " " + Rainbow(cmd.command).yellow.bright + " (#{cmd.directory})" #return elapsed_str + " " + cmd.command else puts "\r\n" + cmd.command + "\r\n" puts "\r\n" + cmd.output + "\r\n" puts "\r\n" + cmd.error + "\r\n" puts '' puts Rainbow(elapsed_str).red.bright + " " + Rainbow(cmd.command).white end rescue puts 'rescued...' end end } end |
.run ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/raykit/console.rb', line 45 def self.run if(ARGV.length == 0) Parser.parse %w[--help] 0 else hash = Parser.parse ARGV if(hash.include?(:verb)) verb = hash[:verb] case verb when 'list' list(hash) when 'import' import(hash) when 'rake' rake(hash) end end end end |