diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-09-16 22:40:16 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-09-16 22:40:16 -0400 |
commit | 1d621019d7bf74b65898e009aef31766c7e7572b (patch) | |
tree | bc48ac9c980ff3cc5d087beece6ed0fe24d441da | |
parent | 5e62e771bf14f58dd1622d2e3631309caa201349 (diff) | |
download | pokeviewer-1d621019d7bf74b65898e009aef31766c7e7572b.tar.gz pokeviewer-1d621019d7bf74b65898e009aef31766c7e7572b.tar.bz2 pokeviewer-1d621019d7bf74b65898e009aef31766c7e7572b.zip |
Created a bunch of models
29 files changed, 708 insertions, 3 deletions
diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..30e3155 --- /dev/null +++ b/Gemfile.lock | |||
@@ -0,0 +1,123 @@ | |||
1 | PATH | ||
2 | remote: . | ||
3 | specs: | ||
4 | pokeviewer (0.1.0) | ||
5 | enumerize | ||
6 | rails (~> 5.1.4) | ||
7 | sequential | ||
8 | |||
9 | GEM | ||
10 | remote: https://rubygems.org/ | ||
11 | specs: | ||
12 | actioncable (5.1.4) | ||
13 | actionpack (= 5.1.4) | ||
14 | nio4r (~> 2.0) | ||
15 | websocket-driver (~> 0.6.1) | ||
16 | actionmailer (5.1.4) | ||
17 | actionpack (= 5.1.4) | ||
18 | actionview (= 5.1.4) | ||
19 | activejob (= 5.1.4) | ||
20 | mail (~> 2.5, >= 2.5.4) | ||
21 | rails-dom-testing (~> 2.0) | ||
22 | actionpack (5.1.4) | ||
23 | actionview (= 5.1.4) | ||
24 | activesupport (= 5.1.4) | ||
25 | rack (~> 2.0) | ||
26 | rack-test (>= 0.6.3) | ||
27 | rails-dom-testing (~> 2.0) | ||
28 | rails-html-sanitizer (~> 1.0, >= 1.0.2) | ||
29 | actionview (5.1.4) | ||
30 | activesupport (= 5.1.4) | ||
31 | builder (~> 3.1) | ||
32 | erubi (~> 1.4) | ||
33 | rails-dom-testing (~> 2.0) | ||
34 | rails-html-sanitizer (~> 1.0, >= 1.0.3) | ||
35 | activejob (5.1.4) | ||
36 | activesupport (= 5.1.4) | ||
37 | globalid (>= 0.3.6) | ||
38 | activemodel (5.1.4) | ||
39 | activesupport (= 5.1.4) | ||
40 | activerecord (5.1.4) | ||
41 | activemodel (= 5.1.4) | ||
42 | activesupport (= 5.1.4) | ||
43 | arel (~> 8.0) | ||
44 | activesupport (5.1.4) | ||
45 | concurrent-ruby (~> 1.0, >= 1.0.2) | ||
46 | i18n (~> 0.7) | ||
47 | minitest (~> 5.1) | ||
48 | tzinfo (~> 1.1) | ||
49 | arel (8.0.0) | ||
50 | builder (3.2.3) | ||
51 | concurrent-ruby (1.0.5) | ||
52 | enumerize (2.1.2) | ||
53 | activesupport (>= 3.2) | ||
54 | erubi (1.6.1) | ||
55 | globalid (0.4.0) | ||
56 | activesupport (>= 4.2.0) | ||
57 | i18n (0.8.6) | ||
58 | loofah (2.0.3) | ||
59 | nokogiri (>= 1.5.9) | ||
60 | mail (2.6.6) | ||
61 | mime-types (>= 1.16, < 4) | ||
62 | method_source (0.8.2) | ||
63 | mime-types (3.1) | ||
64 | mime-types-data (~> 3.2015) | ||
65 | mime-types-data (3.2016.0521) | ||
66 | mini_portile2 (2.2.0) | ||
67 | minitest (5.10.3) | ||
68 | nio4r (2.1.0) | ||
69 | nokogiri (1.8.0) | ||
70 | mini_portile2 (~> 2.2.0) | ||
71 | rack (2.0.3) | ||
72 | rack-test (0.7.0) | ||
73 | rack (>= 1.0, < 3) | ||
74 | rails (5.1.4) | ||
75 | actioncable (= 5.1.4) | ||
76 | actionmailer (= 5.1.4) | ||
77 | actionpack (= 5.1.4) | ||
78 | actionview (= 5.1.4) | ||
79 | activejob (= 5.1.4) | ||
80 | activemodel (= 5.1.4) | ||
81 | activerecord (= 5.1.4) | ||
82 | activesupport (= 5.1.4) | ||
83 | bundler (>= 1.3.0) | ||
84 | railties (= 5.1.4) | ||
85 | sprockets-rails (>= 2.0.0) | ||
86 | rails-dom-testing (2.0.3) | ||
87 | activesupport (>= 4.2.0) | ||
88 | nokogiri (>= 1.6) | ||
89 | rails-html-sanitizer (1.0.3) | ||
90 | loofah (~> 2.0) | ||
91 | railties (5.1.4) | ||
92 | actionpack (= 5.1.4) | ||
93 | activesupport (= 5.1.4) | ||
94 | method_source | ||
95 | rake (>= 0.8.7) | ||
96 | thor (>= 0.18.1, < 2.0) | ||
97 | rake (12.1.0) | ||
98 | sequential (0.2) | ||
99 | sprockets (3.7.1) | ||
100 | concurrent-ruby (~> 1.0) | ||
101 | rack (> 1, < 3) | ||
102 | sprockets-rails (3.2.1) | ||
103 | actionpack (>= 4.0) | ||
104 | activesupport (>= 4.0) | ||
105 | sprockets (>= 3.0.0) | ||
106 | sqlite3 (1.3.13) | ||
107 | thor (0.20.0) | ||
108 | thread_safe (0.3.6) | ||
109 | tzinfo (1.2.3) | ||
110 | thread_safe (~> 0.1) | ||
111 | websocket-driver (0.6.5) | ||
112 | websocket-extensions (>= 0.1.0) | ||
113 | websocket-extensions (0.1.2) | ||
114 | |||
115 | PLATFORMS | ||
116 | ruby | ||
117 | |||
118 | DEPENDENCIES | ||
119 | pokeviewer! | ||
120 | sqlite3 | ||
121 | |||
122 | BUNDLED WITH | ||
123 | 1.15.1 | ||
diff --git a/app/models/pokeviewer/move.rb b/app/models/pokeviewer/move.rb new file mode 100644 index 0000000..337ac11 --- /dev/null +++ b/app/models/pokeviewer/move.rb | |||
@@ -0,0 +1,10 @@ | |||
1 | module Pokeviewer | ||
2 | class Move < ApplicationRecord | ||
3 | has_many :revision_moves | ||
4 | has_many :revisions, through: :revision_moves | ||
5 | |||
6 | validates :name, presence: true, uniqueness: true | ||
7 | validates :pp, presence: true, | ||
8 | numericality: { greater_than_or_equal_to: 1, only_integer: true } | ||
9 | end | ||
10 | end | ||
diff --git a/app/models/pokeviewer/pokemon.rb b/app/models/pokeviewer/pokemon.rb new file mode 100644 index 0000000..114e9dd --- /dev/null +++ b/app/models/pokeviewer/pokemon.rb | |||
@@ -0,0 +1,50 @@ | |||
1 | module Pokeviewer | ||
2 | class Pokemon < ApplicationRecord | ||
3 | extend Enumerize | ||
4 | |||
5 | belongs_to :species | ||
6 | belongs_to :trainer, optional: true | ||
7 | has_many :revisions, dependent: :destroy | ||
8 | |||
9 | validate :uuid_is_constant, on: :update | ||
10 | before_create :set_uuid | ||
11 | |||
12 | validates :ot_name, presence: true | ||
13 | |||
14 | validates :ot_number, presence: true, | ||
15 | numericality: { greater_than_or_equal_to: 0, only_integer: true } | ||
16 | |||
17 | validates :met_level, presence: true, | ||
18 | numericality: { greater_than_or_equal_to: 1, only_integer: true } | ||
19 | |||
20 | validates :met_type, presence: true | ||
21 | enumerize :met_type, in: [:normal, :hatched, :npc_trade, :fateful_encounter] | ||
22 | |||
23 | validates :gender, presence: true | ||
24 | enumerize :gender, in: [:genderless, :female, :male] | ||
25 | |||
26 | validates :nature, presence: true | ||
27 | enumerize :nature, in: [:hardy, :lonely, :brave, :adamant, :naughty, :bold, | ||
28 | :docile, :relaxed, :impish, :lax, :timid, :hasty, :serious, :jolly, | ||
29 | :naive, :modest, :mild, :quiet, :bashful, :rash, :calm, :gentle, :sassy, | ||
30 | :careful, :quirky] | ||
31 | |||
32 | enumerize :unown_letter, in: [:a, :b, :c, :d, :e, :f, :g, :h, :i, :j, :k, | ||
33 | :l, :m, :n, :o, :p, :q, :r, :s, :t, :u, :v, :w, :x, :y, :z, | ||
34 | :question_mark, :exclamation_mark] | ||
35 | |||
36 | def to_param | ||
37 | uuid | ||
38 | end | ||
39 | |||
40 | private | ||
41 | |||
42 | def set_uuid | ||
43 | self.uuid = SecureRandom.uuid | ||
44 | end | ||
45 | |||
46 | def uuid_is_constant | ||
47 | errors.add(:uuid, "can't be changed") if self.uuid_changed? | ||
48 | end | ||
49 | end | ||
50 | end | ||
diff --git a/app/models/pokeviewer/revision.rb b/app/models/pokeviewer/revision.rb new file mode 100644 index 0000000..a8f8ab2 --- /dev/null +++ b/app/models/pokeviewer/revision.rb | |||
@@ -0,0 +1,72 @@ | |||
1 | module Pokeviewer | ||
2 | class Revision < ApplicationRecord | ||
3 | belongs_to :pokemon | ||
4 | acts_as_sequenced scope: :pokemon_id | ||
5 | |||
6 | has_many :revision_moves, -> { order "number ASC" } | ||
7 | has_many :moves, through: :revision_moves | ||
8 | |||
9 | validates :moves, presence: true | ||
10 | validates :nickname, presence: true | ||
11 | |||
12 | validates :experience, presence: true, | ||
13 | numericality: { greater_than_or_equal_to: 1, only_integer: true } | ||
14 | |||
15 | validates :level, presence: true, | ||
16 | numericality: { greater_than_or_equal_to: 1, only_integer: true } | ||
17 | |||
18 | validates :hp, presence: true, | ||
19 | numericality: { greater_than_or_equal_to: 1, only_integer: true } | ||
20 | |||
21 | validates :attack, presence: true, | ||
22 | numericality: { greater_than_or_equal_to: 1, only_integer: true } | ||
23 | |||
24 | validates :defense, presence: true, | ||
25 | numericality: { greater_than_or_equal_to: 1, only_integer: true } | ||
26 | |||
27 | validates :special_attack, presence: true, | ||
28 | numericality: { greater_than_or_equal_to: 1, only_integer: true } | ||
29 | |||
30 | validates :special_defense, presence: true, | ||
31 | numericality: { greater_than_or_equal_to: 1, only_integer: true } | ||
32 | |||
33 | validates :speed, presence: true, | ||
34 | numericality: { greater_than_or_equal_to: 1, only_integer: true } | ||
35 | |||
36 | validates :coolness, presence: true, | ||
37 | numericality: { | ||
38 | greater_than_or_equal_to: 0, | ||
39 | less_than_or_equal_to: 10, | ||
40 | only_integer: true } | ||
41 | |||
42 | validates :beauty, presence: true, | ||
43 | numericality: { | ||
44 | greater_than_or_equal_to: 0, | ||
45 | less_than_or_equal_to: 10, | ||
46 | only_integer: true } | ||
47 | |||
48 | validates :cuteness, presence: true, | ||
49 | numericality: { | ||
50 | greater_than_or_equal_to: 0, | ||
51 | less_than_or_equal_to: 10, | ||
52 | only_integer: true } | ||
53 | |||
54 | validates :smartness, presence: true, | ||
55 | numericality: { | ||
56 | greater_than_or_equal_to: 0, | ||
57 | less_than_or_equal_to: 10, | ||
58 | only_integer: true } | ||
59 | |||
60 | validates :toughness, presence: true, | ||
61 | numericality: { | ||
62 | greater_than_or_equal_to: 0, | ||
63 | less_than_or_equal_to: 10, | ||
64 | only_integer: true } | ||
65 | |||
66 | validates :sheen, presence: true, | ||
67 | numericality: { | ||
68 | greater_than_or_equal_to: 0, | ||
69 | less_than_or_equal_to: 10, | ||
70 | only_integer: true } | ||
71 | end | ||
72 | end | ||
diff --git a/app/models/pokeviewer/revision_move.rb b/app/models/pokeviewer/revision_move.rb new file mode 100644 index 0000000..74b9e9e --- /dev/null +++ b/app/models/pokeviewer/revision_move.rb | |||
@@ -0,0 +1,19 @@ | |||
1 | module Pokeviewer | ||
2 | class RevisionMove < ApplicationRecord | ||
3 | belongs_to :revision | ||
4 | belongs_to :move | ||
5 | |||
6 | validates :number, presence: true, | ||
7 | numericality: { | ||
8 | greater_than_or_equal_to: 1, | ||
9 | less_than_or_equal_to: 4, | ||
10 | only_integer: true }, | ||
11 | uniqueness: { scope: :revision_id } | ||
12 | |||
13 | validates :pp_bonuses, presence: true, | ||
14 | numericality: { | ||
15 | greater_than_or_equal_to: 0, | ||
16 | less_than_or_equal_to: 3, | ||
17 | only_integer: true} | ||
18 | end | ||
19 | end | ||
diff --git a/app/models/pokeviewer/species.rb b/app/models/pokeviewer/species.rb new file mode 100644 index 0000000..c69fd21 --- /dev/null +++ b/app/models/pokeviewer/species.rb | |||
@@ -0,0 +1,7 @@ | |||
1 | module Pokeviewer | ||
2 | class Species < ApplicationRecord | ||
3 | has_many :pokemon, dependent: :restrict_with_exception | ||
4 | |||
5 | validates :name, presence: true, uniqueness: true | ||
6 | end | ||
7 | end | ||
diff --git a/app/models/pokeviewer/trainer.rb b/app/models/pokeviewer/trainer.rb new file mode 100644 index 0000000..1cef881 --- /dev/null +++ b/app/models/pokeviewer/trainer.rb | |||
@@ -0,0 +1,17 @@ | |||
1 | module Pokeviewer | ||
2 | class Trainer < ApplicationRecord | ||
3 | extend Enumerize | ||
4 | |||
5 | has_many :pokemon, dependent: :nullify | ||
6 | |||
7 | validates :number, presence: true, | ||
8 | numericality: { greater_than_or_equal_to: 0, only_integer: true } | ||
9 | |||
10 | validates :name, presence: true, uniqueness: { | ||
11 | scope: :number, | ||
12 | message: "and number should be pairwise unique" } | ||
13 | |||
14 | validates :game, presence: true | ||
15 | enumerize :game, in: [:ruby, :sapphire, :firered, :leafgreen, :emerald] | ||
16 | end | ||
17 | end | ||
diff --git a/config/initializers/inflection.rb b/config/initializers/inflection.rb new file mode 100644 index 0000000..6b76b93 --- /dev/null +++ b/config/initializers/inflection.rb | |||
@@ -0,0 +1,3 @@ | |||
1 | ActiveSupport::Inflector.inflections(:en) do |inflect| | ||
2 | inflect.uncountable 'pokemon' | ||
3 | end | ||
diff --git a/db/migrate/20170916225306_create_pokeviewer_trainers.rb b/db/migrate/20170916225306_create_pokeviewer_trainers.rb new file mode 100644 index 0000000..18e7952 --- /dev/null +++ b/db/migrate/20170916225306_create_pokeviewer_trainers.rb | |||
@@ -0,0 +1,13 @@ | |||
1 | class CreatePokeviewerTrainers < ActiveRecord::Migration[5.1] | ||
2 | def change | ||
3 | create_table :pokeviewer_trainers do |t| | ||
4 | t.string :game, null: false | ||
5 | t.string :name, null: false, limit: 191 | ||
6 | t.integer :number, null: false | ||
7 | |||
8 | t.timestamps | ||
9 | end | ||
10 | |||
11 | add_index :pokeviewer_trainers, [:name, :number], unique: true | ||
12 | end | ||
13 | end | ||
diff --git a/db/migrate/20170916232015_create_pokeviewer_species.rb b/db/migrate/20170916232015_create_pokeviewer_species.rb new file mode 100644 index 0000000..e6d5c09 --- /dev/null +++ b/db/migrate/20170916232015_create_pokeviewer_species.rb | |||
@@ -0,0 +1,11 @@ | |||
1 | class CreatePokeviewerSpecies < ActiveRecord::Migration[5.1] | ||
2 | def change | ||
3 | create_table :pokeviewer_species do |t| | ||
4 | t.string :name, null: false, limit: 191 | ||
5 | |||
6 | t.timestamps | ||
7 | end | ||
8 | |||
9 | add_index :pokeviewer_species, :name, unique: true | ||
10 | end | ||
11 | end | ||
diff --git a/db/migrate/20170916234251_create_pokeviewer_pokemon.rb b/db/migrate/20170916234251_create_pokeviewer_pokemon.rb new file mode 100644 index 0000000..dd9994c --- /dev/null +++ b/db/migrate/20170916234251_create_pokeviewer_pokemon.rb | |||
@@ -0,0 +1,31 @@ | |||
1 | class CreatePokeviewerPokemon < ActiveRecord::Migration[5.1] | ||
2 | def change | ||
3 | create_table :pokeviewer_pokemon do |t| | ||
4 | t.string :uuid, null: false, limit: 191 | ||
5 | t.references :species, null: false | ||
6 | t.references :trainer, null: true | ||
7 | t.string :key, null: true, limit: 191 | ||
8 | t.string :ot_name, null: false | ||
9 | t.integer :ot_number, null: false | ||
10 | t.string :met_type, null: false | ||
11 | t.string :met_location, null: true | ||
12 | t.integer :met_level, null: false | ||
13 | t.boolean :shiny, null: false, default: false | ||
14 | t.string :nature, null: false | ||
15 | t.string :gender, null: false | ||
16 | t.boolean :second_ability, null: false | ||
17 | t.string :unown_letter, null: true, limit: 1 | ||
18 | |||
19 | t.timestamps | ||
20 | end | ||
21 | |||
22 | add_index :pokeviewer_pokemon, :uuid, unique: true | ||
23 | add_index :pokeviewer_pokemon, :key, unique: true | ||
24 | |||
25 | add_foreign_key :pokeviewer_pokemon, :pokeviewer_species, | ||
26 | column: :species_id | ||
27 | |||
28 | add_foreign_key :pokeviewer_pokemon, :pokeviewer_trainer, | ||
29 | column: :trainer_id | ||
30 | end | ||
31 | end | ||
diff --git a/db/migrate/20170917002857_create_pokeviewer_revisions.rb b/db/migrate/20170917002857_create_pokeviewer_revisions.rb new file mode 100644 index 0000000..f6755da --- /dev/null +++ b/db/migrate/20170917002857_create_pokeviewer_revisions.rb | |||
@@ -0,0 +1,31 @@ | |||
1 | class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1] | ||
2 | def change | ||
3 | create_table :pokeviewer_revisions do |t| | ||
4 | t.references :pokemon, null: false | ||
5 | t.integer :sequential_id, null: false | ||
6 | t.string :nickname, null: false | ||
7 | t.integer :experience, null: false | ||
8 | t.integer :level, null: false | ||
9 | t.integer :hp, null: false | ||
10 | t.integer :attack, null: false | ||
11 | t.integer :defense, null: false | ||
12 | t.integer :special_attack, null: false | ||
13 | t.integer :special_defense, null: false | ||
14 | t.integer :speed, null: false | ||
15 | t.integer :coolness, null: false | ||
16 | t.integer :beauty, null: false | ||
17 | t.integer :cuteness, null: false | ||
18 | t.integer :smartness, null: false | ||
19 | t.integer :toughness, null: false | ||
20 | t.integer :sheen, null: false | ||
21 | t.integer :hold_item, null: true | ||
22 | |||
23 | t.timestamps | ||
24 | end | ||
25 | |||
26 | add_index :pokeviewer_revisions, [:pokemon_id, :sequential_id], unique: true | ||
27 | |||
28 | add_foreign_key :pokeviewer_revisions, :pokewalker_pokemon, | ||
29 | column: :pokemon_id | ||
30 | end | ||
31 | end | ||
diff --git a/db/migrate/20170917011102_create_pokeviewer_moves.rb b/db/migrate/20170917011102_create_pokeviewer_moves.rb new file mode 100644 index 0000000..86bf45f --- /dev/null +++ b/db/migrate/20170917011102_create_pokeviewer_moves.rb | |||
@@ -0,0 +1,12 @@ | |||
1 | class CreatePokeviewerMoves < ActiveRecord::Migration[5.1] | ||
2 | def change | ||
3 | create_table :pokeviewer_moves do |t| | ||
4 | t.string :name, null: false, limit: 191 | ||
5 | t.integer :pp, null: false | ||
6 | |||
7 | t.timestamps | ||
8 | end | ||
9 | |||
10 | add_index :pokeviewer_moves, :name, unique: true | ||
11 | end | ||
12 | end | ||
diff --git a/db/migrate/20170917011258_create_pokeviewer_revision_moves.rb b/db/migrate/20170917011258_create_pokeviewer_revision_moves.rb new file mode 100644 index 0000000..e061207 --- /dev/null +++ b/db/migrate/20170917011258_create_pokeviewer_revision_moves.rb | |||
@@ -0,0 +1,20 @@ | |||
1 | class CreatePokeviewerRevisionMoves < ActiveRecord::Migration[5.1] | ||
2 | def change | ||
3 | create_table :pokeviewer_revision_moves do |t| | ||
4 | t.references :revision, null: false | ||
5 | t.references :move, null: false | ||
6 | t.integer :number, null: false | ||
7 | t.integer :pp_bonuses, null: false, default: 0 | ||
8 | |||
9 | t.timestamps | ||
10 | end | ||
11 | |||
12 | add_index :pokeviewer_revision_moves, [:revision_id, :number], unique: true | ||
13 | |||
14 | add_foreign_key :pokeviewer_revision_moves, :pokeviewer_revisions, | ||
15 | column: :revision_id | ||
16 | |||
17 | add_foreign_key :pokeviewer_revision_moves, :pokeviewer_moves, | ||
18 | column: :move_id | ||
19 | end | ||
20 | end | ||
diff --git a/lib/pokeviewer/engine.rb b/lib/pokeviewer/engine.rb index 456dc4a..d945d6d 100644 --- a/lib/pokeviewer/engine.rb +++ b/lib/pokeviewer/engine.rb | |||
@@ -1,3 +1,6 @@ | |||
1 | require "enumerize" | ||
2 | require "sequential" | ||
3 | |||
1 | module Pokeviewer | 4 | module Pokeviewer |
2 | class Engine < ::Rails::Engine | 5 | class Engine < ::Rails::Engine |
3 | isolate_namespace Pokeviewer | 6 | isolate_namespace Pokeviewer |
diff --git a/pokeviewer.gemspec b/pokeviewer.gemspec index 3d3453f..bfc49ce 100644 --- a/pokeviewer.gemspec +++ b/pokeviewer.gemspec | |||
@@ -9,14 +9,16 @@ Gem::Specification.new do |s| | |||
9 | s.version = Pokeviewer::VERSION | 9 | s.version = Pokeviewer::VERSION |
10 | s.authors = ["Kelly Rauchenberger"] | 10 | s.authors = ["Kelly Rauchenberger"] |
11 | s.email = ["fefferburbia@gmail.com"] | 11 | s.email = ["fefferburbia@gmail.com"] |
12 | s.homepage = "TODO" | 12 | s.homepage = "https://github.com/hatkirby/pokeviewer" |
13 | s.summary = "TODO: Summary of Pokeviewer." | 13 | s.summary = "Rails engine that displays Pokémon." |
14 | s.description = "TODO: Description of Pokeviewer." | 14 | s.description = "Pokeviewer is a web interface that lets you display Pokémon that have been uploaded from a GBA using hatkirby/gen3uploader." |
15 | s.license = "MIT" | 15 | s.license = "MIT" |
16 | 16 | ||
17 | s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] | 17 | s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] |
18 | 18 | ||
19 | s.add_dependency "rails", "~> 5.1.4" | 19 | s.add_dependency "rails", "~> 5.1.4" |
20 | s.add_dependency "enumerize" | ||
21 | s.add_dependency "sequential" | ||
20 | 22 | ||
21 | s.add_development_dependency "sqlite3" | 23 | s.add_development_dependency "sqlite3" |
22 | end | 24 | end |
diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb new file mode 100644 index 0000000..4b5ad80 --- /dev/null +++ b/test/dummy/db/schema.rb | |||
@@ -0,0 +1,99 @@ | |||
1 | # This file is auto-generated from the current state of the database. Instead | ||
2 | # of editing this file, please use the migrations feature of Active Record to | ||
3 | # incrementally modify your database, and then regenerate this schema definition. | ||
4 | # | ||
5 | # Note that this schema.rb definition is the authoritative source for your | ||
6 | # database schema. If you need to create the application database on another | ||
7 | # system, you should be using db:schema:load, not running all the migrations | ||
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations | ||
9 | # you'll amass, the slower it'll run and the greater likelihood for issues). | ||
10 | # | ||
11 | # It's strongly recommended that you check this file into your version control system. | ||
12 | |||
13 | ActiveRecord::Schema.define(version: 20170917011258) do | ||
14 | |||
15 | create_table "pokeviewer_moves", force: :cascade do |t| | ||
16 | t.string "name", limit: 191, null: false | ||
17 | t.integer "pp", null: false | ||
18 | t.datetime "created_at", null: false | ||
19 | t.datetime "updated_at", null: false | ||
20 | t.index ["name"], name: "index_pokeviewer_moves_on_name", unique: true | ||
21 | end | ||
22 | |||
23 | create_table "pokeviewer_pokemon", force: :cascade do |t| | ||
24 | t.string "uuid", limit: 191, null: false | ||
25 | t.integer "species_id", null: false | ||
26 | t.integer "trainer_id" | ||
27 | t.string "key", limit: 191 | ||
28 | t.string "ot_name", null: false | ||
29 | t.integer "ot_number", null: false | ||
30 | t.string "met_type", null: false | ||
31 | t.string "met_location" | ||
32 | t.integer "met_level", null: false | ||
33 | t.boolean "shiny", default: false, null: false | ||
34 | t.string "nature", null: false | ||
35 | t.string "gender", null: false | ||
36 | t.boolean "second_ability", null: false | ||
37 | t.string "unown_letter", limit: 1 | ||
38 | t.datetime "created_at", null: false | ||
39 | t.datetime "updated_at", null: false | ||
40 | t.index ["key"], name: "index_pokeviewer_pokemon_on_key", unique: true | ||
41 | t.index ["species_id"], name: "index_pokeviewer_pokemon_on_species_id" | ||
42 | t.index ["trainer_id"], name: "index_pokeviewer_pokemon_on_trainer_id" | ||
43 | t.index ["uuid"], name: "index_pokeviewer_pokemon_on_uuid", unique: true | ||
44 | end | ||
45 | |||
46 | create_table "pokeviewer_revision_moves", force: :cascade do |t| | ||
47 | t.integer "revision_id", null: false | ||
48 | t.integer "move_id", null: false | ||
49 | t.integer "number", null: false | ||
50 | t.integer "pp_bonuses", default: 0, null: false | ||
51 | t.datetime "created_at", null: false | ||
52 | t.datetime "updated_at", null: false | ||
53 | t.index ["move_id"], name: "index_pokeviewer_revision_moves_on_move_id" | ||
54 | t.index ["revision_id", "number"], name: "index_pokeviewer_revision_moves_on_revision_id_and_number", unique: true | ||
55 | t.index ["revision_id"], name: "index_pokeviewer_revision_moves_on_revision_id" | ||
56 | end | ||
57 | |||
58 | create_table "pokeviewer_revisions", force: :cascade do |t| | ||
59 | t.integer "pokemon_id", null: false | ||
60 | t.integer "sequential_id", null: false | ||
61 | t.string "nickname", null: false | ||
62 | t.integer "experience", null: false | ||
63 | t.integer "level", null: false | ||
64 | t.integer "hp", null: false | ||
65 | t.integer "attack", null: false | ||
66 | t.integer "defense", null: false | ||
67 | t.integer "special_attack", null: false | ||
68 | t.integer "special_defense", null: false | ||
69 | t.integer "speed", null: false | ||
70 | t.integer "coolness", null: false | ||
71 | t.integer "beauty", null: false | ||
72 | t.integer "cuteness", null: false | ||
73 | t.integer "smartness", null: false | ||
74 | t.integer "toughness", null: false | ||
75 | t.integer "sheen", null: false | ||
76 | t.integer "hold_item" | ||
77 | t.datetime "created_at", null: false | ||
78 | t.datetime "updated_at", null: false | ||
79 | t.index ["pokemon_id", "sequential_id"], name: "index_pokeviewer_revisions_on_pokemon_id_and_sequential_id", unique: true | ||
80 | t.index ["pokemon_id"], name: "index_pokeviewer_revisions_on_pokemon_id" | ||
81 | end | ||
82 | |||
83 | create_table "pokeviewer_species", force: :cascade do |t| | ||
84 | t.string "name", limit: 191, null: false | ||
85 | t.datetime "created_at", null: false | ||
86 | t.datetime "updated_at", null: false | ||
87 | t.index ["name"], name: "index_pokeviewer_species_on_name", unique: true | ||
88 | end | ||
89 | |||
90 | create_table "pokeviewer_trainers", force: :cascade do |t| | ||
91 | t.string "game", null: false | ||
92 | t.string "name", limit: 191, null: false | ||
93 | t.integer "number", null: false | ||
94 | t.datetime "created_at", null: false | ||
95 | t.datetime "updated_at", null: false | ||
96 | t.index ["name", "number"], name: "index_pokeviewer_trainers_on_name_and_number", unique: true | ||
97 | end | ||
98 | |||
99 | end | ||
diff --git a/test/fixtures/pokeviewer/moves.yml b/test/fixtures/pokeviewer/moves.yml new file mode 100644 index 0000000..453cab6 --- /dev/null +++ b/test/fixtures/pokeviewer/moves.yml | |||
@@ -0,0 +1,9 @@ | |||
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
2 | |||
3 | one: | ||
4 | name: MyString | ||
5 | pp: 1 | ||
6 | |||
7 | two: | ||
8 | name: MyString | ||
9 | pp: 1 | ||
diff --git a/test/fixtures/pokeviewer/pokemon.yml b/test/fixtures/pokeviewer/pokemon.yml new file mode 100644 index 0000000..750cc53 --- /dev/null +++ b/test/fixtures/pokeviewer/pokemon.yml | |||
@@ -0,0 +1,31 @@ | |||
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
2 | |||
3 | one: | ||
4 | species: one | ||
5 | trainer: one | ||
6 | key: MyString | ||
7 | ot_name: MyString | ||
8 | ot_number: 1 | ||
9 | met_type: MyString | ||
10 | met_location: MyString | ||
11 | met_level: 1 | ||
12 | shiny: false | ||
13 | nature: MyString | ||
14 | gender: MyString | ||
15 | second_ability: false | ||
16 | unown_letter: | ||
17 | |||
18 | two: | ||
19 | species: two | ||
20 | trainer: two | ||
21 | key: MyString | ||
22 | ot_name: MyString | ||
23 | ot_number: 1 | ||
24 | met_type: MyString | ||
25 | met_location: MyString | ||
26 | met_level: 1 | ||
27 | shiny: false | ||
28 | nature: MyString | ||
29 | gender: MyString | ||
30 | second_ability: false | ||
31 | unown_letter: | ||
diff --git a/test/fixtures/pokeviewer/revision_moves.yml b/test/fixtures/pokeviewer/revision_moves.yml new file mode 100644 index 0000000..f70fda1 --- /dev/null +++ b/test/fixtures/pokeviewer/revision_moves.yml | |||
@@ -0,0 +1,13 @@ | |||
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
2 | |||
3 | one: | ||
4 | revision: one | ||
5 | move: one | ||
6 | number: 1 | ||
7 | pp_bonuses: 1 | ||
8 | |||
9 | two: | ||
10 | revision: two | ||
11 | move: two | ||
12 | number: 1 | ||
13 | pp_bonuses: 1 | ||
diff --git a/test/fixtures/pokeviewer/revisions.yml b/test/fixtures/pokeviewer/revisions.yml new file mode 100644 index 0000000..eddd53f --- /dev/null +++ b/test/fixtures/pokeviewer/revisions.yml | |||
@@ -0,0 +1,55 @@ | |||
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
2 | |||
3 | one: | ||
4 | pokemon: one | ||
5 | nickname: MyString | ||
6 | experience: 1 | ||
7 | level: 1 | ||
8 | hp: 1 | ||
9 | attack: 1 | ||
10 | defense: 1 | ||
11 | special_attack: 1 | ||
12 | special_defense: 1 | ||
13 | speed: 1 | ||
14 | coolness: 1 | ||
15 | beauty: 1 | ||
16 | cuteness: 1 | ||
17 | smartness: 1 | ||
18 | toughness: 1 | ||
19 | sheen: 1 | ||
20 | move1: one | ||
21 | move2: one | ||
22 | move3: one | ||
23 | move4: one | ||
24 | move1_pp: 1 | ||
25 | move2_pp: 1 | ||
26 | move3_pp: 1 | ||
27 | move4_pp: 1 | ||
28 | hold_item: 1 | ||
29 | |||
30 | two: | ||
31 | pokemon: two | ||
32 | nickname: MyString | ||
33 | experience: 1 | ||
34 | level: 1 | ||
35 | hp: 1 | ||
36 | attack: 1 | ||
37 | defense: 1 | ||
38 | special_attack: 1 | ||
39 | special_defense: 1 | ||
40 | speed: 1 | ||
41 | coolness: 1 | ||
42 | beauty: 1 | ||
43 | cuteness: 1 | ||
44 | smartness: 1 | ||
45 | toughness: 1 | ||
46 | sheen: 1 | ||
47 | move1: two | ||
48 | move2: two | ||
49 | move3: two | ||
50 | move4: two | ||
51 | move1_pp: 1 | ||
52 | move2_pp: 1 | ||
53 | move3_pp: 1 | ||
54 | move4_pp: 1 | ||
55 | hold_item: 1 | ||
diff --git a/test/fixtures/pokeviewer/species.yml b/test/fixtures/pokeviewer/species.yml new file mode 100644 index 0000000..e5cbf31 --- /dev/null +++ b/test/fixtures/pokeviewer/species.yml | |||
@@ -0,0 +1,9 @@ | |||
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
2 | |||
3 | one: | ||
4 | number: 1 | ||
5 | name: MyString | ||
6 | |||
7 | two: | ||
8 | number: 1 | ||
9 | name: MyString | ||
diff --git a/test/fixtures/pokeviewer/trainers.yml b/test/fixtures/pokeviewer/trainers.yml new file mode 100644 index 0000000..0675334 --- /dev/null +++ b/test/fixtures/pokeviewer/trainers.yml | |||
@@ -0,0 +1,11 @@ | |||
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
2 | |||
3 | one: | ||
4 | game: MyString | ||
5 | name: MyString | ||
6 | number: | ||
7 | |||
8 | two: | ||
9 | game: MyString | ||
10 | name: MyString | ||
11 | number: | ||
diff --git a/test/models/pokeviewer/move_test.rb b/test/models/pokeviewer/move_test.rb new file mode 100644 index 0000000..8737c3f --- /dev/null +++ b/test/models/pokeviewer/move_test.rb | |||
@@ -0,0 +1,9 @@ | |||
1 | require 'test_helper' | ||
2 | |||
3 | module Pokeviewer | ||
4 | class MoveTest < ActiveSupport::TestCase | ||
5 | # test "the truth" do | ||
6 | # assert true | ||
7 | # end | ||
8 | end | ||
9 | end | ||
diff --git a/test/models/pokeviewer/pokemon_test.rb b/test/models/pokeviewer/pokemon_test.rb new file mode 100644 index 0000000..76b61cf --- /dev/null +++ b/test/models/pokeviewer/pokemon_test.rb | |||
@@ -0,0 +1,9 @@ | |||
1 | require 'test_helper' | ||
2 | |||
3 | module Pokeviewer | ||
4 | class PokemonTest < ActiveSupport::TestCase | ||
5 | # test "the truth" do | ||
6 | # assert true | ||
7 | # end | ||
8 | end | ||
9 | end | ||
diff --git a/test/models/pokeviewer/revision_move_test.rb b/test/models/pokeviewer/revision_move_test.rb new file mode 100644 index 0000000..7f716f8 --- /dev/null +++ b/test/models/pokeviewer/revision_move_test.rb | |||
@@ -0,0 +1,9 @@ | |||
1 | require 'test_helper' | ||
2 | |||
3 | module Pokeviewer | ||
4 | class RevisionMoveTest < ActiveSupport::TestCase | ||
5 | # test "the truth" do | ||
6 | # assert true | ||
7 | # end | ||
8 | end | ||
9 | end | ||
diff --git a/test/models/pokeviewer/revision_test.rb b/test/models/pokeviewer/revision_test.rb new file mode 100644 index 0000000..1f9e430 --- /dev/null +++ b/test/models/pokeviewer/revision_test.rb | |||
@@ -0,0 +1,9 @@ | |||
1 | require 'test_helper' | ||
2 | |||
3 | module Pokeviewer | ||
4 | class RevisionTest < ActiveSupport::TestCase | ||
5 | # test "the truth" do | ||
6 | # assert true | ||
7 | # end | ||
8 | end | ||
9 | end | ||
diff --git a/test/models/pokeviewer/species_test.rb b/test/models/pokeviewer/species_test.rb new file mode 100644 index 0000000..26f3218 --- /dev/null +++ b/test/models/pokeviewer/species_test.rb | |||
@@ -0,0 +1,9 @@ | |||
1 | require 'test_helper' | ||
2 | |||
3 | module Pokeviewer | ||
4 | class SpeciesTest < ActiveSupport::TestCase | ||
5 | # test "the truth" do | ||
6 | # assert true | ||
7 | # end | ||
8 | end | ||
9 | end | ||
diff --git a/test/models/pokeviewer/trainer_test.rb b/test/models/pokeviewer/trainer_test.rb new file mode 100644 index 0000000..72f3655 --- /dev/null +++ b/test/models/pokeviewer/trainer_test.rb | |||
@@ -0,0 +1,9 @@ | |||
1 | require 'test_helper' | ||
2 | |||
3 | module Pokeviewer | ||
4 | class TrainerTest < ActiveSupport::TestCase | ||
5 | # test "the truth" do | ||
6 | # assert true | ||
7 | # end | ||
8 | end | ||
9 | end | ||