skmz 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 744421e27c396c6d574bfe89328938ef0b3fc268
4
- data.tar.gz: bf9ec1a344460e6e437b5297d40bf50877da424c
3
+ metadata.gz: 2d110c32f3ee2c06d6f4261a4853b67489c2e4e8
4
+ data.tar.gz: 4db7839679608083473e078add306b0ab44eb4c3
5
5
  SHA512:
6
- metadata.gz: f358eabf0308d7e0895b452fb86977eafc8e1820e3d7721fa6ff5aef52f8f7e0fa4d3f1c606482dd65e72bc399e367c8ea8e127c74e4d7c1b1a6d3ffa2d883e4
7
- data.tar.gz: f345e9d9e0b8f80cc115d7358f438acdbe44b1b10c8d0fc84ec45bd441e94fc7d43a99fb30660a0d34e9b10d6007a02f3900b18b7957b95050437d09421e400a
6
+ metadata.gz: d7437028413ece2e5968b9f53bc42df6b29758981e261ea22c1983dbde8430bac2a5034c245c417c55ec5e61eae23488142262069c1e03111bea59c8f7d0f65e
7
+ data.tar.gz: c5e74230c58abb4208098aaae2cd3a45328d6010508fdb8f3799267ac9cfbd7f9ead7a56e9d970cfa8b10e2c2e74455748356e7a07124d1a0b62f368e173faf4
data/.gitignore CHANGED
@@ -15,3 +15,7 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+
19
+ spec/dummy/db/*.sqlite3
20
+ spec/dummy/log/*.log
21
+ spec/dummy/tmp/
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # Skmz
2
2
 
3
- [![Build Status](https://travis-ci.org/ryog/skmz.png?branch=master)](https://travis-ci.org/ryog/skmz)
3
+ [![Gem Version](https://badge.fury.io/rb/skmz.png)](http://badge.fury.io/rb/skmz)
4
+ [![Build Status](https://travis-ci.org/ryog/skmz.png?branch=develop)](https://travis-ci.org/ryog/skmz)
4
5
  [![Code Climate](https://codeclimate.com/github/ryog/skmz.png)](https://codeclimate.com/github/ryog/skmz)
5
- [![Coverage Status](https://coveralls.io/repos/ryog/skmz/badge.png?branch=master)](https://coveralls.io/r/ryog/skmz?branch=master)
6
+ [![Coverage Status](https://coveralls.io/repos/ryog/skmz/badge.png?branch=develop)](https://coveralls.io/r/ryog/skmz?branch=develop)
6
7
  [![Dependency Status](https://gemnasium.com/ryog/skmz.png)](https://gemnasium.com/ryog/skmz)
7
8
 
8
9
  Skmz is a Rails engine that shows the schemas.
@@ -25,7 +26,7 @@ $ bundle
25
26
 
26
27
  ## Usage
27
28
 
28
- Visit `/skmz/schemas` in your app.
29
+ Visit `/skmz/info/schemas` in your app.
29
30
 
30
31
  ## Contributing
31
32
 
@@ -0,0 +1,9 @@
1
+ module Skmz
2
+ module Info
3
+ class SchemasController < ActionController::Base
4
+ def index
5
+ @schema = Skmz::Schema.load
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,40 @@
1
+ <h2>Your App: Schemas</h2>
2
+ <h2>Schemas</h2>
3
+ <p>Search form is Not Implemented.</p>
4
+ <table>
5
+ <thead>
6
+ <tr>
7
+ <th>Table Name</th>
8
+ <th>Column Type</th>
9
+ <th>Column Name</th>
10
+ </tr>
11
+ <tr>
12
+ <th><input type="search" placeholder="Table Match"></th>
13
+ <th>
14
+ <select id="" name="">
15
+ <option value=""></option>
16
+ <option value="">string</option>
17
+ <option value="">integer</option>
18
+ <option value="">date</option>
19
+ <option value="">datetime</option>
20
+ </select>
21
+ </th>
22
+ <th><input type="search" placeholder="Column Match"></th>
23
+ </tr>
24
+ </thead>
25
+ <% @schema.tables.each do |table| %>
26
+ <tbody>
27
+ <% table.columns.each_with_index do |column, i| %>
28
+ <tr>
29
+ <% if i.zero? %>
30
+ <td><%= table.name %></td>
31
+ <% else %>
32
+ <td></td>
33
+ <% end %>
34
+ <td><%= column.type %></td>
35
+ <td><%= column.name %></td>
36
+ </tr>
37
+ <% end %>
38
+ </tbody>
39
+ <% end %>
40
+ </table>
@@ -2,7 +2,9 @@ module ActionDispatch::Routing
2
2
  class Mapper
3
3
  def mount_skmz
4
4
  namespace :skmz do
5
- resources :schemas, only: [:index]
5
+ namespace :info do
6
+ resources :schemas, only: [:index]
7
+ end
6
8
  end
7
9
  end
8
10
  end
@@ -1,3 +1,3 @@
1
1
  module Skmz
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "coveralls"
25
25
  spec.add_development_dependency "rake"
26
- spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "rspec-rails"
27
27
  spec.add_development_dependency "sqlite3"
28
28
  end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ module Skmz
4
+ module Info
5
+ describe SchemasController do
6
+ describe "GET index" do
7
+ it "assigns @schema" do
8
+ schema = Schema.new
9
+ Schema.should_receive(:load).and_return(schema)
10
+ get :index
11
+ expect(assigns(:schema)).to eq(schema)
12
+ end
13
+
14
+ it "renders the index template" do
15
+ get :index
16
+ expect(response).to render_template('index')
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,2 @@
1
+ class Anime < ActiveRecord::Base
2
+ end
@@ -0,0 +1,2 @@
1
+ class Character < ActiveRecord::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class Entry < ActiveRecord::Base
2
+ belongs_to :anime
3
+ belongs_to :character
4
+ end
@@ -0,0 +1,2 @@
1
+ class Genre < ActiveRecord::Base
2
+ end
@@ -0,0 +1,9 @@
1
+ class CreateGenres < ActiveRecord::Migration
2
+ def change
3
+ create_table :genres do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ class CreateAnimes < ActiveRecord::Migration
2
+ def change
3
+ create_table :animes do |t|
4
+ t.string :title
5
+ t.date :start_on
6
+ t.date :end_on
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ class CreateCharacters < ActiveRecord::Migration
2
+ def change
3
+ create_table :characters do |t|
4
+ t.string :name
5
+ t.integer :sex
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class CreateEntries < ActiveRecord::Migration
2
+ def change
3
+ create_table :entries do |t|
4
+ t.references :anime, index: true
5
+ t.references :character, index: true
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,47 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20140210085431) do
15
+
16
+ create_table "animes", force: true do |t|
17
+ t.string "title"
18
+ t.date "start_on"
19
+ t.date "end_on"
20
+ t.datetime "created_at"
21
+ t.datetime "updated_at"
22
+ end
23
+
24
+ create_table "characters", force: true do |t|
25
+ t.string "name"
26
+ t.integer "sex"
27
+ t.datetime "created_at"
28
+ t.datetime "updated_at"
29
+ end
30
+
31
+ create_table "entries", force: true do |t|
32
+ t.integer "anime_id"
33
+ t.integer "character_id"
34
+ t.datetime "created_at"
35
+ t.datetime "updated_at"
36
+ end
37
+
38
+ add_index "entries", ["anime_id"], name: "index_entries_on_anime_id"
39
+ add_index "entries", ["character_id"], name: "index_entries_on_character_id"
40
+
41
+ create_table "genres", force: true do |t|
42
+ t.string "name"
43
+ t.datetime "created_at"
44
+ t.datetime "updated_at"
45
+ end
46
+
47
+ end
@@ -2,5 +2,33 @@ require 'spec_helper'
2
2
 
3
3
  module Skmz
4
4
  describe Table do
5
+ describe :as_json do
6
+ it "should eq json format" do
7
+ table = Table.new(name: 'users')
8
+ table.should_receive(:columns).and_return([
9
+ Column.new(name: 'id', type: 'integer'),
10
+ Column.new(name: 'name', type: 'string')
11
+ ])
12
+ actual = { name: 'users',
13
+ columns: [
14
+ { 'name' => 'id', 'type' => 'integer'},
15
+ { 'name' => 'name', 'type' => 'string'}
16
+ ]
17
+ }
18
+ expect(table.as_json).to eq actual
19
+ end
20
+ end
21
+
22
+ describe :columns do
23
+ it "should eq Array of Column" do
24
+ columns = [
25
+ Column.new(name: 'id', type: 'integer'),
26
+ Column.new(name: 'name', type: 'string')
27
+ ]
28
+ table = Table.new(name: 'users')
29
+ table.instance_variable_set(:@columns, columns)
30
+ expect(table.columns).to eq columns
31
+ end
32
+ end
5
33
  end
6
34
  end
@@ -4,6 +4,12 @@ require 'action_controller'
4
4
  require 'rails/engine'
5
5
  require 'skmz'
6
6
 
7
+ require File.expand_path("../dummy/config/environment", __FILE__)
8
+ require 'rspec/rails'
9
+
10
+ app_dir = File.expand_path('../../app', __FILE__)
11
+ Dir.glob("#{app_dir}/controllers/**/*.rb").each { |f| require f }
12
+
7
13
  if ENV["TRAVIS"]
