flashcards 0.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.
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2008-05-05
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
@@ -0,0 +1,10 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/flashcards
6
+ lib/flashcards.rb
7
+ lib/flashcards
8
+ lib/flashcards/lips.jpg
9
+ lib/flashcards/base.rb
10
+ lib/flashcards/util.rb
@@ -0,0 +1,48 @@
1
+ = vocab
2
+
3
+ * http://fr.ivolo.us (url)
4
+
5
+ == DESCRIPTION:
6
+
7
+ Vocab Trainer (describe your package)
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * Trains you how to speak other languages (list of features or problems)
12
+
13
+ == SYNOPSIS:
14
+
15
+ vocab filename inteval where interval is a decimal (code sample of usage)
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * growl fastercsv (list of requirements)
20
+
21
+ == INSTALL:
22
+
23
+ * sudo gem install vocab (sudo gem install, anything else)
24
+
25
+ == LICENSE:
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2008 FIX
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'hoe'
3
+ require 'fastercsv'
4
+ require './lib/flashcards.rb'
5
+
6
+ Hoe.new('flashcards', FlashCards::VERSION) do |p|
7
+ p.rubyforge_name = 'flashcards' # if different than lowercase project name
8
+ p.developer('Josh Stephenson', 'fr@ivolo.us')
9
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'flashcards'
5
+ require 'flashcards/util'
6
+
7
+ FlashCards::Util.run!
@@ -0,0 +1,7 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+ module FlashCards
3
+ VERSION = '0.0.1'
4
+ end
5
+ require 'rubygems'
6
+ require 'flashcards/base'
7
+ require 'flashcards/util'
@@ -0,0 +1,42 @@
1
+ module FlashCards
2
+ class GrowlNotification
3
+ FULL_IMAGE_PATH = File.join(File.dirname(__FILE__), '/lips.jpg')
4
+ def initialize(title, body)
5
+ %x(growlnotify --image #{FULL_IMAGE_PATH} -t "#{title}" -m "#{body}")
6
+ end
7
+ end
8
+ class Base
9
+ attr_accessor :flashcards_file, :interval, :lines, :index, :line_count
10
+
11
+ def initialize(filename, interval = 10)
12
+ @flashcards_file = filename
13
+ @interval = interval.to_f
14
+ @index = 1
15
+ end
16
+
17
+ def run!
18
+ file = File.open(@flashcards_file)
19
+ @lines = file.readlines
20
+ headers = lines.shift
21
+ @line_count = lines.size
22
+ file.close
23
+ read_and_print
24
+ end
25
+
26
+ def next_line(random = false)
27
+ line = random ? lines[rand(line_count)] : lines[index]
28
+ line.split(',')
29
+ end
30
+
31
+ def read_and_print
32
+ while true
33
+ title, body = next_line(true)
34
+ # reset index
35
+ index = (index == line_count - 1) ? 0 : self.index + 1
36
+ GrowlNotification.new(title, body)
37
+ sleep interval
38
+ read_and_print
39
+ end
40
+ end
41
+ end
42
+ end
Binary file
@@ -0,0 +1,42 @@
1
+ module FlashCards
2
+ class Util < FlashCards::Base
3
+ class << self
4
+ def run!
5
+ dictionary, sleep_time = parse_args
6
+ FlashCards::Base.new(dictionary, sleep_time).run!
7
+ end
8
+
9
+ def parse_args
10
+ unless ARGV.size >= 1
11
+ usage
12
+ exit
13
+ end
14
+
15
+ dictionary = ARGV[0]
16
+ unless File.exist?(dictionary)
17
+ raise "Flashcards File Does Not Exist"
18
+ end
19
+
20
+ sleep_time = ARGV[1]
21
+ if sleep_time.nil?
22
+ sleep_time = 60
23
+ end
24
+ [dictionary, sleep_time]
25
+ end
26
+
27
+ def usage
28
+ puts "
29
+ Usage: #{$0} [Dictionary CSV File] [Sleep Time]
30
+
31
+ Dictionary CSV File:
32
+ Any file with comma separated values. Format is:
33
+ English, Spanish
34
+ what, que
35
+
36
+ EXAMPLE:
37
+ #{$0} ~/documents/my_spanish_flashcards.csv 60
38
+ "
39
+ end
40
+ end
41
+ end
42
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flashcards
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Josh Stephenson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-09-10 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.7.0
24
+ version:
25
+ description: Vocab Trainer (describe your package)
26
+ email:
27
+ - fr@ivolo.us
28
+ executables:
29
+ - flashcards
30
+ extensions: []
31
+
32
+ extra_rdoc_files:
33
+ - History.txt
34
+ - Manifest.txt
35
+ - README.txt
36
+ files:
37
+ - History.txt
38
+ - Manifest.txt
39
+ - README.txt
40
+ - Rakefile
41
+ - bin/flashcards
42
+ - lib/flashcards.rb
43
+ - lib/flashcards
44
+ - lib/flashcards/lips.jpg
45
+ - lib/flashcards/base.rb
46
+ - lib/flashcards/util.rb
47
+ has_rdoc: true
48
+ homepage: http://fr.ivolo.us (url)
49
+ post_install_message:
50
+ rdoc_options:
51
+ - --main
52
+ - README.txt
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ version:
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: "0"
66
+ version:
67
+ requirements: []
68
+
69
+ rubyforge_project: flashcards
70
+ rubygems_version: 1.2.0
71
+ signing_key:
72
+ specification_version: 2
73
+ summary: Vocab Trainer (describe your package)
74
+ test_files: []
75
+