hemlock 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 79318fceb6022d2422b10e3b7e7e1c5adb93185e
4
- data.tar.gz: 439e86d46330d115640765af85fbf46b89fa81b0
3
+ metadata.gz: 6737a05a6e8f8ee6e9e6e69749ddfb1a182102eb
4
+ data.tar.gz: e1b43dfee77e7b83081d9d67c303ad705ff2bcc4
5
5
  SHA512:
6
- metadata.gz: 219d729322a8c45b02c3f6657471b3f73310618fd1565abc62a200206f663968024c2ba625940c0a2fccacf208b28e5b9b4ab7cd4c1c717cb13cee3d27285dab
7
- data.tar.gz: a06716bdaec883b194723ab8eb3400edcc91274964d6658bbf148fce2f42f2bc5c9714f9fe806db49abe0dfddf42cbd8ce139d47ae71c82642c8692174817bf1
6
+ metadata.gz: e19fffe9442b3c1f2ce5e69403ce7185a9f15d5e4e8ad1b79a1ef795a9f62b34a5726d43c73bbef29755bd389daf4722029592653d96f71ce7ecd740f3c8f6da
7
+ data.tar.gz: 7f6083d94fe4dfd458b86d903c90e39d0709d3f8c26b016be47c69b8527bac30918e42b3295c53e69e056333264976aa6e8f3677941d8f9f7d49477220cdc366
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hemlock (0.0.2)
4
+ hemlock (0.0.5)
5
5
  gli (= 2.9.0)
6
+ rainbow (= 1.99.1)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
@@ -33,6 +34,7 @@ GEM
33
34
  coderay (~> 1.0)
34
35
  method_source (~> 0.8)
35
36
  slop (~> 3.4)
37
+ rainbow (1.99.1)
36
38
  rb-fsevent (0.9.4)
37
39
  rb-inotify (0.9.3)
38
40
  ffi (>= 0.5.0)
data/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # Hemlock
2
+
3
+ ```
4
+ gem install hemlock
5
+ hemlock drink ~/Dropbox/flashcards
6
+ ```
7
+ or whatever folder contains .csv flashcards.
8
+
9
+ This was made by me for me to study for the bar. It basically asks me to repeat rules I need to know until they are ingrained in my memory.
10
+
11
+ ## Usage
12
+
13
+ * Don't care about punctuation
14
+
15
+ ## Why the name?
16
+ Hemlock is what Socrates was forced to drink to kill himself. As someone who detested writing, I thought I'd dedicate my forced writing practice to him. RIP old guy.
data/bin/hemlock CHANGED
@@ -17,8 +17,13 @@ end
17
17
  command :drink do |c|
18
18
  c.desc "Crito, we owe a rooster to Asclepius. Please, don't forget to pay the debt."
19
19
 
20
- c.action do
21
- flashcards = Hemlock::CSVtoFlashcards.create_flashcards
20
+ c.action do |global_options, options, args|
21
+ if args.empty?
22
+ puts printf Rainbow("Using Nick's Dropbox folder").blue
23
+ args = []
24
+ end
25
+ flashcards = Hemlock::CSVtoFlashcards.create_flashcards(args.join)
26
+ exit_now!('There are no flashcards in this folder') if flashcards.empty?
22
27
  5.times do
23
28
  seed = rand(0..(flashcards.length - 1))
24
29
  flashcard = flashcards[seed]
@@ -45,16 +50,4 @@ command :drink do |c|
45
50
  end
46
51
  end
47
52
 
48
- post do |global,command,options,args|
49
- # Post logic here
50
- # Use skips_post before a command to skip this
51
- # block on that command only
52
- end
53
-
54
- on_error do |exception|
55
- # Error logic here
56
- # return false to skip default error handling
57
- true
58
- end
59
-
60
53
  exit run(ARGV)
data/hemlock.gemspec CHANGED
@@ -4,7 +4,7 @@ spec = Gem::Specification.new do |s|
4
4
  s.name = 'hemlock'
5
5
  s.version = Hemlock::VERSION
6
6
  s.author = 'Nicholas Shook'