8
14
  require 'coveralls'
9
15
  Coveralls.wear!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skmz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryoji Yoshioka
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec
70
+ name: rspec-rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -109,9 +109,9 @@ files:
109
109
  - LICENSE.txt
110
110
  - README.md
111
111
  - Rakefile
112
- - app/controllers/skmz/schemas_controller.rb
112
+ - app/controllers/skmz/info/schemas_controller.rb
113
113
  - app/views/layouts/skmz/application.html.erb
114
- - app/views/skmz/schemas/index.html.erb
114
+ - app/views/skmz/info/schemas/index.html.erb
115
115
  - config/routes.rb
116
116
  - lib/skmz.rb
117
117
  - lib/skmz/column.rb
@@ -121,6 +121,7 @@ files:
121
121
  - lib/skmz/table.rb
122
122
  - lib/skmz/version.rb
123
123
  - skmz.gemspec
124
+ - spec/controllers/skmz/info/schemas_controller_spec.rb
124
125
  - spec/dummy/README.rdoc
125
126
  - spec/dummy/Rakefile
126
127
  - spec/dummy/app/assets/images/.keep
@@ -131,7 +132,11 @@ files:
131
132
  - spec/dummy/app/helpers/application_helper.rb
132
133
  - spec/dummy/app/mailers/.keep
