ath_vega 0.1.15 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e20e05e02eefadf5ec3acad6febd5f3c6ab15b77976c5d610fcaa791e6abc768
4
- data.tar.gz: 70b6cc57050b221c5be117fd061991f6a57f87fec29d31f531434970c0127dd6
3
+ metadata.gz: a7cd183d010fe994906bb0fd9270d5b7ef99cc8f991a392ec7b5a72339e48c92
4
+ data.tar.gz: 07034a0886625a8483c1842150f20670b85c1599e248fad04e0daa35db54bd5a
5
5
  SHA512:
6
- metadata.gz: 4b736f7ff1c7d69c4d99d70460d11696160540f07d42459edecdba7fd2b5fc880e6eeeb0b1419d606951dc692a139ab6fc9e58c52012dc474c54c425d3b0a10e
7
- data.tar.gz: 223085c829d1c48de7a96db96aa1a9bf588eef60f9daca9b6cdecedc46bab71a40131064c0f3fbd24807a2503afc99edd34fe9de718ccf05e576044eda771c06
6
+ metadata.gz: 0bfc15eac5728ee3ef804898bae0758bdef907cc8fdbd9afc049eed2715169a81c7a3d098f76f2e53f9c86dd4cb800bf1a69ca3f54156b5d641aab6c40295440
7
+ data.tar.gz: 27c35c3e0fe1e08fafb469cc4dfd3de3a4109f16429087d2eed1468037e6e05c3f01035ecd71486dd3812da6403541625368efbe65461bf7615e08eaf3f5eb08
@@ -11,6 +11,9 @@ require 'nokogiri'
11
11
  require 'pry'
12
12
  require 'catpix'
13
13
  require 'rmagick'
14
+ require 'tty-font'
15
+ require 'tty-prompt'
16
+ require 'tty-progressbar'
14
17
  require_all 'lib'
15
18
  # require_relative '../lib/ath_vega'
16
19
  # require_relative '../lib/vega_api'
data/lib/ath_vega/cli.rb CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  class CLI
4
4
 
5
+
5
6
  def list_categories # lists categories as hash w/ index for use in menu
6
7
  categories = {}
7
8
  API.new.get_category_objects.each.with_index { |cat, idx| categories[:"#{cat.muscle}"] = idx }
9
+ categories.shift
8
10
  categories
9
11
  end
10
12
 
@@ -20,45 +22,58 @@ class CLI
20
22
  cat_obj = selected_category(prompt.select("Select muscle group to see exercises", list_categories, cycle:true)) # menu to select muscle category. It returns index value to get instance of category from Category class array
21
23
  end
22
24
 
25
+ def selected_exercise(user_exercise_selection)
26
+ get_exercise_objects[user_exercise_selection] #receives index location and returns object instance from array of instances in Category class
27
+ end
28
+
29
+ def abs_cat_object
30
+ abs_obj = Category.all[0]
31
+ end
32
+
33
+ def abs_exercise_items(abs_obj)
34
+ ab_exercises = {}
35
+ abs_obj.get_exercises.each.with_index { |exr, idx| ab_exercises[:"\n#{exr.name}\n#{exr.description}"] = idx }
36
+ ab_exercises
37
+ end
38
+
39
+ def abs_menu
40
+ abs_obj = abs_cat_object
41
+ abs_exr = API.new.get_exercise_for_cat(abs_obj, prompt.select("Select an ab exercise", abs_exercise_items(abs_obj), cycle:true))
42
+ end
43
+
23
44
  def list_items(cat_obj) # takes instance of Category class as argument, and returns list of exercises that belong to it
24
45
  exercises = {}
25
46
  cat_obj.get_exercises.each.with_index { |exr, idx| exercises[:"#{exr.name}\n#{exr.description}"] = idx }
26
47
  exercises
27
48
  end
28
49
 
29
- def selected_exercise(user_exrcise_selection)
30
- get_exercise_objects[user_exrcise_selection] #receives index location and returns object instance from array of instances in Category class
31
- end
32
-
33
50
  def exercise_menu(cat_obj) # takes value of user_selection variable returned from category_menu method as argument
34
51
  exr_obj = API.new.get_exercise_for_cat(cat_obj, prompt.select("Select an exercise to add to your workout", list_items(cat_obj), cycle:true))
35
52
  end
36
53
 
37
54
  def show_workout(workout_session)
38
- table = TTY::Table.new(["Session Exercises:", "#{workout_session.session_exercises[2].name}","#{workout_session.session_exercises[1].name}", "#{workout_session.session_exercises[0].name}"], [["Set/Reps:", "", "", ""]])
39
- puts table.render :unicode
55
+ exr_group_1 = TTY::Table.new(["Session Exercises:", "Group 1: #{workout_session.session_exercises[0].name} \/ #{workout_session.session_exercises[1].name}","Group 2: #{workout_session.session_exercises[2].name} \/ #{workout_session.session_exercises[3].name}", "Group 3: #{workout_session.session_exercises[4].name}"], [["set/reps:", " ", " ", " "]])
56
+ puts exr_group_1.render :unicode
40
57
  end
41
58
 
42
59
  def start
60
+ title = TTY::Font.new(:starwars)
61
+ title_color = Pastel.new
43
62
  puts "
44
63
 
45
64
  ∎∎∎
46
65
  ∎∎∎∎∎
47
66
  | |
48
67
  ∎∎∎∎∎
49
- ∎∎∎∎∎ Ivory Tower Studios presents...
68
+ ∎∎∎∎∎
50
69
  "
70
+ puts "Ivory Tower Studios presents..."
51
71
  sleep 2
52
- puts "ATH 'vega' the workout app for ninjas."
53
- puts "\n(built on the open source 'wger' platform)"
72
+ puts title_color.red(title.write("ATH"))
73
+ puts "THE NINJA WORKOUT APP"
74
+ puts title_color.blue(title.write("VEGA"))
75
+ puts "\nbuilt with the open source wger app"
54
76
  sleep 1
55
- Catpix::print_image "./lib/ninja-gaiden.png",
56
- :limit_x => 0.15,
57
- :limit_y => 0,
58
- :center_x => false,
59
- :center_y => false,
60
- :bg => "white",
61
- :bg_fill => false
62
77
  puts "Let's get started!"
63
78
  end
64
79
 
@@ -80,13 +95,21 @@ class CLI
80
95
  new_workout_session = vega_api.create_workout
81
96
  create_objects(vega_api)
82
97
  prompt
83
- while new_workout_session.session_exercises.length < 3
98
+ # abs_menu
99
+ # binding.pry
100
+ while new_workout_session.session_exercises.length < 4
84
101
  cat_obj = nil
85
102
  exr_obj = nil
86
103
  cat_obj = category_menu
87
104
  exr_obj = exercise_menu(cat_obj)
88
105
  exr_obj.workout = new_workout_session
89
106
  end
107
+ puts "\nNow select your ab exercise"
108
+ puts "\n"
109
+ ab_exr = abs_menu
110
+ ab_exr.workout = new_workout_session
111
+ new_workout_session.set_exercise_array
112
+ # binding.pry
90
113
  show_workout(new_workout_session)
91
114
  end
92
115
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AthVega
4
- VERSION = "0.1.15"
4
+ VERSION = "0.1.16"
5
5
  end
data/lib/workout.rb CHANGED
@@ -2,6 +2,7 @@ class Workout
2
2
  attr_accessor :id, :creation_date, :comments, :workout_hash
3
3
 
4
4
  @@all = []
5
+ @exercises = []
5
6
 
6
7
 
7
8
  def initialize(id, comments=nil, creation_date=Time.new.strftime("%Y-%m-%d"))
@@ -9,6 +10,7 @@ class Workout
9
10
  @comments = comments
10
11
  @creation_date = creation_date
11
12
  @@all << self
13
+ @exercises = []
12
14
  @workout_hash = self.hash_workout
13
15
  end
14
16
 
@@ -26,6 +28,13 @@ class Workout
26
28
  end
27
29
 
28
30
  def session_exercises
29
- Exercise.all.select { |exr| exr.workout == self }
31
+ @exercises = Exercise.all.select { |exr| exr.workout == self }
32
+ end
33
+
34
+ def set_exercise_array
35
+ exercises = self.session_exercises
36
+ match = self.session_exercises.find { |exr| exr.muscle == "Abs" }
37
+ match_index = self.session_exercises.index(match)
38
+ exercises = exercises.insert(-1,exercises.delete_at(match_index))
30
39
  end
31
40
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ath_vega
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmaud R. Templeton
@@ -206,6 +206,34 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: 0.12.0
209
+ - !ruby/object:Gem::Dependency
210
+ name: tty-font
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - '='
214
+ - !ruby/object:Gem::Version
215
+ version: 0.5.0
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - '='
221
+ - !ruby/object:Gem::Version
222
+ version: 0.5.0
223
+ - !ruby/object:Gem::Dependency
224
+ name: pastel
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - '='
228
+ - !ruby/object:Gem::Version
229
+ version: 0.8.0
230
+ type: :runtime
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - '='
235
+ - !ruby/object:Gem::Version
236
+ version: 0.8.0
209
237
  description: Ath helps you plan your workout using exercises from the open source
210
238
  app, 'wger'.
211
239
  email:
@@ -227,7 +255,6 @@ files:
227
255
  - lib/ath_vega/version.rb
228
256
  - lib/category.rb
229
257
  - lib/exercise.rb
230
- - lib/ninja-gaiden.png
231
258
  - lib/vega_api.rb
232
259
  - lib/workout.rb
233
260
  - pkg/ath_vega-0.1.13.gem
data/lib/ninja-gaiden.png DELETED
Binary file