assayo 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ruby/assayo +25 -18
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a7e63f96cde364bff3b0625ec7ee4e10d0a52122251a750fe7bd2b19c31037b
|
4
|
+
data.tar.gz: 18ff2b2c2f8f8abd6c027d4e628151808aa40408bd80d31ccec155ab73abfb3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
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\"
|
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 =
|
25
|
+
$SOURCE_DIR = '../assayo'
|
26
|
+
$SOURCE_PATH = __dir__
|
21
27
|
|
22
28
|
# folder, when user run library
|
23
|
-
DIST_DIR = 'assayo'
|
24
|
-
DIST_PATH =
|
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,
|
40
|
-
save_log_cmd = get_save_log_command(
|
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 =
|
50
|
-
content = content.gsub(
|
51
|
-
|
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()
|