133
134
  - spec/dummy/app/models/.keep
135
+ - spec/dummy/app/models/anime.rb
136
+ - spec/dummy/app/models/character.rb
134
137
  - spec/dummy/app/models/concerns/.keep
138
+ - spec/dummy/app/models/entry.rb
139
+ - spec/dummy/app/models/genre.rb
135
140
  - spec/dummy/app/views/layouts/application.html.erb
136
141
  - spec/dummy/bin/bundle
137
142
  - spec/dummy/bin/rails
@@ -153,10 +158,13 @@ files:
153
158
  - spec/dummy/config/initializers/wrap_parameters.rb
154
159
  - spec/dummy/config/locales/en.yml
155
160
  - spec/dummy/config/routes.rb
156
- - spec/dummy/db/development.sqlite3
161
+ - spec/dummy/db/migrate/20140210085207_create_genres.rb
162
+ - spec/dummy/db/migrate/20140210085314_create_animes.rb
163
+ - spec/dummy/db/migrate/20140210085332_create_characters.rb
164
+ - spec/dummy/db/migrate/20140210085431_create_entries.rb
165
+ - spec/dummy/db/schema.rb
157
166
  - spec/dummy/lib/assets/.keep
158
167
  - spec/dummy/log/.keep
159
- - spec/dummy/log/development.log
160
168
  - spec/dummy/public/404.html
