-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRunfile
56 lines (47 loc) · 1.45 KB
/
Runfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
require "byebug"
require "colsole"
require 'concode/version'
title "Concode Developer Toolbelt"
summary "Runfile tasks for building the Concode gem"
version Concode::VERSION
import_gem 'runfile-tasks/gem'
import 'debug'
help "Generate changelog and append old changelog"
action :changelog do
system "git changelog --save"
# append older changelog (prior to switching to git-changelog)
system "cat .changelog.old.md >> CHANGELOG.md"
end
help "Generate stats table"
action :stats do
require 'concode'
separator = "---------+-----------+-----------+-----------+-----------\n"
table = separator
table += " | 1 words | 2 words | 3 words | 4 words\n"
table += separator
[3,4,5,6,7,8,9,0].each do |chars|
table += " #{chars} chars"
(1..4).each do |words|
generator = Concode::Generator.new words: words, chars: chars
count = generator.word_count
color = :m
if count > 1_000_000_000_000
color = :r
count = "#{(count/1_000_000_000_000.to_f).round 1}T"
elsif count > 1_000_000_000
color = :b
count = "#{(count/1_000_000_000.to_f).round 1}B"
elsif count > 1_000_000
color = :c
count = "#{(count/1_000_000.to_f).round 1}M"
elsif count > 1_000
color = :g
count = "#{(count/1_000.to_f).round 1}K"
end
table += " | #{color}`#{count.to_s.rjust 9}`"
end
table += "\n"
end
table += separator
say table
end