wkcheck 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +46 -0
  3. data/bin/wkcheck +38 -0
  4. data/lib/wkcheck.rb +24 -0
  5. data/wkcheck.gemspec +27 -0
  6. metadata +118 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1e071a3e6a1aa9c5a94e5cff33e1a46f1e9946b3
4
+ data.tar.gz: 91678d915c78a7381c672cbb51798abd46ea6add
5
+ SHA512:
6
+ metadata.gz: d56c3205e7362729510d085aa7ea92307c96502dbfa3b8ceac2e562707623aff98b4b09a5baea6647937bb0882d6cdd5b792703b5285c262d66461ca2329af2d
7
+ data.tar.gz: 0437d3b35635beb805c40dde5e1f5e1521ec7008cfe58cae24a095f870cf23e72f438c90ca90d4359675918f64d917804883554b1617d395db4ba06979825e50
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ [![Build Status](https://travis-ci.org/dennmart/wkcheck.png)](https://travis-ci.org/dennmart/wkcheck)
2
+
3
+ **wkcheck** is a command-line tool to access information from your [WaniKani](http://www.wanikani.com/) account.
4
+
5
+ ## Installation
6
+ ```
7
+ $ gem install wanikani
8
+ ```
9
+
10
+ ## API Key
11
+
12
+ Before using wkcheck, you need to set up the WaniKani API key from your account. You need to use the `--api-key` flag to save your API Key for future use. This only needs to be done once. A file will be created in `~/.wkcheck.yml` with your API Key. The key can be found in your [account settings](http://www.wanikani.com/account).
13
+
14
+ ```
15
+ $ wkcheck --api-key=YOUR_WANIKANI_API_KEY
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ Once the API Key is saved, simply run `wkcheck` to see how many lessons and reviews you have pending in WaniKani.
21
+
22
+ ```
23
+ $ wkcheck
24
+ You have no lessons pending.
25
+ You have 93 reviews pending.
26
+ ```
27
+
28
+ If you don't have any lessons or reviews pending, you'll be able to see when your next review will come up.
29
+
30
+ ```
31
+ $ wkcheck
32
+ You have no lessons or reviews now! You'll have some more on Sunday, May 10 at 8:45 AM.
33
+ ```
34
+
35
+ ## Contributing
36
+
37
+ I'll be super-happy if you guys help giving back! If you want to do some hacking on wkcheck for your needs, this is a good guideline to get started:
38
+
39
+ * Fork the repo on GitHub
40
+ * Create a branch on your clone that will contain your changes
41
+ * Hack away on your branch
42
+ * Add tests in the `/features` or `/test` directory relating to your changes
43
+ * Make sure all tests still pass (`rake test_all`)
44
+ * If you're adding new functionality, make sure to update `README.md`
45
+ * Push the branch to GitHub
46
+ * Send me a pull request for your branch
data/bin/wkcheck ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'yaml'
4
+ require 'slop'
5
+
6
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
7
+ require 'wkcheck'
8
+
9
+ opts = Slop.parse(help: true) do
10
+ banner "Usage: wkcheck [options]"
11
+
12
+ on "api-key=", "Saves your WaniKani API Key to #{WKCheck::CONFIG_FILE}"
13
+
14
+ on "v", "version", "Show version number and quit" do
15
+ puts "wkcheck #{WKCheck::VERSION}"
16
+ exit
17
+ end
18
+ end
19
+
20
+ unless opts["api-key"].nil? || opts["api-key"].empty?
21
+ File.open(WKCheck::CONFIG_FILE, 'w') { |f| f.write({ api_key: opts["api-key"] }.to_yaml) } unless opts["api-key"].nil?
22
+ puts "WaniKani API Key saved to #{WKCheck::CONFIG_FILE}!"
23
+ exit
24
+ end
25
+
26
+ api_key = if File.exists?(WKCheck::CONFIG_FILE)
27
+ config = YAML.load_file(WKCheck::CONFIG_FILE)
28
+ config[:api_key]
29
+ end
30
+
31
+ if api_key.nil? || api_key.empty?
32
+ puts "You must first save your WaniKani API Key using the --api-key flag."
33
+ exit 1
34
+ end
35
+
36
+ Wanikani.api_key = api_key
37
+
38
+ puts WKCheck::Study.available_stats
data/lib/wkcheck.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'wanikani'
2
+
3
+ module WKCheck
4
+ VERSION = "0.0.2"
5
+ CONFIG_FILE = "#{Dir.home}/.wkcheck.yml"
6
+
7
+ class Study
8
+ def self.available_stats
9
+ queue = Wanikani::StudyQueue.queue
10
+ lessons = queue["lessons_available"]
11
+ reviews = queue["reviews_available"]
12
+ next_review_date = Time.at(queue["next_review_date"]).utc.strftime("%A, %B %-d at %-l:%M %p")
13
+
14
+ if lessons.zero? && reviews.zero?
15
+ message = "You have no lessons or reviews now! You'll have some more on #{next_review_date}."
16
+ else
17
+ message = "You have #{lessons.zero? ? "no" : lessons } lessons pending."
18
+ message += "\nYou have #{reviews.zero? ? "no" : reviews } reviews pending."
19
+ end
20
+
21
+ message
22
+ end
23
+ end
24
+ end
data/wkcheck.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "wkcheck"
3
+ s.version = "0.0.2"
4
+ s.date = "2013-05-12"
5
+ s.summary = "Check your WaniKani stats from the command line"
6
+ s.description = "Check your pending lessons and reviews of your WaniKani account (http://www.wanikani.com/) from the command line"
7
+ s.authors = ["Dennis Martinez"]
8
+ s.email = "dennis@dennmart.com"
9
+ s.homepage = "http://github.com/dennmart/wkcheck"
10
+ s.executables = ["wkcheck"]
11
+ s.require_paths = ["lib"]
12
+ s.files = %w[
13
+ README.md
14
+ bin/wkcheck
15
+ wkcheck.gemspec
16
+ lib/wkcheck.rb
17
+ ]
18
+
19
+ s.required_ruby_version = '>= 1.9.2'
20
+
21
+ s.add_runtime_dependency "wanikani", "~> 0.0.3"
22
+ s.add_runtime_dependency "slop", "~> 3.4.4"
23
+
24
+ s.add_development_dependency "aruba", "~> 0.5.2"
25
+ s.add_development_dependency "mocha", "~> 0.13.3"
26
+ s.add_development_dependency "rake", "~> 10.0.4"
27
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wkcheck
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Dennis Martinez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: wanikani
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: slop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 3.4.4
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 3.4.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: aruba
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 0.5.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.5.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: mocha
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.13.3
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 0.13.3
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 10.0.4
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 10.0.4
83
+ description: Check your pending lessons and reviews of your WaniKani account (http://www.wanikani.com/)
84
+ from the command line
85
+ email: dennis@dennmart.com
86
+ executables:
87
+ - wkcheck
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - README.md
92
+ - bin/wkcheck
93
+ - wkcheck.gemspec
94
+ - lib/wkcheck.rb
95
+ homepage: http://github.com/dennmart/wkcheck
96
+ licenses: []
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - '>='
105
+ - !ruby/object:Gem::Version
106
+ version: 1.9.2
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.0.3
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: Check your WaniKani stats from the command line
118
+ test_files: []