ankit 0.0.0
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.
- data/bin/ankit +6 -0
- data/lib/ankit/add_command.rb +28 -0
- data/lib/ankit/card.rb +66 -0
- data/lib/ankit/card_happening_command.rb +31 -0
- data/lib/ankit/challenge_command.rb +444 -0
- data/lib/ankit/coming_command.rb +90 -0
- data/lib/ankit/command.rb +40 -0
- data/lib/ankit/event.rb +62 -0
- data/lib/ankit/event_traversing_command.rb +37 -0
- data/lib/ankit/fail_command.rb +14 -0
- data/lib/ankit/find_command.rb +38 -0
- data/lib/ankit/hello_command.rb +22 -0
- data/lib/ankit/list_command.rb +26 -0
- data/lib/ankit/name_command.rb +16 -0
- data/lib/ankit/pass_command.rb +9 -0
- data/lib/ankit/round_command.rb +31 -0
- data/lib/ankit/runtime.rb +151 -0
- data/lib/ankit/score_command.rb +24 -0
- data/lib/ankit/text_reading_command.rb +23 -0
- data/lib/ankit.rb +3 -0
- data/test/card_test.rb +92 -0
- data/test/command_test.rb +406 -0
- data/test/data/bye_card.card +2 -0
- data/test/data/hello_card.card +2 -0
- data/test/data/hello_config.rb +4 -0
- data/test/data/hello_repo/anemone.journal +2 -0
- data/test/data/hello_repo/baobab.journal +2 -0
- data/test/data/hello_repo/cards/foo/hello.card +2 -0
- data/test/data/hello_repo/cards/foo/this_is_not_a_card.txt +1 -0
- data/test/data/hello_repo/cards/foo/vanilla-please.card +2 -0
- data/test/data/hope.card +1 -0
- data/test/data/luck.card +1 -0
- data/test/data/number_repo/anemone.journal +0 -0
- data/test/data/number_repo/cards/eight.card +2 -0
- data/test/data/number_repo/cards/five.card +2 -0
- data/test/data/number_repo/cards/four.card +2 -0
- data/test/data/number_repo/cards/one.card +2 -0
- data/test/data/number_repo/cards/seven.card +2 -0
- data/test/data/number_repo/cards/six.card +2 -0
- data/test/data/number_repo/cards/three.card +2 -0
- data/test/data/number_repo/cards/two.card +2 -0
- data/test/data/vanilla_repo/anemone.journal +0 -0
- data/test/event_test.rb +29 -0
- data/test/helpers.rb +54 -0
- data/test/progress_test.rb +99 -0
- data/test/runtime_test.rb +58 -0
- metadata +138 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
|
2
|
+
require 'ankit/runtime'
|
3
|
+
require 'test/unit'
|
4
|
+
require 'helpers'
|
5
|
+
|
6
|
+
class ConfigTest < Test::Unit::TestCase
|
7
|
+
include Ankit
|
8
|
+
include Ankit::TestHelper
|
9
|
+
|
10
|
+
def test_defaults
|
11
|
+
config = Config.new
|
12
|
+
config.location = "hello"
|
13
|
+
assert_equal(File.expand_path("~/.ankit.d/hello.journal"), config.primary_journal)
|
14
|
+
assert_equal([File.expand_path("~/.ankit.d/cards")], config.card_paths)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_card_search_paths
|
18
|
+
target = make_config
|
19
|
+
assert_equal(["#{HELLO_REPO}/cards",
|
20
|
+
"#{HELLO_REPO}/cards/bar",
|
21
|
+
"#{HELLO_REPO}/cards/foo"],
|
22
|
+
target.card_search_paths)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_journals
|
26
|
+
target = make_config
|
27
|
+
assert_equal(["#{HELLO_REPO}/anemone.journal",
|
28
|
+
"#{HELLO_REPO}/baobab.journal"],
|
29
|
+
target.journals)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_open
|
33
|
+
config = Config.open(File.join(TEST_DATA_BASE, "hello_config.rb"))
|
34
|
+
assert_equal("hello_repo/hello.journal", config.primary_journal)
|
35
|
+
assert_equal(["hello_repo/cards", "hello_repo/more"], config.card_paths)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
class RuntimeTest < Test::Unit::TestCase
|
41
|
+
include Ankit
|
42
|
+
include Ankit::TestHelper
|
43
|
+
|
44
|
+
def test_split_subcommand
|
45
|
+
assert_equal({global: [], subcommand: ["hello", "foo", "bar"]},
|
46
|
+
Runtime.split_subcommand(["hello", "foo", "bar"]))
|
47
|
+
assert_equal({global: ["--config", "foo.txt"], subcommand: ["hello", "foo", "bar"]},
|
48
|
+
Runtime.split_subcommand(["--config", "foo.txt", "hello", "foo", "bar"]))
|
49
|
+
assert_equal({global: [], subcommand: []},
|
50
|
+
Runtime.split_subcommand([]))
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_run
|
54
|
+
actual = RuntimeWithMockedIO.run(["--config", File.join(TEST_DATA_BASE, "hello_config.rb"), "hello"])
|
55
|
+
assert_equal(actual.class, HelloCommand)
|
56
|
+
assert_equal(File.basename(actual.runtime.config.repo), "hello_repo")
|
57
|
+
end
|
58
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ankit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Hajime Morrita
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-02-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: highline
|
16
|
+
requirement: &8010680 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.6.11
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *8010680
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: diff-lcs
|
27
|
+
requirement: &8010140 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.1.3
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *8010140
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: json
|
38
|
+
requirement: &8009620 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.6.5
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *8009620
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: mocha
|
49
|
+
requirement: &8009020 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.10.4
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *8009020
|
58
|
+
description: ! 'Ankit is a CLI and terminal based flashcard program to learn your
|
59
|
+
new language.
|
60
|
+
|
61
|
+
'
|
62
|
+
email: omo@dodgson.org
|
63
|
+
executables: []
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files: []
|
66
|
+
files:
|
67
|
+
- bin/ankit
|
68
|
+
- lib/ankit/pass_command.rb
|
69
|
+
- lib/ankit/card.rb
|
70
|
+
- lib/ankit/coming_command.rb
|
71
|
+
- lib/ankit/text_reading_command.rb
|
72
|
+
- lib/ankit/challenge_command.rb
|
73
|
+
- lib/ankit/command.rb
|
74
|
+
- lib/ankit/add_command.rb
|
75
|
+
- lib/ankit/event.rb
|
76
|
+
- lib/ankit/hello_command.rb
|
77
|
+
- lib/ankit/find_command.rb
|
78
|
+
- lib/ankit/event_traversing_command.rb
|
79
|
+
- lib/ankit/round_command.rb
|
80
|
+
- lib/ankit/runtime.rb
|
81
|
+
- lib/ankit/name_command.rb
|
82
|
+
- lib/ankit/score_command.rb
|
83
|
+
- lib/ankit/card_happening_command.rb
|
84
|
+
- lib/ankit/fail_command.rb
|
85
|
+
- lib/ankit/list_command.rb
|
86
|
+
- lib/ankit.rb
|
87
|
+
- test/data/vanilla_repo/anemone.journal
|
88
|
+
- test/data/hello_card.card
|
89
|
+
- test/data/hello_repo/cards/foo/this_is_not_a_card.txt
|
90
|
+
- test/data/hello_repo/cards/foo/vanilla-please.card
|
91
|
+
- test/data/hello_repo/cards/foo/hello.card
|
92
|
+
- test/data/hello_repo/baobab.journal
|
93
|
+
- test/data/hello_repo/anemone.journal
|
94
|
+
- test/data/hope.card
|
95
|
+
- test/data/luck.card
|
96
|
+
- test/data/hello_config.rb
|
97
|
+
- test/data/bye_card.card
|
98
|
+
- test/data/number_repo/cards/one.card
|
99
|
+
- test/data/number_repo/cards/five.card
|
100
|
+
- test/data/number_repo/cards/three.card
|
101
|
+
- test/data/number_repo/cards/eight.card
|
102
|
+
- test/data/number_repo/cards/four.card
|
103
|
+
- test/data/number_repo/cards/seven.card
|
104
|
+
- test/data/number_repo/cards/two.card
|
105
|
+
- test/data/number_repo/cards/six.card
|
106
|
+
- test/data/number_repo/anemone.journal
|
107
|
+
- test/event_test.rb
|
108
|
+
- test/runtime_test.rb
|
109
|
+
- test/command_test.rb
|
110
|
+
- test/helpers.rb
|
111
|
+
- test/card_test.rb
|
112
|
+
- test/progress_test.rb
|
113
|
+
homepage: https://github.com/omo/ankit
|
114
|
+
licenses: []
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements:
|
132
|
+
- none
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 1.8.10
|
135
|
+
signing_key:
|
136
|
+
specification_version: 3
|
137
|
+
summary: A CLI Flashcard.
|
138
|
+
test_files: []
|