raykit 0.0.78 → 0.0.79

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: b6f6c226590ce474b86d043126f2f50b8036d96a6ae87fb55adbbfb94108eee0
4
- data.tar.gz: 3fc0bc65e376b5fd02c2344c775a4ce8eba54b10b7eaf8bc3fd849d685163b2a
3
+ metadata.gz: 7358ba0f5ed5825bbf7bc6a7dcf1c6856f8339c62c456f0175f0d2478c16e131
4
+ data.tar.gz: 323480501634d62fe55df078779729dc18903942a7846dce4d3839a8092b35d3
5
5
  SHA512:
6
- metadata.gz: 5dddd10d8afb2965f25625a3eae53891223e4fbac3434aff317c8e15dc996b9eea3182b54949ff1096e8f55899e6f4b4e8396502e175a552fa807fb7371b051b
7
- data.tar.gz: 83329ce09fe77124ae251db8e762a03247357c1896dd06605e3126b5eff07081dc71dbfcf89904a3c956aea9d1cff4aa54f9da217d4536e11572cd5ab003351d
6
+ metadata.gz: cfd3792dcc24a75592447fba59ad2812ae7c141f5d3f490522bc3d372443cf142d84eeeeda029ee9fd23b42613fb7035ba0578bd4f54660f4dd6da429b14e2d5
7
+ data.tar.gz: e95f61d363a57bd1ba98543a01ff7cffbdecbf81e324b3d0cc0c1d4b01563b0ea31b9ed0ebeb42b2ea3ba296794ad593ba8935529fbda2ce51e93d04c337c912
@@ -7,6 +7,7 @@ BUFFER_SIZE=1024 if(!defined?(BUFFER_SIZE))
7
7
  module Raykit
8
8
  # Functionality to support executing and logging system commands
9
9
  class Command
10
+ @@commands
10
11
  # The timeout in seconds, defaults to 0 if not specified
11
12
  attr_accessor :timeout
12
13
  # The working directory, defaults the current directory if not specified
@@ -26,6 +27,7 @@ module Raykit
26
27
  end
27
28
 
28
29
  def initialize(command,timeout=0)
30
+ @@commands=Array.new
29
31
  init_defaults
30
32
  @command=command
31
33
  @timeout=timeout
@@ -77,6 +79,24 @@ module Raykit
77
79
  else
78
80
  LOG.log('Raykit.Command',Logger::Severity::ERROR,JSON.generate(to_hash))
79
81
  end
82
+ @@commands.insert(-1,self)
83
+ end
84
+
85
+ def elapsed_str()
86
+ if(elapsed < 1.0)
87
+ "%.0f" % (elapsed) + "s"
88
+ else
89
+ "%.0f" % (elapsed) + "s"
90
+ end
91
+ end
92
+
93
+ def summary
94
+ checkmark="\u2713"
95
+ warning="\u26A0"
96
+ error="\u0058"
97
+ symbol=Rainbow(checkmark.encode('utf-8')).green
98
+ symbol=Rainbow(error.encode('utf-8')).red if(exitstatus!=0)
99
+ puts symbol + " " + elapsed_str.rjust(4) + " " + Rainbow(@command).yellow
80
100
  end
81
101
 
82
102
  def to_hash()
@@ -82,7 +82,8 @@ module Raykit
82
82
  private def update_local_clone_directory
83
83
  if(Dir.exist?(local_clone_directory))
84
84
  Dir.chdir(local_clone_directory) do
85
- `git pull`
85
+ Raykit::Command.new('git pull')
86
+ #t = `git pull`
86
87
  end
87
88
  else
88
89
  PROJECT.run("git clone #{@url} #{local_clone_directory}")
@@ -95,7 +96,7 @@ module Raykit
95
96
  Dir.chdir(local_clone_directory) do
96
97
  check=`git branch`
97
98
  if(!check.include?("* #{branch}"))
98
- `git checkout #{branch}`
99
+ t = `git checkout #{branch}`
99
100
  end
100
101
  check=`git branch`
101
102
  return check.include?("* #{branch}")
@@ -1,22 +1,26 @@
1
1
  require 'rake/clean'
2
2
  RAKE_DIRECTORY=Rake.application.original_dir
3
- puts "RAKE_DIRECTORY #{RAKE_DIRECTORY}"
3
+ #puts "RAKE_DIRECTORY #{RAKE_DIRECTORY}"
4
4
  module Raykit
5
5
  class Project
6
6
  attr_accessor :name
7
7
  attr_accessor :timer
8
+ attr_accessor :verbose
8
9
  @directory
9
10
  @version
10
11
  @remote
12
+ @repository
13
+ @git_directory
11
14
 
12
15
  def initialize()
