assayo 0.0.3 → 0.0.5

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.
data/ruby/assayo CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- def get_save_log_command(fileName)
4
- raw = "--raw --numstat"
3
+ def get_save_log_command()
4
+ $raw = "--raw --numstat"
5
5
  if ARGV.include?('--no-file')
6
- raw = ""
6
+ $raw = ""
7
7
  end
8
- return "git --no-pager log #{raw} --oneline --all --reverse --date=iso-strict --pretty=format:\"%ad>%aN>%aE>%s\" > #{fileName}"
8
+ return "git --no-pager log #{$raw} --oneline --all --reverse --date=iso-strict --pretty=format:\"%ad>%aN>%aE>%s\""
9
9
  end
10
10
 
11
11
  def show_message(message)
@@ -14,21 +14,27 @@ def show_message(message)
14
14
  end
15
15
  end
16
16
 
17
+ def write_in_file(fileName, content)
18
+ File.open(fileName, 'w') do |file|
19
+ file.write(content)
20
+ end
21
+ end
22
+
17
23
  def create_report()
18
24
  # folder, when library was saved
19
- SOURCE_DIR = 'assayo'
20
- SOURCE_PATH = Dir.pwd
25
+ $SOURCE_DIR = '../assayo'
26
+ $SOURCE_PATH = __dir__
21
27
 
22
28
  # folder, when user run library
23
- DIST_DIR = 'assayo'
24
- DIST_PATH = Process.cwd
29
+ $DIST_DIR = 'assayo'
30
+ $DIST_PATH = Dir.pwd
25
31
 
26
32
  # 1. Copy folder ./assayo from package to ./assayo in project
27
- source = File.join(SOURCE_PATH, SOURCE_DIR)
28
- target = File.join(DIST_PATH, DIST_DIR)
29
- copy_cmd = "cp -r #{source} #{target}"
33
+ $source = File.join($SOURCE_PATH, $SOURCE_DIR)
34
+ $target = File.join($DIST_PATH, $DIST_DIR)
35
+ $copy_cmd = "cp -r #{$source} #{$target}"
30
36
  begin
31
- system(copy_cmd)
37
+ system($copy_cmd) or raise $copy_cmd
32
38
  rescue => e
33
39
  puts "Assayo: cant copy files: #{e.message}"
34
40
  end
@@ -36,19 +42,20 @@ def create_report()
36
42
 
37
43
  # Run "git log" and save output in file ./assayo/log.txt
38
44
  show_message("reading git log was be started")
39
- fileName = File.join(Dir.pwd, DIST_DIR, 'log.txt')
40
- save_log_cmd = get_save_log_command(fileName)
45
+ $fileName = File.join(Dir.pwd, $DIST_DIR, "log.txt")
46
+ $save_log_cmd = get_save_log_command()
41
47
  begin
42
- system(save_log_cmd)
48
+ system($save_log_cmd, { out: $fileName }) or raise $save_log_cmd
43
49
  rescue => e
44
50
  puts "Assayo: cant create log file: #{e.message}"
45
51
  end
46
52
  show_message("the file with git log was be saved")
47
53
 
48
54
  # 3. Replace symbols in ./assayo/log.txt
49
- content = File.read(filename, 'UTF-8').gsub(/`/, '')
50
- content = content.gsub(/\n/, '`);\nr(f`')
51
- File.open(filename, 'w') { |file| file.write("r(f\`#{content}\`);") }
55
+ $content = IO.read($fileName)
56
+ $content = $content.gsub(/`/, "")
57
+ $content = $content.gsub(/\n/, "`);\nr(f`")
58
+ write_in_file($fileName, "r(f\`#{$content}\`);")
52
59
  end
53
60
 
54
61
  create_report()
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assayo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksei Bakhirev
8
8
  autorequire:
9
9
  bindir: ruby
10
10
  cert_chain: []
11
- date: 2024-09-27 00:00:00.000000000 Z
11
+ date: 2024-10-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Visualization and analysis of git commit statistics. Team Lead performance
14
14
  tool.