docushin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/app/controllers/docushin/routes_controller.rb +36 -0
- data/app/helpers/docushin/application_helper.rb +10 -0
- data/app/views/docushin/routes/_form.html.erb +24 -0
- data/app/views/docushin/routes/edit.html.erb +1 -0
- data/app/views/docushin/routes/index.html.erb +28 -0
- data/app/views/docushin/routes/show.html.erb +7 -0
- data/app/views/layouts/docushin.html.erb +100 -0
- data/config/routes.rb +3 -0
- data/docushin.gemspec +23 -0
- data/lib/docushin.rb +7 -0
- data/lib/docushin/engine.rb +5 -0
- data/lib/docushin/route.rb +52 -0
- data/lib/docushin/route_set.rb +36 -0
- data/lib/docushin/version.rb +3 -0
- data/spec/docushin/route_set_spec.rb +10 -0
- data/spec/docushin/route_spec.rb +39 -0
- data/spec/docushin_spec.rb +4 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +65 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/spec_helper.rb +16 -0
- metadata +183 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Todor Grudev
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Docushin
|
2
|
+
|
3
|
+
Docushin creates documentation based on your rails application routes.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'docushin'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle install
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Mount engine in your application `config/routes.rb`
|
18
|
+
|
19
|
+
mount Docushin::Engine, :at => "docushin"
|
20
|
+
|
21
|
+
You can specify, the name of the route you want Docushin to be mountet at, just change "docushin"
|
22
|
+
to your desired destination. It creates a resource on `http://yousitename/docushin/routes`.
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
|
26
|
+
1. Fork it
|
27
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
28
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
29
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
30
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
class Docushin::RoutesController < ActionController::Base
|
2
|
+
layout 'docushin'
|
3
|
+
before_filter :load_route_set
|
4
|
+
|
5
|
+
def index
|
6
|
+
end
|
7
|
+
|
8
|
+
def show
|
9
|
+
@route = @routes_collection.find_by_filename_hash(params[:id])
|
10
|
+
end
|
11
|
+
|
12
|
+
def edit
|
13
|
+
@route = @routes_collection.find_by_filename_hash(params[:id])
|
14
|
+
end
|
15
|
+
|
16
|
+
def update
|
17
|
+
@route = @routes_collection.find_by_filename_hash(params[:id])
|
18
|
+
#create the directory if it doesnt exists
|
19
|
+
FileUtils.mkdir_p(@path) unless File.exists?(@path)
|
20
|
+
|
21
|
+
File.open(File.join(@path, @route.file_name) + ".md", "w+") do |file|
|
22
|
+
file.write "---\n"
|
23
|
+
file.write "description: " + params[:route][:description] + "\n"
|
24
|
+
file.write "---\n"
|
25
|
+
file.write params[:route][:content]
|
26
|
+
file.close
|
27
|
+
end
|
28
|
+
redirect_to routes_path
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def load_route_set
|
33
|
+
@routes_collection = Docushin::RouteSet.new
|
34
|
+
@path = File.join(Rails.root, 'doc', 'docushin')
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Docushin
|
2
|
+
module ApplicationHelper
|
3
|
+
def generate_name(verb, path)
|
4
|
+
return Digest::MD5.hexdigest(verb + path)
|
5
|
+
end
|
6
|
+
def file_exists?(verb, path)
|
7
|
+
File.exists?(File.join(Rails.root, 'doc', 'docushin', generate_name(verb, path)) + '.md')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h3 id="title"><%= @route.verb + " " + @route.path %></h3>
|
2
|
+
<%= form_for(@route) do |f| %>
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<td>
|
6
|
+
<%= f.label :description %>
|
7
|
+
</td>
|
8
|
+
<td>
|
9
|
+
<%= f.text_field :description %>
|
10
|
+
</td>
|
11
|
+
</tr>
|
12
|
+
<tr>
|
13
|
+
<td>
|
14
|
+
<%= f.label :content %>
|
15
|
+
</td>
|
16
|
+
<td>
|
17
|
+
<%= f.text_area(:content, :cols => 50, :rows => 20) %>
|
18
|
+
</td>
|
19
|
+
</tr>
|
20
|
+
</table>
|
21
|
+
<div class="actions">
|
22
|
+
<%= f.submit %>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<% @routes_collection.routes.group_by{ |r| r.controller }.each do |controller, routes| %>
|
2
|
+
<h2><%= controller.titleize %></h2>
|
3
|
+
<table>
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th>Resource</th>
|
7
|
+
<th>Description</th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<% routes.each do |route|%>
|
12
|
+
<tr>
|
13
|
+
<td class="resource">
|
14
|
+
<%= link_to route.verb + " " + route.path, route_path(:id => generate_name(route.verb, route.path)) %>
|
15
|
+
</td>
|
16
|
+
<td>
|
17
|
+
<% if file_exists?(route.verb, route.path) %>
|
18
|
+
<%= route.description %>
|
19
|
+
<%= link_to 'Update', edit_route_path(generate_name(route.verb, route.path))%>
|
20
|
+
<% else %>
|
21
|
+
<%= link_to 'Create a description', edit_route_path(generate_name(route.verb, route.path))%>
|
22
|
+
<% end %>
|
23
|
+
</td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
28
|
+
<% end %>
|
@@ -0,0 +1,100 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<title>Routes</title>
|
6
|
+
<style>
|
7
|
+
body { background-color: #fff; color: #333; margin: 0px; }
|
8
|
+
|
9
|
+
body, p, ol, ul, td {
|
10
|
+
font-family: helvetica, verdana, arial, sans-serif;
|
11
|
+
font-size: 13px;
|
12
|
+
line-height: 18px;
|
13
|
+
}
|
14
|
+
#container {
|
15
|
+
width: 960px;
|
16
|
+
margin: 0 auto;
|
17
|
+
padding-top: 50px;
|
18
|
+
}
|
19
|
+
#header-outer {
|
20
|
+
position: fixed;
|
21
|
+
width: 100%;
|
22
|
+
top: 0;
|
23
|
+
height: 40px;
|
24
|
+
z-index: 999;
|
25
|
+
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.25),0 -1px 0 rgba(0,0,0,0.1) inset;
|
26
|
+
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25),0 -1px 0 rgba(0, 0, 0, 0.1) inset;
|
27
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25),0 -1px 0 rgba(0, 0, 0, 0.1) inset;
|
28
|
+
background: #00A0D1 repeat-x 0 0;
|
29
|
+
}
|
30
|
+
#header {
|
31
|
+
width: 960px;
|
32
|
+
margin: 0 auto;
|
33
|
+
}
|
34
|
+
#logo {
|
35
|
+
float: left;
|
36
|
+
padding-left: 32px;
|
37
|
+
display: block;
|
38
|
+
height: 40px;
|
39
|
+
color: white;
|
40
|
+
font-size: 150%;
|
41
|
+
font-weight: 200;
|
42
|
+
line-height: 38px;
|
43
|
+
}
|
44
|
+
h1 {
|
45
|
+
font-size: 3em;
|
46
|
+
font-weight: 300;
|
47
|
+
line-height: 1.1;
|
48
|
+
margin-bottom: 0.75em;
|
49
|
+
}
|
50
|
+
table {
|
51
|
+
margin: 0 0 3em 0;
|
52
|
+
width: 100%;
|
53
|
+
}
|
54
|
+
tr:hover td, tr:hover td.active {
|
55
|
+
background: #F8F8F8;
|
56
|
+
}
|
57
|
+
td {
|
58
|
+
padding: 8px 0 8px 0;
|
59
|
+
vertical-align: top;
|
60
|
+
background: white;
|
61
|
+
}
|
62
|
+
th {
|
63
|
+
text-align: left;
|
64
|
+
border-bottom: 1px solid #EEE;
|
65
|
+
}
|
66
|
+
td.resource {
|
67
|
+
width: 320px;
|
68
|
+
}
|
69
|
+
pre {
|
70
|
+
background-color: #eee;
|
71
|
+
padding: 10px;
|
72
|
+
font-size: 11px;
|
73
|
+
white-space: pre-wrap;
|
74
|
+
}
|
75
|
+
|
76
|
+
a {
|
77
|
+
text-decoration: none;
|
78
|
+
color: #0080A6; }
|
79
|
+
a:visited { color: #0080A6; }
|
80
|
+
a:hover {
|
81
|
+
text-decoration: underline;
|
82
|
+
color: #0080A6;
|
83
|
+
}
|
84
|
+
a.logo{
|
85
|
+
color: white;
|
86
|
+
text-decoration: none;
|
87
|
+
}
|
88
|
+
</style>
|
89
|
+
</head>
|
90
|
+
<body>
|
91
|
+
<div id="header-outer">
|
92
|
+
<div id="header">
|
93
|
+
<div id="logo"><%= link_to "Docushin", routes_path, :class => "logo" %></div>
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
<div id="container">
|
97
|
+
<%= yield %>
|
98
|
+
</div>
|
99
|
+
</body>
|
100
|
+
</html>
|
data/config/routes.rb
ADDED
data/docushin.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/docushin/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Todor Grudev", "Alex Ganov"]
|
6
|
+
gem.email = ["tagrudev@gmail.com", "aganov@gmail.com"]
|
7
|
+
gem.description = %q{Builds documentation based on your Ruby on Rails application routes.}
|
8
|
+
gem.summary = %q{Useful for generating docs on your routes.}
|
9
|
+
gem.homepage = "http://github.com/appsbakery/docushin"
|
10
|
+
|
11
|
+
|
12
|
+
gem.files = `git ls-files`.split($\)
|
13
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
14
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
15
|
+
gem.name = "docushin"
|
16
|
+
gem.require_paths = ["lib", "app", "config"]
|
17
|
+
gem.version = Docushin::VERSION
|
18
|
+
|
19
|
+
gem.add_development_dependency "rails"
|
20
|
+
gem.add_development_dependency "pry"
|
21
|
+
gem.add_development_dependency "rake"
|
22
|
+
gem.add_development_dependency "rspec", "~> 2.0"
|
23
|
+
end
|
data/lib/docushin.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
|
3
|
+
module Docushin
|
4
|
+
class Route
|
5
|
+
|
6
|
+
extend ActiveModel::Naming
|
7
|
+
include ActiveModel::Conversion
|
8
|
+
|
9
|
+
attr_accessor :name
|
10
|
+
attr_accessor :verb
|
11
|
+
attr_accessor :path
|
12
|
+
attr_accessor :controller
|
13
|
+
attr_accessor :requirements
|
14
|
+
attr_accessor :base
|
15
|
+
attr_accessor :data
|
16
|
+
attr_accessor :file_name
|
17
|
+
attr_accessor :content
|
18
|
+
attr_accessor :description
|
19
|
+
|
20
|
+
def initialize(route)
|
21
|
+
@controller = route.defaults[:controller]
|
22
|
+
@base = File.join(Rails.root, 'doc', 'docushin')
|
23
|
+
@name = route.name
|
24
|
+
@verb = route.verb.source.empty? ? "MATCH" : route.verb.source.gsub(/[$^]/, '')
|
25
|
+
@path = route.path.spec.to_s.sub('(.:format)', '')
|
26
|
+
@requirements = route.requirements
|
27
|
+
@file_name = Digest::MD5.hexdigest(@verb.to_s + @path)
|
28
|
+
rtfm(@base, @file_name) if File.exists?(File.join(@base, @file_name) + '.md')
|
29
|
+
end
|
30
|
+
|
31
|
+
def persisted?
|
32
|
+
true
|
33
|
+
end
|
34
|
+
|
35
|
+
alias :id :file_name
|
36
|
+
|
37
|
+
def rtfm(base, name)
|
38
|
+
@content = File.read(File.join(base, name) + '.md')
|
39
|
+
|
40
|
+
begin
|
41
|
+
if @content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
42
|
+
@content = $'
|
43
|
+
@data = YAML.load($1)
|
44
|
+
@description = @data['description']
|
45
|
+
end
|
46
|
+
rescue => e
|
47
|
+
# puts "Exception reading #{name}: #{e.message}"
|
48
|
+
end
|
49
|
+
@data ||= {}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Docushin
|
2
|
+
class RouteSet
|
3
|
+
attr_accessor :routes
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@routes = []
|
7
|
+
Rails.application.routes.routes.each do |route|
|
8
|
+
next if route.app.is_a?(ActionDispatch::Routing::Mapper::Constraints)
|
9
|
+
next if route.app.is_a?(Sprockets::Environment)
|
10
|
+
next if route.app == Docushin::Engine
|
11
|
+
|
12
|
+
if (rack_app = discover_rack_app(route.app)) && rack_app.respond_to?(:routes)
|
13
|
+
rack_app.routes.routes.each do |rack_route|
|
14
|
+
@routes << Route.new(rack_route)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
@routes << Route.new(route)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def discover_rack_app(app)
|
22
|
+
class_name = app.class.name.to_s
|
23
|
+
if class_name == "ActionDispatch::Routing::Mapper::Constraints"
|
24
|
+
discover_rack_app(app.app)
|
25
|
+
elsif class_name !~ /^ActionDispatch::Routing/
|
26
|
+
app
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def find_by_filename_hash(hash)
|
31
|
+
@routes.each do |route|
|
32
|
+
return route if route.file_name == "#{hash}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Docushin::RouteSet do
|
4
|
+
describe 'Build route set from routes' do
|
5
|
+
let(:routes_collection) { Docushin::RouteSet.new }
|
6
|
+
it 'should have attr_accessor routes that is an array' do
|
7
|
+
routes_collection.routes.class.should == Array
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Docushin::Route do
|
4
|
+
let(:route_set) { Docushin::RouteSet.new }
|
5
|
+
let(:route) { route_set.routes.first }
|
6
|
+
|
7
|
+
describe 'create a new Route' do
|
8
|
+
it 'should have name, verb, path, requirements, data, content as attr' do
|
9
|
+
route.should respond_to(:name)
|
10
|
+
route.should respond_to(:verb)
|
11
|
+
route.should respond_to(:path)
|
12
|
+
route.should respond_to(:requirements)
|
13
|
+
route.should respond_to(:base)
|
14
|
+
route.should respond_to(:data)
|
15
|
+
route.should respond_to(:file_name)
|
16
|
+
route.should respond_to(:content)
|
17
|
+
route.should respond_to(:description)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'inspect the new Route' do
|
22
|
+
it 'should have attr defined' do
|
23
|
+
route.base.should == File.join(Rails.root, 'doc', 'docushin')
|
24
|
+
route.file_name.should == Digest::MD5.hexdigest(route.verb.to_s + route.path)
|
25
|
+
route.name.should == "foo_index"
|
26
|
+
route.path.should == "/foo"
|
27
|
+
route.requirements.should == {:action=>"index", :controller=>"foo"}
|
28
|
+
route.verb.should == "GET"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'read markdown file' do
|
33
|
+
it 'should generate data and content' do
|
34
|
+
route.data.should == {"description"=>"I am so awesome"}
|
35
|
+
route.description.should == "I am so awesome"
|
36
|
+
route.content.should == "{\"id\":\"4f3a296ac8de6732fe000003\",\"first_name\":\"Todor\",\"last_name\":\"Grudev\",\"username\":null,\"bio\":null,\"gender\":\"male\",\"email\":\"tagrudev@gmail.com\"}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
# Pick the frameworks you want:
|
4
|
+
# require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
# require "action_mailer/railtie"
|
7
|
+
# require "active_resource/railtie"
|
8
|
+
require "sprockets/railtie"
|
9
|
+
# require "rails/test_unit/railtie"
|
10
|
+
|
11
|
+
Bundler.require
|
12
|
+
require "docushin"
|
13
|
+
|
14
|
+
module Dummy
|
15
|
+
class Application < Rails::Application
|
16
|
+
# Settings in config/environments/* take precedence over those specified here.
|
17
|
+
# Application configuration should go into files in config/initializers
|
18
|
+
# -- all .rb files in that directory are automatically loaded.
|
19
|
+
|
20
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
21
|
+
config.autoload_paths += %W(#{Docushin::Engine.root})
|
22
|
+
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
24
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
25
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
26
|
+
|
27
|
+
# Activate observers that should always be running.
|
28
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
29
|
+
|
30
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
31
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
32
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
33
|
+
|
34
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
35
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
36
|
+
# config.i18n.default_locale = :de
|
37
|
+
|
38
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
39
|
+
config.encoding = "utf-8"
|
40
|
+
|
41
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
42
|
+
# config.filter_parameters += [:password]
|
43
|
+
|
44
|
+
# Enable escaping HTML in JSON.
|
45
|
+
# config.active_support.escape_html_entities_in_json = true
|
46
|
+
|
47
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
48
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
49
|
+
# like if you have constraints or database-specific column types
|
50
|
+
# config.active_record.schema_format = :sql
|
51
|
+
|
52
|
+
# Enforce whitelist mode for mass assignment.
|
53
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
54
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
55
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
56
|
+
# config.active_record.whitelist_attributes = true
|
57
|
+
|
58
|
+
# Enable the asset pipeline
|
59
|
+
config.assets.enabled = true
|
60
|
+
|
61
|
+
# Version of your assets, change this if you want to expire all your assets
|
62
|
+
config.assets.version = '1.0'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Configure static asset server for tests with Cache-Control for performance
|
11
|
+
config.serve_static_assets = true
|
12
|
+
config.static_cache_control = "public, max-age=3600"
|
13
|
+
|
14
|
+
# Log error messages when you accidentally call methods on nil
|
15
|
+
config.whiny_nils = true
|
16
|
+
|
17
|
+
# Show full error reports and disable caching
|
18
|
+
config.consider_all_requests_local = true
|
19
|
+
config.action_controller.perform_caching = false
|
20
|
+
|
21
|
+
# Raise exceptions instead of rendering exception templates
|
22
|
+
config.action_dispatch.show_exceptions = false
|
23
|
+
|
24
|
+
# Disable request forgery protection in test environment
|
25
|
+
config.action_controller.allow_forgery_protection = false
|
26
|
+
|
27
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
28
|
+
# The :test delivery method accumulates sent emails in the
|
29
|
+
# ActionMailer::Base.deliveries array.
|
30
|
+
# config.action_mailer.delivery_method = :test
|
31
|
+
|
32
|
+
# Raise exception on mass assignment protection for Active Record models
|
33
|
+
# config.active_record.mass_assignment_sanitizer = :strict
|
34
|
+
|
35
|
+
# Print deprecation notices to the stderr
|
36
|
+
config.active_support.deprecation = :stderr
|
37
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# These inflection rules are supported but not enabled by default:
|
13
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
14
|
+
# inflect.acronym 'RESTful'
|
15
|
+
# end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
Dummy::Application.config.secret_token = 'c3e92401d481baad490a74a84260ec9dbb402bf7a19c9b82fda1dbe45d28f1fcf42b42afafcc768b7c08366c14923567901976b1011e51cbdfde863a4bf66f7a'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# Dummy::Application.config.session_store :active_record_store
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters :format => [:json]
|
9
|
+
end
|
10
|
+
|
11
|
+
# Disable root element in JSON by default.
|
12
|
+
ActiveSupport.on_load(:active_record) do
|
13
|
+
self.include_root_in_json = false
|
14
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
|
4
|
+
ENV["RAILS_ENV"] ||= 'test'
|
5
|
+
require File.expand_path("../../spec/dummy/config/environment", __FILE__)
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'bundler/setup'
|
9
|
+
require 'docushin'
|
10
|
+
require 'pry'
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.before(:each) do
|
14
|
+
# Do nothing
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: docushin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Todor Grudev
|
9
|
+
- Alex Ganov
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-11-16 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rails
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: pry
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rspec
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '2.0'
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '2.0'
|
79
|
+
description: Builds documentation based on your Ruby on Rails application routes.
|
80
|
+
email:
|
81
|
+
- tagrudev@gmail.com
|
82
|
+
- aganov@gmail.com
|
83
|
+
executables: []
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files: []
|
86
|
+
files:
|
87
|
+
- .gitignore
|
88
|
+
- .rspec
|
89
|
+
- Gemfile
|
90
|
+
- LICENSE
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- app/controllers/docushin/routes_controller.rb
|
94
|
+
- app/helpers/docushin/application_helper.rb
|
95
|
+
- app/views/docushin/routes/_form.html.erb
|
96
|
+
- app/views/docushin/routes/edit.html.erb
|
97
|
+
- app/views/docushin/routes/index.html.erb
|
98
|
+
- app/views/docushin/routes/show.html.erb
|
99
|
+
- app/views/layouts/docushin.html.erb
|
100
|
+
- config/routes.rb
|
101
|
+
- docushin.gemspec
|
102
|
+
- lib/docushin.rb
|
103
|
+
- lib/docushin/engine.rb
|
104
|
+
- lib/docushin/route.rb
|
105
|
+
- lib/docushin/route_set.rb
|
106
|
+
- lib/docushin/version.rb
|
107
|
+
- spec/docushin/route_set_spec.rb
|
108
|
+
- spec/docushin/route_spec.rb
|
109
|
+
- spec/docushin_spec.rb
|
110
|
+
- spec/dummy/Rakefile
|
111
|
+
- spec/dummy/app/controllers/application_controller.rb
|
112
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
113
|
+
- spec/dummy/config.ru
|
114
|
+
- spec/dummy/config/application.rb
|
115
|
+
- spec/dummy/config/boot.rb
|
116
|
+
- spec/dummy/config/environment.rb
|
117
|
+
- spec/dummy/config/environments/test.rb
|
118
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
119
|
+
- spec/dummy/config/initializers/inflections.rb
|
120
|
+
- spec/dummy/config/initializers/mime_types.rb
|
121
|
+
- spec/dummy/config/initializers/secret_token.rb
|
122
|
+
- spec/dummy/config/initializers/session_store.rb
|
123
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
124
|
+
- spec/dummy/config/routes.rb
|
125
|
+
- spec/dummy/log/development.log
|
126
|
+
- spec/dummy/log/test.log
|
127
|
+
- spec/dummy/script/rails
|
128
|
+
- spec/spec_helper.rb
|
129
|
+
homepage: http://github.com/appsbakery/docushin
|
130
|
+
licenses: []
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
- app
|
136
|
+
- config
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
segments:
|
144
|
+
- 0
|
145
|
+
hash: 363757421
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
148
|
+
requirements:
|
149
|
+
- - ! '>='
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
segments:
|
153
|
+
- 0
|
154
|
+
hash: 363757421
|
155
|
+
requirements: []
|
156
|
+
rubyforge_project:
|
157
|
+
rubygems_version: 1.8.24
|
158
|
+
signing_key:
|
159
|
+
specification_version: 3
|
160
|
+
summary: Useful for generating docs on your routes.
|
161
|
+
test_files:
|
162
|
+
- spec/docushin/route_set_spec.rb
|
163
|
+
- spec/docushin/route_spec.rb
|
164
|
+
- spec/docushin_spec.rb
|
165
|
+
- spec/dummy/Rakefile
|
166
|
+
- spec/dummy/app/controllers/application_controller.rb
|
167
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
168
|
+
- spec/dummy/config.ru
|
169
|
+
- spec/dummy/config/application.rb
|
170
|
+
- spec/dummy/config/boot.rb
|
171
|
+
- spec/dummy/config/environment.rb
|
172
|
+
- spec/dummy/config/environments/test.rb
|
173
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
174
|
+
- spec/dummy/config/initializers/inflections.rb
|
175
|
+
- spec/dummy/config/initializers/mime_types.rb
|
176
|
+
- spec/dummy/config/initializers/secret_token.rb
|
177
|
+
- spec/dummy/config/initializers/session_store.rb
|
178
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
179
|
+
- spec/dummy/config/routes.rb
|
180
|
+
- spec/dummy/log/development.log
|
181
|
+
- spec/dummy/log/test.log
|
182
|
+
- spec/dummy/script/rails
|
183
|
+
- spec/spec_helper.rb
|