16
+ @verbose=false
13
17
  @timer=Raykit::Timer.new
14
18
  @remote=''
15
19
  if(Dir.exist?(RAKE_DIRECTORY))
16
20
  @directory=RAKE_DIRECTORY
17
21
  if(Dir.exist?("#{RAKE_DIRECTORY}/.git") && Dir.exist?(@directory))
18
- git_directory=Raykit::Git::Directory.new(@directory)
19
- @remote=git_directory.remote
22
+ @git_directory=Raykit::Git::Directory.new(@directory)
23
+ @remote=@git_directory.remote
20
24
  end
21
25
  else
22
26
  @directory=''
@@ -34,6 +38,7 @@ module Raykit
34
38
  end
35
39
  end
36
40
  @version=Raykit::Version.detect(@name)
41
+ @repository=Raykit::Git::Repository.new(@remote)
37
42
  end
38
43
 
39
44
  def get_dev_dir(subdir)
@@ -43,6 +48,13 @@ module Raykit
43
48
  def directory
44
49
  @directory
45
50
  end
51
+ def branch
52
+ @git_directory.branch
53
+ end
54
+
55
+ def latest_commit
56
+ @repository.latest_commit(branch)
57
+ end
46
58
 
47
59
  def version
48
60
  @version
@@ -68,17 +80,21 @@ module Raykit
68
80
  end
69
81
 
70
82
  def info
83
+ ljust=35
71
84
  puts ''
72
- puts "PROJECT.name = " + Rainbow(PROJECT.name).yellow.bright
73
- puts "PROJECT.version = " + Rainbow(PROJECT.version).yellow.bright
74
- puts "PROJECT.remote = " + Rainbow(PROJECT.remote).yellow.bright
75
- puts "PROJECT.last_modified_filename = " + Rainbow(PROJECT.last_modified_filename).yellow.bright
76
- puts "PROJECT.elapsed = " + Rainbow(PROJECT.elapsed).yellow.bright
85
+ puts "PROJECT.name".ljust(ljust) + Rainbow(PROJECT.name).yellow.bright
86
+ puts "PROJECT.version".ljust(ljust) + Rainbow(PROJECT.version).yellow.bright
87
+ puts "PROJECT.remote".ljust(ljust) + Rainbow(PROJECT.remote).yellow.bright
88
+ puts "PROJECT.branch".ljust(ljust) + Rainbow(PROJECT.branch).yellow.bright
89
+ puts "PROJECT.latest_commit".ljust(ljust) + Rainbow(PROJECT.latest_commit).yellow.bright
90
+ puts "PROJECT.last_modified_filename".ljust(ljust) + Rainbow(PROJECT.last_modified_filename).yellow.bright
91
+ #puts "PROJECT.elapsed".ljust(ljust) + Rainbow(PROJECT.elapsed).yellow.bright
77
92
  puts ''
78
93
  self
79
94
  end
80
95
 
81
96
  def summary
97
+ info if(@verbose)
82
98
 
83
99
  puts "[" + elapsed + "] " + Rainbow(@name).yellow.bright + " " + Rainbow(version).yellow.bright
84
100
  end
@@ -137,14 +153,15 @@ module Raykit
137
153
  command.each{|subcommand| run(subcommand,quit_on_failure)}
138
154
  else
139
155
  cmd = Command.new(command)
156
+ cmd.summary
140
157
  elapsed_str = Timer.get_elapsed_str(cmd.elapsed,0)
141
158
  if(cmd.exitstatus == 0)
142
- puts elapsed_str + " " + Rainbow(cmd.command).yellow.bright
159
+ #puts elapsed_str + " " + Rainbow(cmd.command).yellow.bright
143
160
  #return elapsed_str + " " + cmd.command
144
161
  else
145
- puts "\r\n" + cmd.command + "\r\n"
146
- system(cmd.command)
147
- puts ''
162
+ #puts "\r\n" + cmd.command + "\r\n"
163
+ #system(cmd.command)
164
+ #puts ''
148
165
  if(quit_on_failure)
149
166
  abort Rainbow(elapsed_str).red.bright + " " + Rainbow(cmd.command).white
150
167
  end
@@ -22,7 +22,8 @@ module Raykit
22
22
 
23
23
  # Converts a time span in seconds to a formatted string
24
24
  def self.get_elapsed_str(elapsed,pad=0)
25
- "[" + "%.0f" % (elapsed) + "s]".ljust(pad)
25
+ #"[" + "%.0f" % (elapsed) + "s]".ljust(pad)
26
+ "%.0f" % (elapsed) + "s".ljust(pad)
26
27
  end
27
28
  end
28
29
  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.78
4
+ version: 0.0.79
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow