draw_erd 0.1.0 → 0.1.1

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: 8b7b0c0911557a83879ba6624e66707b617f226d
4
- data.tar.gz: 29a2c153a62e3e33d3053b1a4b6f037031f2ff9c
3
+ metadata.gz: 361694cfa9e1723292cd4da1979dc995d4f602a5
4
+ data.tar.gz: a87facd4851fd70f3e0e3b5fa1ddec6cbcdc56e0
5
5
  SHA512:
6
- metadata.gz: af79685ab5eab53b72f72e09f267ebc632fa7d89f0d8dde5c189bf6c0f0a9f379779d5b1e82ce0fe8c83b5f6ba720644aecdeafc092b6010897a5c349d487f1e
7
- data.tar.gz: f87a50ce99acfc9da9c65a6df78e952362762b58ab7d0505925faa89ae33ca4cf50248981e9415aed39fadba10fdc4052e3c5f842afe6a7fefc91f6dbaa91dab
6
+ metadata.gz: b7647034cce2f4234a18df184423ce64b2a1fa38caa9aa6a1d624c81553cefc7b95626650bef11eb9c672a5c1568d8589bebfe11a98ccc44c3b22cf703c9215b
7
+ data.tar.gz: 8715022cdd5937caf9963525f0a5dc521721dd3b3e448a6a1b8c933ba6f5ffc274c5da0826b4286fb8b4580ce09d6f7c85cdd7bc91ec1532046a0d4c6ee9d17d
data/.gitignore CHANGED
@@ -1,7 +1,8 @@
1
1
  .bundle
2
- Gemfile.lock
3
2
  pkg
4
3
  tmp
4
+ Gemfile.lock
5
+
5
6
  spec/dummy/db/*.sqlite3
6
7
  spec/dummy/db/*.sqlite3-journal
7
8
  spec/dummy/log/*.log
data/README.md CHANGED
@@ -20,7 +20,7 @@ $ bundle
20
20
 
21
21
  ## Usage
22
22
 
23
- Add this line to your config/routes.rb:
23
+ Add this line to your `config/routes.rb`:
24
24
 
25
25
  ```
26
26
  mount DrawErd::Engine, at: '/rails/info/schemas'
@@ -1,6 +1,8 @@
1
1
  module DrawErd
2
2
  class DiagramController < ::DrawErd::ApplicationController
3
3
  def index
4
+ @schemas = DrawErd::Diagram.schemas
5
+
4
6
  title = 'erd'
5
7
  path = 'draw-erd'
6
8
  @image_file = File.join(path, "#{title}.png")
@@ -10,8 +12,6 @@ module DrawErd
10
12
 
11
13
  diagram = DrawErd::Diagram.new(File.join('public', 'images', path))
12
14
  diagram.create(title, @domains)
13
-
14
- @schemas = DrawErd::Diagram.schemas
15
15
  end
16
16
  end
17
17
  end
@@ -9,6 +9,19 @@ module DrawErd
9
9
  schemas.map! {|schema| schema.singularize.camelize}
10
10
  schemas.sort
11
11
  end
12
+
13
+ def reset_migrations
14
+ paths = ActiveRecord::Migrator.migrations_paths
15
+ paths.each do |path|
16
+ Dir.foreach(path) do |file|
17
+ if match_data = /^(\d{3,})_(.+)\.rb$/.match(file)
18
+ version = match_data[1].to_i
19
+ ActiveRecord::Migrator.run(:down, paths, version)
20
+ ActiveRecord::Migrator.run(:up, paths, version)
21
+ end
22
+ end
23
+ end
24
+ end
12
25
  end
13
26
 
14
27
  def initialize(path)
@@ -16,11 +29,11 @@ module DrawErd
16
29
  FileUtils.mkdir_p(@path)
17
30
  end
18
31
 
19
- def create(title, domains=[])
32
+ def create(title, domains=[], attributes=[:foreign_keys, :content])
20
33
  only = domains.map {|domain| domain.to_sym}
21
34
  options = {
22
35
  filetype: :png,
23
- attributes: [:foreign_keys, :primary_keys, :content],
36
+ attributes: attributes,
24
37
  title: title.to_s,
25
38
  only: only,
26
39
  filename: File.join(@path, title.to_s)
@@ -18,9 +18,9 @@
18
18
  <% @schemas.each do |schema| %>
19
19
  <tr>
20
20
  <td>
21
- <%= check_box :schemas, schema,
22
- {checked: @domains.include?(schema), onclick: 'check_schema()'}, true, false %>
23
- <%= schema %>
21
+ <%= check_box :schemas, schema, {id: "check_#{schema}", checked: @domains.include?(schema),
22
+ onclick: 'check_schema()'}, true, false %>
23
+ <%= label_tag "check[#{schema}]", schema %>
24
24
  </td>
25
25
  </tr>
26
26
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module DrawErd
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: draw_erd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ogom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-29 00:00:00.000000000 Z
11
+ date: 2014-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails