roundabout 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dcb58b4a2e5cc4434b6cfe400420f51ca98db935
4
+ data.tar.gz: 1075039a0f8931e5f680372c88a77f86bee32a98
5
+ SHA512:
6
+ metadata.gz: 1cb6ac0560493f4ceb19d0f6291d367d31d1d68976cfc760bcfa4ffbca7058f426b6e543848fd12ec591061a7714e0137fb315778c1c3fc6d7385ccce5615ee2
7
+ data.tar.gz: 691efe7c90e8e138e04179a5a662a533e53118a4378b85b694f601f109a426693a8007ab56b551a9f625e35e3b3b6a65a3c68680026ef58e4b60e7a4408d5d9a
data/README.md CHANGED
@@ -53,3 +53,9 @@ Then browse at your `http://localhost:3000/roundabout`
53
53
  3. Commit your changes (`git commit -am 'Add some feature'`)
54
54
  4. Push to the branch (`git push origin my-new-feature`)
55
55
  5. Create new Pull Request
56
+
57
+
58
+ ## Team
59
+
60
+ * [Akira Matsuda](https://github.com/amatsuda)
61
+ * [Teppei Machida](http://github.com/machida)
@@ -1,5 +1,106 @@
1
+ $black: #444444;
2
+ $white: white;
3
+ $yellow: #fffebe;
4
+ $button_yellow: #ffff4f;
5
+ $background-color: #3aade3;
6
+
7
+ // reset
8
+
9
+ html, body, p, ul, ol, dl, p, li, dt, dd, tr, td, form {
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+
14
+ li {
15
+ list-style-type: none;
16
+ }
17
+
18
+ // design
19
+
20
+ body {
21
+ margin: 20px;
22
+ color: $black;
23
+ position: relative;
24
+ font-family: arial,sans-serif;
25
+ background: $background-color url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/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j//78KEDMQwkwMRIJRhXgBC5RWIaQQIMAA1wEePzIPm4IAAAAASUVORK5CYII=) repeat top right;
26
+ }
27
+
28
+ #roundabout {
29
+ padding: 20px;
30
+ z-index: 2;
31
+ }
32
+
1
33
  div.node {
2
34
  position: absolute;
3
- border: 1px #000 solid;
35
+ border: 1px #444444 solid;
4
36
  cursor: move;
37
+ background: $white;
38
+ border-radius: 3px;
39
+ -moz-box-sizing: border-box;
40
+ -webkit-box-sizing: border-box;
41
+ box-sizing: border-box;
42
+ padding: 4px;
43
+ &:hover {
44
+ box-shadow: rgba(0, 0, 0, 0.6) 0 1px 2px;
45
+ background: $yellow;
46
+ z-index: 10
47
+ }
48
+ }
49
+
50
+ .node-name span {
51
+ display: block;
52
+ font-size: 12px;
53
+ line-height: 1.4;
54
+ }
55
+
56
+ svg {
57
+ z-index: -1;
58
+ }
59
+
60
+ @mixin button($button-color: $button_yellow) {
61
+ display: block;
62
+ color: lighten($black, 8%);
63
+ font-size: 11px;
64
+ line-height: 28px;
65
+ text-decoration: none;
66
+ border-radius: 4px;
67
+ text-shadow: rgba(255, 255, 255, 0.4) 0 1px 0;
68
+ padding: 0 12px;
69
+ border: darken($button-color, 16%) solid 1px;
70
+ box-shadow: rgba(255, 255, 255, 0.2) 0 1px 0 inset, rgba(0, 0, 0, .1) 0 1px 0;
71
+ background: linear-gradient($button-color, darken($button-color, 8%));
72
+ span {
73
+ font-weight: bold;
74
+ font-size: 16px;
75
+ color: $black;
76
+ display: inline-block;
77
+ margin: 0 0 0 4px;
78
+ }
79
+ &:hover {
80
+ background: linear-gradient(darken($button-color, 6%), darken($button-color, 12%));
81
+ }
82
+ &:active {
83
+ box-shadow: rgba(0, 0, 0, .1) 0 1px 1px inset, rgba(255, 255, 255, .4) 0 1px 0;
84
+ }
85
+ }
86
+
87
+ #downloads {
88
+ position: absolute;
89
+ top: 0;
90
+ right: 0;
91
+ background: rgba(255, 255, 255, .6);
92
+ padding: 12px 14px;
93
+ border-radius: 4px;
94
+ }
95
+
96
+ #downloads li:first-child a {
97
+ margin: 0 0 10px;
98
+ }
99
+
100
+ .pdf {
101
+ @include button(#fdf524);
102
+ }
103
+
104
+ .png {
105
+ @include button(#ffc2ee);
5
106
  }
@@ -5,22 +5,22 @@ require 'graphviz'
5
5
  module Roundabout
6
6
  class RoundaboutController < ::Roundabout::ApplicationController
7
7
  def index
8
- if (json = Rails.root.join('doc/roundabout.json')).exist?
8
+ if (json = Rails.root.join('tmp/roundabout.json')).exist?
9
9
  transitions = ActiveSupport::JSON.decode json.read
10
10
  viz = GraphViz.new(:G, type: :digraph, rankdir: 'LR') do |g|
11
11
  transitions.each do |t|
12
- from = g.add_nodes t['from'], shape: 'box'
13
- to = g.add_nodes t['to'], shape: 'box'
12
+ from = g.add_nodes t['from'].sub('#', "\n"), shape: 'box'
13
+ to = g.add_nodes t['to'].sub('#', "\n"), shape: 'box'
14
14
  color = case t['type']
15
15
  when 'redirect'
16
- 'red'
16
+ '#484848'
17
17
  when 'form'
18
- 'green'
18
+ '#f83737'
19
19
  else
20
20
  if t['method'] != 'get'
21
- 'green'
21
+ '#f83737'
22
22
  else
23
- 'darkblue'
23
+ '#f2cd01'
24
24
  end
25
25
  end
26
26
  g.add_edges from, to, color: color
@@ -3,11 +3,26 @@
3
3
  <% @nodes.each.with_index(1) do |node, i| %>
4
4
  <% width, height = BigDecimal.new(node[:width].source) * 72, BigDecimal.new(node[:height].source) * 72 %>
5
5
  <div id="roundabout-node-<%= i %>" class="node" style="top: <%= node[:pos].point[1] - height / 2 %>px; left: <%= node[:pos].point[0] - width / 2 %>px; width: <%= width %>px; height: <%= height %>px;">
6
- <div class="node-name"><%= node.id %></div>
6
+ <%- node_controller_name, node_action_name = node.id.split("\n") %>
7
+ <div class="node-name"><span class="controller_name"><%= node_controller_name %></span><span class="controller_name"><%= node_action_name %></span></div>
7
8
  </div>
8
9
  <% end %>
9
10
  <script>window.raw_edges = '<%= @edges.to_json.html_safe %>';</script>
10
11
  </div>
11
12
  </div>
12
- <p><%= link_to 'Download .png file', '/roundabout.png' %></p>
13
- <p><%= link_to 'Download .pdf file', '/roundabout.pdf' %></p>
13
+ <div id="downloads">
14
+ <ul>
15
+ <li>
16
+ <%= link_to '/roundabout.png', {:class => 'png'} do %>
17
+ Download
18
+ <span>.png</span>
19
+ <% end %>
20
+ </li>
21
+ <li>
22
+ <%= link_to '/roundabout.pdf', {:class => 'pdf'} do %>
23
+ Download
24
+ <span>.pdf</span>
25
+ <% end %>
26
+ </li>
27
+ </ul>
28
+ </div>
@@ -1,6 +1,6 @@
1
1
  RSpec.configure do |config|
2
2
  config.after :suite do
3
3
  transitions = Roundabout.compile_page_transitions
4
- Rails.root.join('doc/roundabout.json').open('w') {|f| f.write transitions.to_json} unless transitions.empty?
4
+ Rails.root.join('tmp/roundabout.json').open('w') {|f| f.write transitions.to_json} unless transitions.empty?
5
5
  end
6
6
  end
@@ -1,3 +1,3 @@
1
1
  module Roundabout
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roundabout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Akira Matsuda
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-21 00:00:00.000000000 Z
11
+ date: 2013-07-16 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: capybara
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 1.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 1.0.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: 2.0.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: 2.0.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: ruby-graphviz
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: 1.0.0
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: 1.0.0
62
55
  description: A Rails Engine that generates a page transition diagram for your Rails
@@ -94,27 +87,26 @@ files:
94
87
  - vendor/assets/javascripts/raphael-min.js
95
88
  homepage: https://github.com/amatsuda/roundabout
96
89
  licenses: []
90
+ metadata: {}
97
91
  post_install_message:
98
92
  rdoc_options: []
99
93
  require_paths:
100
94
  - lib
101
95
  required_ruby_version: !ruby/object:Gem::Requirement
102
- none: false
103
96
  requirements:
104
- - - ! '>='
97
+ - - '>='
105
98
  - !ruby/object:Gem::Version
106
99
  version: '0'
107
100
  required_rubygems_version: !ruby/object:Gem::Requirement
108
- none: false
109
101
  requirements:
110
- - - ! '>='
102
+ - - '>='
111
103
  - !ruby/object:Gem::Version
112
104
  version: '0'
113
105
  requirements: []
114
106
  rubyforge_project:
115
- rubygems_version: 1.8.24
107
+ rubygems_version: 2.0.3
116
108
  signing_key:
117
- specification_version: 3
109
+ specification_version: 4
118
110
  summary: A Rails Engine that generates a page transition diagram for your Rails app
119
111
  from request specs
120
112
  test_files: []