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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca5b1523ab15f97af5601a376ec6e502625b3530
4
- data.tar.gz: dcefcf05dafe99796e230c884c9d20701e849416
3
+ metadata.gz: c60a2e73563c7842283f902a9296cb19dab57ff1
4
+ data.tar.gz: 47ce26e84f4542fe38d64b3177231a9591801e94
5
5
  SHA512:
6
- metadata.gz: dcd2c51c3177aea038bba3d939cafda4887d989184faacba4755de7aba5ca8133ac447c2fbf2de896307ade9e0ee2fed890626da3bb9e16bb6e20af8fd345d35
7
- data.tar.gz: e4308c109c55a418c201d3547e40f6106559ef543b647f2bf8ee4755cf5ce7199ca7958cf3811223d5546c3e32dfed261389289a26e50fa07d8c7fb3b1d9ea14
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 :default => :build
8
+ task default: :build
7
9
 
8
- task :build => [:gen_all_run_types, :spec]
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 { |part|
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!('__RUN_TYPES__', all_run_types.join(' '))
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,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require "bundler/setup"
5
+ rescue LoadError
6
+ end
7
+
8
+ begin
9
+ require 'runby_pace'
10
+ rescue LoadError
11
+ require_relative '../lib/runby_pace'
12
+ end
13
+
14
+ cli = Runby::Cli.new(ARGV)
15
+ exit cli.run
@@ -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
@@ -4,7 +4,11 @@ module Runby
4
4
  # Encapsulates data and behavior relating to all run types.
5
5
  module RunTypes
6
6
  def self.all
7
- %w(__RUN_TYPES__)
7
+ %w[__RUN_TYPE_NAMES__]
8
+ end
9
+
10
+ def self.all_classes
11
+ [__RUN_TYPES__]
8
12
  end
9
13
  end
10
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Runby
4
- VERSION = "0.6.#{`git rev-list --count HEAD`}"
4
+ VERSION = "0.61.#{`git rev-list --count HEAD`}"
5
5
  end
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.6.152
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-19 00:00:00.000000000 Z
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: 34c1a65bf667a52675da707cb47a2ab91fbe42f9
111
+ commit-hash: 3fc9ad10f233d833635a4ee48619fcd7957f98f3
110
112
  post_install_message:
111
113
  rdoc_options: []
112
114
  require_paths: