motherducker 0.0.3 → 1.0.1
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 +4 -4
- data/lib/mother_ducker.rb +10 -4
- data/lib/mother_ducker/strategy_orchestrator.rb +88 -4
- data/lib/mother_ducker/user.rb +13 -6
- data/mother_ducker.gemspec +1 -1
- metadata +1 -2
- data/Gemfile.lock +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28e8b94a1c910f0715fb474650690b7ee355ff5112526357c1d31e1151a1bfc9
|
4
|
+
data.tar.gz: 71b93cd55ffea0ed91e4cc7c155ead8f1b283d1302249880f83625e623dace97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a1a61d1dc030b30f226c043784a184b054a6966153b48bdce76189d8d9f18556e85c212e2e639f0e172f1e0d3b284672617b2b3053a7b456a11746177473bf8
|
7
|
+
data.tar.gz: 770c0843eff724262bb1e1c1a069f1976deaa5f20f646ab42cc68dd1d15c4f83cd521f7a9d9b15a449374a528ba12c78b6eaf6fa0444f76d7109f7bfae5094a3
|
data/lib/mother_ducker.rb
CHANGED
@@ -10,22 +10,28 @@ module MotherDucker
|
|
10
10
|
# hackish but who's checking ?
|
11
11
|
# Build a user profile
|
12
12
|
user = User.new
|
13
|
-
# this method call fills out our instance variables
|
14
|
-
user.build_profile
|
15
13
|
# initiate a strategy class, passing it the user instance
|
16
|
-
strategy_orchestrator = StrategyCoordinator.new
|
14
|
+
strategy_orchestrator = StrategyCoordinator.new
|
15
|
+
|
16
|
+
puts "Welcome to the MotherDucker ! I will help you relax and debug your code"
|
17
|
+
puts "On a scale of 1 to 10 ? How frustrated are you ?"
|
18
|
+
|
19
|
+
frustration = gets.chomp
|
20
|
+
|
21
|
+
puts "Ok ! Let's work through that"
|
17
22
|
|
18
23
|
# call Strategy.strategize while user.satisfied == false
|
19
24
|
until user.satisfied
|
20
25
|
# this method asks the user if he is happy currently ?
|
21
|
-
user.enquire_satisfaction
|
22
26
|
strategy_orchestrator.strategize
|
27
|
+
user.enquire_satisfaction
|
23
28
|
|
24
29
|
# fake
|
25
30
|
user.satisfied = true
|
26
31
|
end
|
27
32
|
# it will pick and execute a strategy from the set
|
28
33
|
|
34
|
+
puts "thanks for using me! see you soon !"
|
29
35
|
end
|
30
36
|
end
|
31
37
|
end
|
@@ -1,12 +1,96 @@
|
|
1
1
|
module MotherDucker
|
2
|
+
|
3
|
+
|
2
4
|
class StrategyCoordinator
|
3
|
-
|
4
|
-
|
5
|
+
TEXT_ARRAY = [ "Get comfortable",
|
6
|
+
"Relax your body by releasing any areas of tension",
|
7
|
+
"You're at a hackathon... You've been coding for hours...",
|
8
|
+
"Forget about bugs... Forget about method errors...",
|
9
|
+
"Close your eyes...",
|
10
|
+
"Breathe in deeply , drawing air fully into your lungs....",
|
11
|
+
"And release the air...",
|
12
|
+
"Breathe in again, slowly....",
|
13
|
+
"Out.....🌬",
|
14
|
+
"In.....",
|
15
|
+
"Become more and more relaxed with each breath...",
|
16
|
+
"Out..... 😤😤😤",
|
17
|
+
"🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈"
|
18
|
+
]
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
@meditation_used = false
|
22
|
+
@debugging_used = false
|
5
23
|
end
|
6
24
|
|
7
25
|
def strategize
|
8
|
-
|
9
|
-
|
26
|
+
if !(@meditation_used)
|
27
|
+
meditate
|
28
|
+
elsif !(@debugging_used)
|
29
|
+
debug
|
30
|
+
else
|
31
|
+
puts "we did what we could ! maybe take a nap ? or look at memes?"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def meditate
|
36
|
+
emoji_array = ["🌬", "😤", "🌈"]
|
37
|
+
|
38
|
+
puts "I think some meditation would be useful. Let me guide you through it"
|
39
|
+
|
40
|
+
TEXT_ARRAY.each do |sentence|
|
41
|
+
sleep_with_dots(3)
|
42
|
+
puts sentence
|
43
|
+
speech_sentence = sentence.split.reject { |word| emoji_array.include?(word.chomp) }
|
44
|
+
|
45
|
+
# %x(say "#{speech_sentence}")
|
46
|
+
end
|
47
|
+
|
48
|
+
puts "Hope that was helpful"
|
49
|
+
|
50
|
+
@meditation_used = true
|
51
|
+
end
|
52
|
+
|
53
|
+
def debug
|
54
|
+
puts "What about some debugging?"
|
55
|
+
puts "copy and paste the error which you are seeing, I will help you understand it:"
|
56
|
+
error = gets.chomp
|
57
|
+
|
58
|
+
parse_error(error)
|
59
|
+
|
60
|
+
@debugging_used = true
|
61
|
+
end
|
62
|
+
|
63
|
+
def parse_error(error)
|
64
|
+
if message.match(/undefined method/)
|
65
|
+
line = /\:\d+\:/.match(message)[0].gsub(":", "")
|
66
|
+
file_name = /\#\<\w+\:/.match(message)[0].gsub("#<", "").gsub(":", "")
|
67
|
+
puts "\n"
|
68
|
+
puts "Looks like we have an undefined method on line #{line} of your #{file_name.downcase}.rb file.\n Do you know what this means?"
|
69
|
+
answer_1 = gets.chomp
|
70
|
+
if answer_1 == "yes"
|
71
|
+
puts "Then go to line #{line} and fix it..."
|
72
|
+
else
|
73
|
+
puts "You haven't properly defined a method in your #{file_name} class."
|
74
|
+
puts "Let's go to line #{line} of your code, and see what's wrong."
|
75
|
+
puts "Which method is being called on line #{line}?"
|
76
|
+
method_name = gets.chomp
|
77
|
+
puts "Is there a method defined \"#{method_name}\" in your #{file_name} class?"
|
78
|
+
answer_2 = gets.chomp
|
79
|
+
if answer_2 == "no"
|
80
|
+
puts "Create a method named \"#{method_name}\" in your #{file_name} class."
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def sleep_with_dots(seconds)
|
87
|
+
i = 0
|
88
|
+
while i < seconds
|
89
|
+
sleep(0.5)
|
90
|
+
print "."
|
91
|
+
i += 0.5
|
92
|
+
end
|
93
|
+
puts ""
|
10
94
|
end
|
11
95
|
end
|
12
96
|
end
|
data/lib/mother_ducker/user.rb
CHANGED
@@ -8,14 +8,21 @@ module MotherDucker
|
|
8
8
|
@satisified = false
|
9
9
|
end
|
10
10
|
|
11
|
-
def build_profile
|
12
|
-
|
13
|
-
|
14
|
-
end
|
11
|
+
# def build_profile
|
12
|
+
# puts "Code me ! User#build_profile! I will build the user profile"
|
13
|
+
# end
|
15
14
|
|
16
15
|
def enquire_satisfaction
|
17
|
-
|
18
|
-
|
16
|
+
puts "Are you feeling better ? [ y | n ]"
|
17
|
+
input = gets.chomp
|
18
|
+
case input.downcase
|
19
|
+
when "y", "yes"
|
20
|
+
@satisfied = true
|
21
|
+
when "n", "no"
|
22
|
+
@satisfied = false
|
23
|
+
else
|
24
|
+
puts "I don't understand. I will try something anyway"
|
25
|
+
end
|
19
26
|
end
|
20
27
|
end
|
21
28
|
end
|
data/mother_ducker.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motherducker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Korelsky
|
@@ -48,7 +48,6 @@ files:
|
|
48
48
|
- ".gitignore"
|
49
49
|
- GEM_CHEATSHEET.md
|
50
50
|
- Gemfile
|
51
|
-
- Gemfile.lock
|
52
51
|
- README
|
53
52
|
- Rakefile
|
54
53
|
- bin/motherducker
|
data/Gemfile.lock
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
ast (2.4.0)
|
5
|
-
jaro_winkler (1.5.1)
|
6
|
-
parallel (1.12.1)
|
7
|
-
parser (2.5.1.2)
|
8
|
-
ast (~> 2.4.0)
|
9
|
-
powerpack (0.1.2)
|
10
|
-
rainbow (3.0.0)
|
11
|
-
rubocop (0.58.1)
|
12
|
-
jaro_winkler (~> 1.5.1)
|
13
|
-
parallel (~> 1.10)
|
14
|
-
parser (>= 2.5, != 2.5.1.1)
|
15
|
-
powerpack (~> 0.1)
|
16
|
-
rainbow (>= 2.2.2, < 4.0)
|
17
|
-
ruby-progressbar (~> 1.7)
|
18
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
19
|
-
ruby-progressbar (1.9.0)
|
20
|
-
unicode-display_width (1.4.0)
|
21
|
-
|
22
|
-
PLATFORMS
|
23
|
-
ruby
|
24
|
-
|
25
|
-
DEPENDENCIES
|
26
|
-
rubocop
|
27
|
-
|
28
|
-
BUNDLED WITH
|
29
|
-
1.16.1
|