runby_pace 0.6.152 → 0.61.153
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +8 -5
- data/bin/runbypace +15 -0
- data/lib/runby_pace/cli.rb +57 -0
- data/lib/runby_pace/run_types/all_run_types.template +5 -1
- data/lib/runby_pace/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c60a2e73563c7842283f902a9296cb19dab57ff1
|
4
|
+
data.tar.gz: 47ce26e84f4542fe38d64b3177231a9591801e94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf89a3299ecd7230f8801021a015f61d5244376ec2ac3ba1e41bbee061bc31485e0f56e8665d19ffaed6f099670d22c506bd238b88713c2dbb8c20abf5c51365
|
7
|
+
data.tar.gz: 2225f218942a998edc91a1d551ab2d4badd816674638c343b1bd0a6dcc5ace56d8bac75056e062543d2d5d85370609c4b33474f60b7264634d1f4872055bff6e
|
data/Rakefile
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/gem_tasks'
|
2
4
|
require 'rspec/core/rake_task'
|
3
5
|
|
4
6
|
RSpec::Core::RakeTask.new(:spec)
|
5
7
|
|
6
|
-
task :
|
8
|
+
task default: :build
|
7
9
|
|
8
|
-
task :
|
10
|
+
task build: %i[gen_all_run_types spec]
|
9
11
|
|
10
12
|
desc 'Generate the all_run_types.g.rb file'
|
11
13
|
task :gen_all_run_types do
|
@@ -19,16 +21,17 @@ task :gen_all_run_types do
|
|
19
21
|
filename_sans_extension = filename[0, filename.length - 3]
|
20
22
|
parts = filename_sans_extension.to_s.downcase.split(/_|\./)
|
21
23
|
run_type = ''
|
22
|
-
parts.each
|
24
|
+
parts.each do |part|
|
23
25
|
run_type += part[0].upcase + part[-(part.length - 1), part.length - 1]
|
24
|
-
|
26
|
+
end
|
25
27
|
run_type
|
26
28
|
end
|
27
29
|
puts all_run_types.join(' ')
|
28
30
|
|
29
31
|
# Write run types to the generated file, all_run_types.g.rb
|
30
32
|
template = File.read(File.join(run_types_path, 'all_run_types.template'))
|
31
|
-
template.gsub!('
|
33
|
+
template.gsub!('__RUN_TYPE_NAMES__', all_run_types.join(' '))
|
34
|
+
template.gsub!('__RUN_TYPES__', all_run_types.join(', '))
|
32
35
|
File.write(File.join(run_types_path, 'all_run_types.g.rb'), template)
|
33
36
|
puts "\e[32mDone\e[0m\n\n"
|
34
37
|
end
|
data/bin/runbypace
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'readline'
|
4
|
+
|
5
|
+
module Runby
|
6
|
+
# Command line interface and REPL for RunbyPace
|
7
|
+
class Cli
|
8
|
+
def initialize(args = ARGV)
|
9
|
+
@args = args
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
puts 'Runby Pace REPL!'
|
14
|
+
bnd = binding
|
15
|
+
while (input = Readline.readline('🏃 ', true))
|
16
|
+
begin
|
17
|
+
result = bnd.eval input
|
18
|
+
rescue StandardError => e
|
19
|
+
puts "#{e.class}: #{e.message}"
|
20
|
+
else
|
21
|
+
puts result
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def targets(five_k_time, distance_units = :mi)
|
27
|
+
five_k_time = Runby.sanitize(five_k_time).as(RunbyTime)
|
28
|
+
puts "\nIf you can run a 5K in #{five_k_time}, your training paces should be:"
|
29
|
+
RunTypes.all_classes.each do |run_type|
|
30
|
+
run = run_type.new
|
31
|
+
puts " #{run.description}: #{run.lookup_pace(five_k_time, distance_units)}"
|
32
|
+
end
|
33
|
+
nil
|
34
|
+
end
|
35
|
+
|
36
|
+
# -- Shortcuts
|
37
|
+
def d(*args)
|
38
|
+
Distance.new(*args)
|
39
|
+
end
|
40
|
+
|
41
|
+
def du(*args)
|
42
|
+
DistanceUnit.new(*args)
|
43
|
+
end
|
44
|
+
|
45
|
+
def p(*args)
|
46
|
+
Pace.new(*args)
|
47
|
+
end
|
48
|
+
|
49
|
+
def s(*args)
|
50
|
+
Speed.new(*args)
|
51
|
+
end
|
52
|
+
|
53
|
+
def t(*args)
|
54
|
+
RunbyTime.new(*args)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/runby_pace/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runby_pace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.61.153
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ty Walls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -71,8 +71,10 @@ files:
|
|
71
71
|
- bin/_guard-core
|
72
72
|
- bin/console
|
73
73
|
- bin/guard
|
74
|
+
- bin/runbypace
|
74
75
|
- bin/setup
|
75
76
|
- lib/runby_pace.rb
|
77
|
+
- lib/runby_pace/cli.rb
|
76
78
|
- lib/runby_pace/distance.rb
|
77
79
|
- lib/runby_pace/distance_unit.rb
|
78
80
|
- lib/runby_pace/golden_pace_set.rb
|
@@ -106,7 +108,7 @@ homepage: https://github.com/tygerbytes/runby-pace
|
|
106
108
|
licenses:
|
107
109
|
- MIT
|
108
110
|
metadata:
|
109
|
-
commit-hash:
|
111
|
+
commit-hash: 3fc9ad10f233d833635a4ee48619fcd7957f98f3
|
110
112
|
post_install_message:
|
111
113
|
rdoc_options: []
|
112
114
|
require_paths:
|