161
169
  - spec/dummy/public/422.html
162
170
  - spec/dummy/public/500.html
@@ -191,6 +199,7 @@ signing_key:
191
199
  specification_version: 4
192
200
  summary: Skmz is a Rails engine that shows the schemas.
193
201
  test_files:
202
+ - spec/controllers/skmz/info/schemas_controller_spec.rb
194
203
  - spec/dummy/README.rdoc
195
204
  - spec/dummy/Rakefile
196
205
  - spec/dummy/app/assets/images/.keep
@@ -201,7 +210,11 @@ test_files:
201
210
  - spec/dummy/app/helpers/application_helper.rb
202
211
  - spec/dummy/app/mailers/.keep
203
212
  - spec/dummy/app/models/.keep
213
+ - spec/dummy/app/models/anime.rb
214
+ - spec/dummy/app/models/character.rb
204
215
  - spec/dummy/app/models/concerns/.keep
216
+ - spec/dummy/app/models/entry.rb
217
+ - spec/dummy/app/models/genre.rb
205
218
  - spec/dummy/app/views/layouts/application.html.erb
206
219
  - spec/dummy/bin/bundle
207
220
  - spec/dummy/bin/rails
@@ -223,10 +236,13 @@ test_files:
223
236
  - spec/dummy/config/initializers/wrap_parameters.rb
224
237
  - spec/dummy/config/locales/en.yml
225
238
  - spec/dummy/config/routes.rb
226
- - spec/dummy/db/development.sqlite3
239
+ - spec/dummy/db/migrate/20140210085207_create_genres.rb
240
+ - spec/dummy/db/migrate/20140210085314_create_animes.rb
241
+ - spec/dummy/db/migrate/20140210085332_create_characters.rb
242
+ - spec/dummy/db/migrate/20140210085431_create_entries.rb
243
+ - spec/dummy/db/schema.rb
227
244
  - spec/dummy/lib/assets/.keep
228
245
  - spec/dummy/log/.keep
229
- - spec/dummy/log/development.log
230
246
  - spec/dummy/public/404.html
231
247
  - spec/dummy/public/422.html
232
248
  - spec/dummy/public/500.html
