hemlock 0.0.0 → 0.0.2

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: a9d1a03509f380308e3993c26f2bdef8e75d97ea
4
- data.tar.gz: c4a3cfaebb0289875a6fa1513706beb761cc06b8
3
+ metadata.gz: 937e8ce767d9cc97e9927fe12b78fe68ae659892
4
+ data.tar.gz: 5e76236702d3a3a9520bcb2c95476b426c50b458
5
5
  SHA512:
6
- metadata.gz: 6de88d55701989b59aba63663b0629c33f0092e84a12abf3db6357848ad8a8ed2da6b048a5e945ed861e820f85de796fec0ea3bef0d5e998d9146606fd77aa61
7
- data.tar.gz: beccba8ef84223c920be6533aeb203830e9a4e8d11ef7cf540eeba49bbd2a8dac5d18cf3dac2e063402597a583814de81c307d3f30b383f2aa7f3cce3c22b3ae
6
+ metadata.gz: 77c0f0f9c1ad99f9f6343f3e3a6d76b4f71b64b2d8b20722992cc7ae256021c72ce8dfa9487df212a5cc0a0cb1bee362bd46300367cb55cb51b83ee89fc1fafd
7
+ data.tar.gz: d50a02f2c3d6aeb9873377c10d8e96b2dd62b757171b3b51e192da693a97799c728fe4b3930cde1e5d65a51c68ee214ceea97484514318cb75cf104fad9a9ee5
@@ -0,0 +1,2 @@
1
+ tmp
2
+ .bundle
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ -c
2
+ -fd
3
+
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hemlock (0.0.2)
5
+ gli (= 2.9.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ celluloid (0.15.2)
11
+ timers (~> 1.1.0)
12
+ coderay (1.1.0)
13
+ diff-lcs (1.2.5)
14
+ ffi (1.9.3)
15
+ formatador (0.2.4)
16
+ gli (2.9.0)
17
+ guard (2.3.0)
18
+ formatador (>= 0.2.4)
19
+ listen (~> 2.1)
20
+ lumberjack (~> 1.0)
21
+ pry (>= 0.9.12)
22
+ thor (>= 0.18.1)
23
+ guard-rspec (4.2.4)
24
+ guard (~> 2.1)
25
+ rspec (>= 2.14, < 4.0)
26
+ listen (2.4.0)
27
+ celluloid (>= 0.15.2)
28
+ rb-fsevent (>= 0.9.3)
29
+ rb-inotify (>= 0.9)
30
+ lumberjack (1.0.4)
31
+ method_source (0.8.2)
32
+ pry (0.9.12.4)
33
+ coderay (~> 1.0)
34
+ method_source (~> 0.8)
35
+ slop (~> 3.4)
36
+ rb-fsevent (0.9.4)
37
+ rb-inotify (0.9.3)
38
+ ffi (>= 0.5.0)
39
+ rspec (2.14.1)
40
+ rspec-core (~> 2.14.0)
41
+ rspec-expectations (~> 2.14.0)
42
+ rspec-mocks (~> 2.14.0)
43
+ rspec-core (2.14.7)
44
+ rspec-expectations (2.14.4)
45
+ diff-lcs (>= 1.1.3, < 2.0)
46
+ rspec-mocks (2.14.4)
47
+ slop (3.4.7)
48
+ thor (0.18.1)
49
+ timers (1.1.0)
50
+
51
+ PLATFORMS
52
+ ruby
53
+
54
+ DEPENDENCIES
55
+ guard-rspec
56
+ hemlock!
@@ -0,0 +1,24 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+
9
+ # Rails example
10
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
+ watch('config/routes.rb') { "spec/routing" }
15
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
16
+
17
+ # Capybara features specs
18
+ watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
19
+
20
+ # Turnip features and steps
21
+ watch(%r{^spec/acceptance/(.+)\.feature$})
22
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
+ end
24
+
@@ -0,0 +1,6 @@
1
+ = hemlock
2
+
3
+ Describe your project here
4
+
5
+ :include:hemlock.rdoc
6
+
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+ require 'gli'
3
+ require 'hemlock'
4
+ require 'readline'
5
+
6
+ include GLI::App
7
+
8
+ program_desc 'Memorization through repetitive writing - Socrates is not amused'
9
+
10
+ version Hemlock::VERSION
11
+
12
+ pre do |global,command,options,args|
13
+ true
14
+ end
15
+
16
+ command :drink do |c|
17
+ c.desc "Crito, we owe a rooster to Asclepius. Please, don't forget to pay the debt."
18
+
19
+ c.action do
20
+ flashcards = Hemlock::CSVtoFlashcards.create_flashcards
21
+ 5.times do
22
+ seed = rand(0..(flashcards.length - 1))
23
+ flashcard = flashcards[seed]
24
+ puts flashcard.question
25
+ answer = Readline.readline('>', false)
26
+ if answer == flashcard.answer
27
+ puts 'Correct'
28
+ else
29
+ puts 'You must submit to the quarries'
30
+ 3.times do
31
+ puts flashcard.question
32
+ puts flashcard.answer
33
+ answer = Readline.readline('>', false)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ post do |global,command,options,args|
41
+ # Post logic here
42
+ # Use skips_post before a command to skip this
43
+ # block on that command only
44
+ end
45
+
46
+ on_error do |exception|
47
+ # Error logic here
48
+ # return false to skip default error handling
49
+ true
50
+ end
51
+
52
+ exit run(ARGV)
@@ -0,0 +1,21 @@
1
+ # Ensure we require the local version and not one we might have installed already
2
+ require File.join([File.dirname(__FILE__),'lib','hemlock','version.rb'])
3
+ spec = Gem::Specification.new do |s|
4
+ s.name = 'hemlock'
5
+ s.version = Hemlock::VERSION
6
+ s.author = 'Nicholas Shook'
7
+ s.email = 'your@email.address.com'
8
+ s.homepage = 'https://github.com/shicholas/hemlock'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.summary = 'Memorization through written repetition - Socrates is not amused'
11
+ s.files = `git ls-files`.split("
12
+ ")
13
+ s.require_paths << 'lib'
14
+ s.has_rdoc = true
15
+ s.extra_rdoc_files = ['README.rdoc','hemlock.rdoc']
16
+ s.rdoc_options << '--title' << 'hemlock' << '--main' << 'README.rdoc' << '-ri'
17
+ s.bindir = 'bin'
18
+ s.executables << 'hemlock'
19
+ s.add_development_dependency('guard-rspec')
20
+ s.add_runtime_dependency('gli','2.9.0')
21
+ end
@@ -0,0 +1,5 @@
1
+ = hemlock
2
+
3
+ Generate this with
4
+ hemlock rdoc
5
+ After you have described your command line interface
@@ -1,5 +1,5 @@
1
- class Hemlock
2
- def drink
3
- puts "Never!"
4
- end
1
+ require 'hemlock/version.rb'
2
+ require 'hemlock/csv_to_flashcards'
3
+
4
+ module Hemlock
5
5
  end
@@ -0,0 +1,23 @@
1
+ require_relative 'flashcard'
2
+ require 'csv'
3
+
4
+ module Hemlock
5
+ class CSVtoFlashcards
6
+
7
+ def self.create_flashcards(folder_name="/Dropbox/bar_flashcards")
8
+ flashcards = []
9
+ Dir[ENV['HOME'] + "#{folder_name}/*.csv"].each do |file|
10
+ flashcards << self.from_file(file)
11
+ end
12
+ return flashcards.flatten
13
+ end
14
+
15
+ def self.from_file(file)
16
+ flashcards = []
17
+ CSV.read(file).each do |row|
18
+ flashcards << Flashcard.new(row[0], row[1]) unless row[0].nil?
19
+ end
20
+ return flashcards
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ module Hemlock
2
+ class Flashcard
3
+ def initialize(term, definition)
4
+ @term = term
5
+ @definition = definition
6
+ end
7
+
8
+ attr_reader :term, :definition
9
+
10
+ alias_method :question, :term
11
+ alias_method :answer, :definition
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module Hemlock
2
+ VERSION = '0.0.2'
3
+ end
File without changes
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe Hemlock::CSVtoFlashcards do
4
+
5
+ subject { described_class }
6
+ let(:csv) { './spec/stub.csv' }
7
+
8
+ context '#from_file' do
9
+ let(:flashcards) { subject.from_file(csv) }
10
+
11
+ specify { expect(flashcards.length).to eq 3 }
12
+ specify { expect(flashcards.first).to be_a_kind_of Hemlock::Flashcard }
13
+ specify { expect(flashcards.first.question).to eq 'do' }
14
+ specify { expect(flashcards.last.answer).to eq 'a name I call myself' }
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ require "spec_helper"
2
+
3
+ describe Hemlock::Flashcard do
4
+
5
+ let(:flashcard) { Hemlock::Flashcard.new('blue', 'a great color') }
6
+
7
+ specify { expect(flashcard.term).to eq 'blue' }
8
+ specify { expect(flashcard.question).to eq 'blue' }
9
+
10
+ specify { expect(flashcard.definition).to eq 'a great color' }
11
+ specify { expect(flashcard.answer).to eq 'a great color' }
12
+
13
+ end
@@ -0,0 +1,20 @@
1
+ require 'hemlock/csv_to_flashcards'
2
+ require 'thor'
3
+ require 'stringio'
4
+
5
+ RSpec.configure do |config|
6
+ config.treat_symbols_as_metadata_keys_with_true_values = true
7
+ config.run_all_when_everything_filtered = true
8
+ config.filter_run :focus
9
+ config.order = 'random'
10
+ end
11
+
12
+ def capture_stdout &block
13
+ old_stdout = $stdout
14
+ fake_stdout = StringIO.new
15
+ $stdout = fake_stdout
16
+ block.call
17
+ fake_stdout.string
18
+ ensure
19
+ $stdout = old_stdout
20
+ end
@@ -0,0 +1,3 @@
1
+ do,a deer a female deer
2
+ ray,a drop of golden sun
3
+ me,a name I call myself
metadata CHANGED
@@ -1,32 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hemlock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Shook
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-17 00:00:00.000000000 Z
12
- dependencies: []
13
- description: A flashcard CLI tool that will ask a user to type out the answer exactly,
14
- if the user fails to input the correct answer, he must then enter the correct information
15
- three times in a row
16
- email: nicholas.shook@gmail.com
17
- executables: []
11
+ date: 2014-01-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: guard-rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: gli
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 2.9.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 2.9.0
41
+ description:
42
+ email: your@email.address.com
43
+ executables:
44
+ - hemlock
18
45
  extensions: []
19
- extra_rdoc_files: []
46
+ extra_rdoc_files:
47
+ - README.rdoc
48
+ - hemlock.rdoc
20
49
  files:
50
+ - ".gitignore"
51
+ - ".rspec"
52
+ - Gemfile
53
+ - Gemfile.lock
54
+ - Guardfile
55
+ - README.rdoc
56
+ - bin/hemlock
57
+ - hemlock.gemspec
58
+ - hemlock.rdoc
21
59
  - lib/hemlock.rb
60
+ - lib/hemlock/csv_to_flashcards.rb
61
+ - lib/hemlock/flashcard.rb
62
+ - lib/hemlock/version.rb
63
+ - results.html
64
+ - spec/hemlock/csv_to_flashcards_spec.rb
65
+ - spec/hemlock/flashcard_spec.rb
66
+ - spec/spec_helper.rb
67
+ - spec/stub.csv
22
68
  homepage: https://github.com/shicholas/hemlock
23
- licenses:
24
- - MIT
69
+ licenses: []
25
70
  metadata: {}
26
71
  post_install_message:
27
- rdoc_options: []
72
+ rdoc_options:
73
+ - "--title"
74
+ - hemlock
75
+ - "--main"
76
+ - README.rdoc
77
+ - "-ri"
28
78
  require_paths:
29
79
  - lib
80
+ - lib
30
81
  required_ruby_version: !ruby/object:Gem::Requirement
31
82
  requirements:
32
83
  - - ">="
@@ -39,8 +90,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
90
  version: '0'
40
91
  requirements: []
41
92
  rubyforge_project:
42
- rubygems_version: 2.2.0
93
+ rubygems_version: 2.2.1
43
94
  signing_key:
44
95
  specification_version: 4
45
- summary: A flashcard CLI tool
96
+ summary: Memorization through written repetition - Socrates is not amused
46
97
  test_files: []