acts_as_learnable 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +7 -15
- data/acts_as_learnable.gemspec +6 -6
- data/lib/acts_as_learnable/version.rb +1 -1
- data/lib/generators/flashcard/flashcard_generator.rb +21 -0
- data/lib/generators/flashcard/templates/add_fields_migration.rb +17 -0
- data/lib/generators/flashcard/templates/create_table_migration.rb +15 -0
- metadata +21 -21
- data/lib/generators/acts_as_learnable/USAGE +0 -0
- data/lib/generators/acts_as_learnable/templates/add_fields_migration.rb +0 -0
- data/lib/generators/acts_as_learnable/templates/create_table_migration.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24b49c5a5beec988626f52390586b33b40b40ec6
|
4
|
+
data.tar.gz: 38e31cd2da1105c780ae3aee8f081ebf3aba2d33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e7ff740e320e942b5a03a07cf2bd6da9a9dbf885fc964bb12d89fa30d5e6ec7a0a9af7316c617e5cd651dd2b728de6d72f4493656796504f734bc169e9ce9ac
|
7
|
+
data.tar.gz: ce389b6a20c055613ee143946eaab9f04bcf3cad8ade54ec61bad56f45abcab60324c6bea3f2216ada1ab3af30d334c8ef94f7d9c763141373ec6ba4e0f7c3ce
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ActsAsLearnable
|
2
2
|
|
3
|
-
ActsAsLearnable is a Ruby gem for ActiveRecord models. It provides a simple way to create flashcards in your app. It automatically schedules flashcards for review depending on recall quality (1 to 5). You can easily create a Spaced Repetition System (SRS) using this gem.
|
3
|
+
ActsAsLearnable is a Ruby gem for ActiveRecord models. It provides a simple way to create flashcards in your app. It automatically schedules flashcards for review depending on recall quality (1 to 5). You can easily create a Spaced Repetition System (SRS) using this gem. Flashcards are scheduled using SuperMemo 2 algorithm.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,6 +18,11 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install acts_as_learnable
|
20
20
|
|
21
|
+
Create and run migrations (will add flashcard fields if table already exists):
|
22
|
+
|
23
|
+
$ rails generate flashcard MODEL
|
24
|
+
$ rake db:migrate
|
25
|
+
|
21
26
|
## Usage
|
22
27
|
|
23
28
|
Within your model call `acts_as_learnable` method:
|
@@ -32,18 +37,6 @@ It will automatically extend your class with all necessary methods.
|
|
32
37
|
|
33
38
|
Make sure you have the following fields on the model (generators will be added later):
|
34
39
|
|
35
|
-
```ruby
|
36
|
-
ActiveRecord::Schema.define(version: 1) do
|
37
|
-
create_table :flashcards do |t|
|
38
|
-
t.float :easiness_factor, default: 2.5
|
39
|
-
t.integer :repetitions, default: 0
|
40
|
-
t.integer :interval, default: 0
|
41
|
-
t.date :due, default: nil
|
42
|
-
t.date :studied_at, default: nil
|
43
|
-
end
|
44
|
-
end
|
45
|
-
```
|
46
|
-
|
47
40
|
Then you can review items:
|
48
41
|
|
49
42
|
```ruby
|
@@ -58,7 +51,7 @@ card.repetitions # => 1
|
|
58
51
|
|
59
52
|
## Contributing
|
60
53
|
|
61
|
-
1. Fork it ( https://github.com/
|
54
|
+
1. Fork it ( https://github.com/itsdan/acts_as_learnable/fork )
|
62
55
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
63
56
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
64
57
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -66,6 +59,5 @@ card.repetitions # => 1
|
|
66
59
|
|
67
60
|
## TODO
|
68
61
|
|
69
|
-
* Migration generators
|
70
62
|
* More detailed README
|
71
63
|
* Other repetition algorithms (Anki)
|
data/acts_as_learnable.gemspec
CHANGED
@@ -18,11 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency 'activerecord'
|
22
|
-
spec.add_dependency 'activesupport'
|
21
|
+
spec.add_dependency 'activerecord', '~> 4.0'
|
22
|
+
spec.add_dependency 'activesupport', '~> 4.0'
|
23
23
|
|
24
|
-
spec.add_development_dependency 'bundler',
|
25
|
-
spec.add_development_dependency 'rake',
|
26
|
-
spec.add_development_dependency 'sqlite3'
|
27
|
-
spec.add_development_dependency 'byebug'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'sqlite3', '~> 1.3'
|
27
|
+
spec.add_development_dependency 'byebug', '~> 4.0'
|
28
28
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/active_record'
|
3
|
+
|
4
|
+
class FlashcardGenerator < ActiveRecord::Generators::Base
|
5
|
+
include Rails::Generators::Migration
|
6
|
+
|
7
|
+
desc 'This generator creates a migration file with flashcard fields.'
|
8
|
+
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
|
11
|
+
def install_flashcards
|
12
|
+
if File.exist?("#{destination_root}/db/schema.rb") &&
|
13
|
+
File.read("#{destination_root}/db/schema.rb") =~ /create_table \"#{table_name}\"/
|
14
|
+
migration_template(
|
15
|
+
'add_fields_migration.rb',
|
16
|
+
"db/migrate/add_flashcard_fields_to_#{table_name}.rb")
|
17
|
+
else
|
18
|
+
migration_template('create_table_migration.rb', "db/migrate/create_#{table_name}.rb")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class <%= @migration_class_name %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :<%= table_name %>, :easiness_factor, :float, default: 2.5
|
4
|
+
add_column :<%= table_name %>, :repetitions, :integer, default: 0
|
5
|
+
add_column :<%= table_name %>, :interval, :integer, default: 0
|
6
|
+
add_column :<%= table_name %>, :due, :date, default: nil
|
7
|
+
add_column :<%= table_name %>, :studied_at, :date, default: nil
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
remove_column :<%= table_name %>, :easiness_factor
|
12
|
+
remove_column :<%= table_name %>, :repetitions
|
13
|
+
remove_column :<%= table_name %>, :interval
|
14
|
+
remove_column :<%= table_name %>, :due
|
15
|
+
remove_column :<%= table_name %>, :studied_at
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class <%= @migration_class_name %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table '<%= table_name %>' do |t|
|
4
|
+
t.column :easiness_factor, :float, default: 2.5
|
5
|
+
t.column :repetitions, :integer, default: 0
|
6
|
+
t.column :interval, :integer, default: 0
|
7
|
+
t.column :due, :date, default: nil
|
8
|
+
t.column :studied_at, :date, default: nil
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table '<%= table_name %>'
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_learnable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danya Kim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '4.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '4.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,30 +70,30 @@ dependencies:
|
|
70
70
|
name: sqlite3
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '1.3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '1.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: byebug
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
version: '4.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
96
|
+
version: '4.0'
|
97
97
|
description: ActsAsLearnable is a Ruby gem for ActiveRecord models. It provides a
|
98
98
|
simple way to create flashcards in your app. It automatically schedules flashcards
|
99
99
|
for review depending on recall quality (1 to 5). You can easily create a Spaced
|
@@ -113,9 +113,9 @@ files:
|
|
113
113
|
- lib/acts_as_learnable.rb
|
114
114
|
- lib/acts_as_learnable/base.rb
|
115
115
|
- lib/acts_as_learnable/version.rb
|
116
|
-
- lib/generators/
|
117
|
-
- lib/generators/
|
118
|
-
- lib/generators/
|
116
|
+
- lib/generators/flashcard/flashcard_generator.rb
|
117
|
+
- lib/generators/flashcard/templates/add_fields_migration.rb
|
118
|
+
- lib/generators/flashcard/templates/create_table_migration.rb
|
119
119
|
- test/test_base.rb
|
120
120
|
- test/test_helper.rb
|
121
121
|
homepage: http://github.com/itsdan/acts_as_learnable
|
File without changes
|
File without changes
|
File without changes
|