acts_as_learnable 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/README.md +8 -5
- data/Rakefile +1 -0
- data/acts_as_learnable.gemspec +11 -11
- data/lib/acts_as_learnable/version.rb +1 -1
- data/lib/generators/flashcard/flashcard_generator.rb +8 -5
- data/lib/generators/flashcard/templates/add_fields_migration.rb +5 -13
- data/lib/generators/flashcard/templates/create_table_migration.rb +7 -11
- data/test/test_helper.rb +1 -1
- metadata +30 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9da5b966e48e9b1c72f0bd09c4ecfa368c741701
|
4
|
+
data.tar.gz: 1aeee4b6a3cef0942f695d1ab36e7ae10fc8cb7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 987b9f12e12b96188cc242c44df43d123b5e7fdd3b65c5fa47ff848f67ad6326d9722b84688e5636cb49cc562b0529ead589cd2dce1e307338e4145cdcedc1f1
|
7
|
+
data.tar.gz: 6a588898060364332170aa0afeb91824c4ea5e72ca52e55b01aba0d5d511cfab84e8d7b74b6e1fdb1265b5d11f9ee0477541471a8d62ba23188f2e1354b58aa0
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# ActsAsLearnable
|
2
2
|
|
3
|
+
[![Build Status](https://img.shields.io/travis/dankimio/acts_as_learnable.svg?style=flat)](https://travis-ci.org/dankimio/acts_as_learnable)
|
4
|
+
[![Gem Version](https://img.shields.io/gem/v/acts_as_learnable.svg?style=flat&color=brightgreen)](https://rubygems.org/gems/acts_as_learnable)
|
5
|
+
[![License](https://img.shields.io/:license-mit-blue.svg?style=flat)](https://dankimio.mit-license.org)
|
6
|
+
|
7
|
+
|
3
8
|
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
9
|
|
5
10
|
## Installation
|
@@ -35,9 +40,7 @@ end
|
|
35
40
|
|
36
41
|
It will automatically extend your class with all necessary methods.
|
37
42
|
|
38
|
-
|
39
|
-
|
40
|
-
Then you can review items:
|
43
|
+
Then you can review flashcards:
|
41
44
|
|
42
45
|
```ruby
|
43
46
|
card = Flashcard.create
|
@@ -59,5 +62,5 @@ card.repetitions # => 1
|
|
59
62
|
|
60
63
|
## TODO
|
61
64
|
|
62
|
-
|
63
|
-
|
65
|
+
- [ ] More detailed README
|
66
|
+
- [ ] Other repetition algorithms (Anki)
|
data/Rakefile
CHANGED
data/acts_as_learnable.gemspec
CHANGED
@@ -6,23 +6,23 @@ require 'acts_as_learnable/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'acts_as_learnable'
|
8
8
|
spec.version = ActsAsLearnable::VERSION
|
9
|
-
spec.authors = ['
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Dan Kim']
|
10
|
+
spec.email = ['itsdanya@gmail.com']
|
11
11
|
spec.summary = 'A simple way to create flashcards in your app.'
|
12
12
|
spec.description = '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.'
|
13
|
-
spec.homepage = '
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/itsdn/acts_as_learnable'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'activerecord', '
|
22
|
-
spec.add_dependency 'activesupport', '
|
21
|
+
spec.add_dependency 'activerecord', '>= 4.2'
|
22
|
+
spec.add_dependency 'activesupport', '>= 4.2'
|
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'
|
25
|
+
spec.add_development_dependency 'rake'
|
26
|
+
spec.add_development_dependency 'sqlite3'
|
27
|
+
spec.add_development_dependency 'byebug'
|
28
28
|
end
|
@@ -9,13 +9,16 @@ class FlashcardGenerator < ActiveRecord::Generators::Base
|
|
9
9
|
source_root File.expand_path('../templates', __FILE__)
|
10
10
|
|
11
11
|
def install_flashcards
|
12
|
-
if File.
|
13
|
-
|
14
|
-
migration_template(
|
15
|
-
'add_fields_migration.rb',
|
16
|
-
"db/migrate/add_flashcard_fields_to_#{table_name}.rb")
|
12
|
+
if schema_exists? && File.read("#{destination_root}/db/schema.rb") =~ /create_table \"#{table_name}\"/
|
13
|
+
migration_template('add_fields_migration.rb', "db/migrate/add_flashcard_fields_to_#{table_name}.rb")
|
17
14
|
else
|
18
15
|
migration_template('create_table_migration.rb', "db/migrate/create_#{table_name}.rb")
|
19
16
|
end
|
20
17
|
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def schema_exists?
|
22
|
+
File.exist?("#{destination_root}/db/schema.rb")
|
23
|
+
end
|
21
24
|
end
|
@@ -1,17 +1,9 @@
|
|
1
1
|
class <%= @migration_class_name %> < ActiveRecord::Migration
|
2
|
-
def
|
2
|
+
def change
|
3
3
|
add_column :<%= table_name %>, :easiness_factor, :float, default: 2.5
|
4
|
-
add_column :<%= table_name %>, :repetitions,
|
5
|
-
add_column :<%= table_name %>, :interval,
|
6
|
-
add_column :<%= table_name %>, :due,
|
7
|
-
add_column :<%= table_name %>, :studied_at,
|
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
|
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
|
16
8
|
end
|
17
9
|
end
|
@@ -1,15 +1,11 @@
|
|
1
1
|
class <%= @migration_class_name %> < ActiveRecord::Migration
|
2
|
-
def
|
3
|
-
create_table
|
4
|
-
t.column :easiness_factor, :float,
|
5
|
-
t.column :repetitions,
|
6
|
-
t.column :interval,
|
7
|
-
t.column :due,
|
8
|
-
t.column :studied_at,
|
2
|
+
def change
|
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
9
|
end
|
10
10
|
end
|
11
|
-
|
12
|
-
def self.down
|
13
|
-
drop_table '<%= table_name %>'
|
14
|
-
end
|
15
11
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,99 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_learnable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Dan Kim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-10 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: '4.
|
19
|
+
version: '4.2'
|
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: '4.
|
26
|
+
version: '4.2'
|
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: '4.
|
33
|
+
version: '4.2'
|
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: '4.
|
40
|
+
version: '4.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
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: '0'
|
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: '0'
|
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: '
|
89
|
+
version: '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: '
|
96
|
+
version: '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
|
@@ -105,6 +105,7 @@ extensions: []
|
|
105
105
|
extra_rdoc_files: []
|
106
106
|
files:
|
107
107
|
- ".gitignore"
|
108
|
+
- ".travis.yml"
|
108
109
|
- Gemfile
|
109
110
|
- LICENSE.txt
|
110
111
|
- README.md
|
@@ -118,7 +119,7 @@ files:
|
|
118
119
|
- lib/generators/flashcard/templates/create_table_migration.rb
|
119
120
|
- test/test_base.rb
|
120
121
|
- test/test_helper.rb
|
121
|
-
homepage:
|
122
|
+
homepage: https://github.com/itsdn/acts_as_learnable
|
122
123
|
licenses:
|
123
124
|
- MIT
|
124
125
|
metadata: {}
|
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
139
|
version: '0'
|
139
140
|
requirements: []
|
140
141
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.6.11
|
142
143
|
signing_key:
|
143
144
|
specification_version: 4
|
144
145
|
summary: A simple way to create flashcards in your app.
|