assayo 0.0.3 → 0.0.4

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 +4 -4
  2. data/ruby/assayo +25 -18
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da240e71e9420b1ae0e3711822e48fe23a1d7a1c9b384201df407321bed6f903
4
- data.tar.gz: 149d1e99dd0387f608269569b26c95673ed22afe772a5d3d4d139b65755ff873
3
+ metadata.gz: 8a7e63f96cde364bff3b0625ec7ee4e10d0a52122251a750fe7bd2b19c31037b
4
+ data.tar.gz: 18ff2b2c2f8f8abd6c027d4e628151808aa40408bd80d31ccec155ab73abfb3c
5
5
  SHA512:
6
- metadata.gz: 0efbc13867e36b64d182edd489df45b8327c809ecda60cb64cb68dbaf25dacef2178db229fa51cf210e2e456f45b13b0ea10e3763d52852a223d510ae480b0eb
7
- data.tar.gz: d20a1ba71260c52f244f76b96f910295c08dd7d9b56140510d8bad9872e9f651224858bc977be55f3c09d365963850146176f62cb50f7e0d88e00f50090808ca
6
+ metadata.gz: 6e44d3f676e66f20a36851f219b3e24bd7e23a56d86c15cee4223fa15e880413f91034b77d0d787871b5922028a8c2a47e3ce5b63b956a017b7b72366ba358ff
7
+ data.tar.gz: '078002c41ffe892c75ea6d94f7ce03b909de4ab3943ebbe823fe1011fe8c7dd4d4459e2e771951a981d299c0ec297d85aaf801b65548250c99a848394ad1f02a'
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,7 +1,7 @@
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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksei Bakhirev