@@ -1,7 +0,0 @@
1
- module Skmz
2
- class SchemasController < ActionController::Base
3
- def index
4
- @schema = Skmz::Schema.load
5
- end
6
- end
7
- end
@@ -1,18 +0,0 @@
1
- <h1>Info::Schemas#index</h1>
2
- <% @schema.tables.each do |table| %>
3
- <h2><%= table.name %></h2>
4
- <table>
5
- <tr>
6
- <th>Column Type</th>
7
- <th>Column Name</th>
8
- </tr>
9
- <% table.columns.each do |column| %>
10
- <tr>
11
- <td><%= column.type %></td>
12
- <td><%= column.name %></td>
13
- </tr>
14
- <% end %>
15
- </table>
16
- <ul>
17
- </ul>
18
- <% end %>
File without changes
@@ -1,70 +0,0 @@
1
-
2
-
3
- Started GET "/" for 127.0.0.1 at 2014-02-09 22:51:30 +0900
4
-
5
- Gem::LoadError (Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile.):
6
- activerecord (4.0.2) lib/active_record/connection_adapters/connection_specification.rb:58:in `rescue in resolve_hash_connection'
7
- activerecord (4.0.2) lib/active_record/connection_adapters/connection_specification.rb:55:in `resolve_hash_connection'
8
- activerecord (4.0.2) lib/active_record/connection_adapters/connection_specification.rb:46:in `resolve_string_connection'
9
- activerecord (4.0.2) lib/active_record/connection_adapters/connection_specification.rb:30:in `spec'
10
- activerecord (4.0.2) lib/active_record/connection_handling.rb:39:in `establish_connection'
11
- activerecord (4.0.2) lib/active_record/railtie.rb:176:in `block (2 levels) in <class:Railtie>'
12
- activesupport (4.0.2) lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
13
- activesupport (4.0.2) lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
14
- activesupport (4.0.2) lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
15
- activesupport (4.0.2) lib/active_support/lazy_load_hooks.rb:44:in `each'
16
- activesupport (4.0.2) lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
17
- activerecord (4.0.2) lib/active_record/base.rb:322:in `<module:ActiveRecord>'
18
- activerecord (4.0.2) lib/active_record/base.rb:22:in `<top (required)>'
19
- activerecord (4.0.2) lib/active_record/query_cache.rb:50:in `restore_query_cache_settings'
20
- activerecord (4.0.2) lib/active_record/query_cache.rb:43:in `rescue in call'
21
- activerecord (4.0.2) lib/active_record/query_cache.rb:32:in `call'
22
- activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
23
- activerecord (4.0.2) lib/active_record/migration.rb:369:in `call'
24
- actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
25
- activesupport (4.0.2) lib/active_support/callbacks.rb:373:in `_run__427203040222248745__call__callbacks'
26
- activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks'
27
- actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
28
- actionpack (4.0.2) lib/action_dispatch/middleware/reloader.rb:64:in `call'
29
- actionpack (4.0.2) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
30
- actionpack (4.0.2) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
31
- actionpack (4.0.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
32
- railties (4.0.2) lib/rails/rack/logger.rb:38:in `call_app'
33
- railties (4.0.2) lib/rails/rack/logger.rb:20:in `block in call'
34
- activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `block in tagged'
35
- activesupport (4.0.2) lib/active_support/tagged_logging.rb:25:in `tagged'
36
- activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `tagged'
37
- railties (4.0.2) lib/rails/rack/logger.rb:20:in `call'
38
- actionpack (4.0.2) lib/action_dispatch/middleware/request_id.rb:21:in `call'
39
- rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
40
- rack (1.5.2) lib/rack/runtime.rb:17:in `call'
41
- activesupport (4.0.2) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
42
- rack (1.5.2) lib/rack/lock.rb:17:in `call'
43
- actionpack (4.0.2) lib/action_dispatch/middleware/static.rb:64:in `call'
44
- rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
45
- railties (4.0.2) lib/rails/engine.rb:511:in `call'
46
- railties (4.0.2) lib/rails/application.rb:97:in `call'
47
- rack (1.5.2) lib/rack/lock.rb:17:in `call'
48
- rack (1.5.2) lib/rack/content_length.rb:14:in `call'
49
- rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
50
- /Users/ryoji/.rbenv/versions/2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
51
- /Users/ryoji/.rbenv/versions/2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
52
- /Users/ryoji/.rbenv/versions/2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
53
-
54
-
55
- Rendered /Users/ryoji/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/middleware/templates/rescues/_source.erb (0.5ms)
56
- Rendered /Users/ryoji/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
57
- Rendered /Users/ryoji/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.8ms)
58
- Rendered /Users/ryoji/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (14.2ms)
59
-
60
-
61
- Started GET "/" for 127.0.0.1 at 2014-02-09 22:52:28 +0900
62
- Processing by Rails::WelcomeController#index as HTML
63
- Rendered /Users/ryoji/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.0.2/lib/rails/templates/rails/welcome/index.html.erb (1.2ms)
64
- Completed 200 OK in 7ms (Views: 6.6ms | ActiveRecord: 0.0ms)
65
-
66
-
67
- Started GET "/skmz/schemas" for 127.0.0.1 at 2014-02-09 22:52:33 +0900
68
- Processing by Skmz::SchemasController#index as HTML
69
- Rendered /Users/ryoji/code/skmz/app/views/skmz/schemas/index.html.erb (0.8ms)
70
- Completed 200 OK in 6ms (Views: 3.7ms | ActiveRecord: 1.6ms)