7
- s.email = 'your@email.address.com'
7
+ s.email = 'nicholas.shook@gmail.com'
8
8
  s.homepage = 'https://github.com/shicholas/hemlock'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.summary = 'Memorization through written repetition - Socrates is not amused'
@@ -12,8 +12,7 @@ spec = Gem::Specification.new do |s|
12
12
  ")
13
13
  s.require_paths << 'lib'
14
14
  s.has_rdoc = true
15
- s.extra_rdoc_files = ['README.rdoc','hemlock.rdoc']
16
- s.rdoc_options << '--title' << 'hemlock' << '--main' << 'README.rdoc' << '-ri'
15
+ s.rdoc_options << '--title' << 'hemlock' << '--main' << '-ri'
17
16
  s.bindir = 'bin'
18
17
  s.executables << 'hemlock'
19
18
  s.add_development_dependency('guard-rspec')
@@ -4,9 +4,11 @@ require 'csv'
4
4
  module Hemlock
5
5
  class CSVtoFlashcards
6
6
 
7
- def self.create_flashcards(folder_name="/Dropbox/bar_flashcards")
7
+ def self.create_flashcards(folder_name)
8
+ folder_name = "~/Dropbox/bar_flashcards" if folder_name.empty?
9
+ folder_name = self.replace_tildes(folder_name)
8
10
  flashcards = []
9
- Dir[ENV['HOME'] + "#{folder_name}/*.csv"].each do |file|
11
+ Dir["#{folder_name}/*.csv"].each do |file|
10
12
  flashcards << self.from_file(file)
11
13
  end
12
14
  return flashcards.flatten
@@ -19,5 +21,9 @@ module Hemlock
19
21
  end
20
22
  return flashcards
21
23
  end
24
+
25
+ def self.replace_tildes(folder_name)
26
+ folder_name.sub(/~/, Dir.home)
27
+ end
22
28
  end
23
29
  end
@@ -1,3 +1,3 @@
1
1
  module Hemlock
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -13,4 +13,16 @@ describe Hemlock::CSVtoFlashcards do
13
13
  specify { expect(flashcards.first.question).to eq 'do' }
14
14
  specify { expect(flashcards.last.answer).to eq 'a name I call myself' }
15
15
  end
16
+
17
+ context '#create_flashcards' do
18
+ specify { expect(subject.create_flashcards(nil)).to_not eq [] }
19
+ end
20
+
21
+ context "#replace_tildes" do
22
+ let(:dropbox) { "~/dropbox/" }
23
+ let(:ohmy) { "~/ohmy~/" }
24
+
25
+ specify { expect(subject.replace_tildes(dropbox)).to eq "#{Dir.home}/dropbox/" }
26
+ specify { expect(subject.replace_tildes(ohmy)).to eq "#{Dir.home}/ohmy~/" }
27
+ end
16
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hemlock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Shook
@@ -53,22 +53,19 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.99.1
55
55
  description:
56
- email: your@email.address.com
56
+ email: nicholas.shook@gmail.com
57
57
  executables:
58
58
  - hemlock
59
59
  extensions: []
60
- extra_rdoc_files:
61
- - README.rdoc
62
- - hemlock.rdoc
60
+ extra_rdoc_files: []
63
61
  files:
64
62
  - ".gitignore"
65
63
  - ".rspec"
66
64
  - Gemfile
67
65
  - Gemfile.lock
68
66
  - Guardfile
69
- - README.rdoc
67
+ - README.md
70
68
  - bin/hemlock
71
- - hemlock-0.0.3.gem
72
69
  - hemlock.gemspec
73
70
  - hemlock.rdoc
74
71
  - lib/hemlock.rb
@@ -88,7 +85,6 @@ rdoc_options:
88
85
  - "--title"
89
86
  - hemlock
90
87
  - "--main"
91
- - README.rdoc
92
88
  - "-ri"
93
89
  require_paths:
94
90
  - lib
data/README.rdoc DELETED
@@ -1,6 +0,0 @@
1
- = hemlock
2
-
3
- Describe your project here
4
-
5
- :include:hemlock.rdoc
6
-
data/hemlock-0.0.3.gem DELETED
Binary file