docthis 0.0.1

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.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +132 -0
  3. data/Rakefile +23 -0
  4. data/app/assets/javascripts/docthis/application.js +2 -0
  5. data/app/assets/javascripts/docthis/bootstrap.min.js +6 -0
  6. data/app/assets/javascripts/docthis/jquery-2.1.1.min.js +4 -0
  7. data/app/assets/stylesheets/docthis/application.css +3 -0
  8. data/app/assets/stylesheets/docthis/themes/amelia.min.css +7 -0
  9. data/app/assets/stylesheets/docthis/themes/cerulean.min.css +7 -0
  10. data/app/assets/stylesheets/docthis/themes/cosmo.min.css +7 -0
  11. data/app/assets/stylesheets/docthis/themes/cyborg.min.css +7 -0
  12. data/app/assets/stylesheets/docthis/themes/darkly.min.css +7 -0
  13. data/app/assets/stylesheets/docthis/themes/flatly.min.css +7 -0
  14. data/app/assets/stylesheets/docthis/themes/journal.min.css +7 -0
  15. data/app/assets/stylesheets/docthis/themes/lumen.min.css +7 -0
  16. data/app/assets/stylesheets/docthis/themes/readable.min.css +7 -0
  17. data/app/assets/stylesheets/docthis/themes/simplex.min.css +7 -0
  18. data/app/assets/stylesheets/docthis/themes/slate.min.css +7 -0
  19. data/app/assets/stylesheets/docthis/themes/spacelab.min.css +7 -0
  20. data/app/assets/stylesheets/docthis/themes/superhero.min.css +7 -0
  21. data/app/assets/stylesheets/docthis/themes/united.min.css +7 -0
  22. data/app/assets/stylesheets/docthis/themes/yeti.min.css +7 -0
  23. data/app/controllers/docthis/application_controller.rb +4 -0
  24. data/app/controllers/docthis/documentation_controller.rb +19 -0
  25. data/app/helpers/docthis/application_helper.rb +4 -0
  26. data/app/models/docthis/page.rb +139 -0
  27. data/app/models/docthis/renderer.rb +15 -0
  28. data/app/views/docthis/documentation/show.html.erb +35 -0
  29. data/app/views/layouts/docthis/application.html.erb +44 -0
  30. data/config/routes.rb +3 -0
  31. data/lib/docthis.rb +55 -0
  32. data/lib/docthis/engine.rb +8 -0
  33. data/lib/docthis/version.rb +3 -0
  34. metadata +132 -0
@@ -0,0 +1,15 @@
1
+ # Customer Redcarpet rendered which uses pygments to decorate code blocks
2
+ class Docthis::Renderer < Redcarpet::Render::HTML
3
+
4
+ # Process block codes with pygments
5
+ #
6
+ # Params:
7
+ # * code: Code block to pygmentize.
8
+ # * language: Language of the code block to pygmentize.
9
+ #
10
+ # Returns:
11
+ # The pygmentized HTML for the given code and language.
12
+ def block_code(code, language)
13
+ Pygmentize.process(code, language)
14
+ end
15
+ end
@@ -0,0 +1,35 @@
1
+ <% content_for :actions do %>
2
+ <ul class="nav navbar-nav">
3
+ <li><%= link_to "Index", docthis.documentation_path %></li>
4
+ <% @pages.each do |parent| %>
5
+ <% if parent.has_children? %>
6
+ <li class="dropdown">
7
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
8
+ <%= parent.title %> <b class="caret"></b>
9
+ </a>
10
+
11
+ <ul class="dropdown-menu">
12
+ <li><%= link_to "Index", docthis.documentation_path(parent.id) %></li>
13
+ <li class="divider"></li>
14
+ <% parent.children.each do |child| %>
15
+ <li><%= link_to child.title, docthis.documentation_path(child.id) %></li>
16
+ <% end %>
17
+ </ul>
18
+ </li>
19
+ <% else %>
20
+ <li><%= link_to parent.title, docthis.documentation_path(parent.id) %></li>
21
+ <% end %>
22
+ <% end %>
23
+ </ul>
24
+ <% end %>
25
+
26
+ <div class="container">
27
+ <%= @page.body.html_safe %>
28
+
29
+ <% if @page.has_children? %>
30
+ <h3>See also:</h3>
31
+ <% @page.children.each do |child| %>
32
+ <%= link_to child.title, docthis.documentation_path(child.id) %>
33
+ <% end %>
34
+ <% end %>
35
+ </div>
@@ -0,0 +1,44 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>DocThis!</title>
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <%= csrf_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag "docthis/application" %>
9
+ <%= stylesheet_link_tag "docthis/themes/#{Docthis.theme}.min" %>
10
+
11
+ <!--[if lt IE 9]>
12
+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
13
+ <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
14
+ <![endif]-->
15
+ </head>
16
+ <body>
17
+
18
+ <nav class="navbar navbar-default navbar-static-top" role="navigation">
19
+ <div class="container">
20
+ <div class="navbar-header">
21
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-links">
22
+ <span class="sr-only">Activar navegación</span>
23
+ <span class="icon-bar"></span>
24
+ <span class="icon-bar"></span>
25
+ <span class="icon-bar"></span>
26
+ </button>
27
+
28
+ <%= link_to "DocThis!", docthis.documentation_path, class: "navbar-brand" %>
29
+ </div>
30
+
31
+ <div class="collapse navbar-collapse" id="navbar-links">
32
+ <%= yield :actions %>
33
+ </div>
34
+ </div>
35
+ </nav>
36
+
37
+ <div class="container main-content">
38
+ <%= yield %>
39
+ </div>
40
+
41
+ <%= javascript_include_tag "docthis/application" %>
42
+
43
+ </body>
44
+ </html>
@@ -0,0 +1,3 @@
1
+ Docthis::Engine.routes.draw do
2
+ get '/(*id)', to: "documentation#show", as: "documentation"
3
+ end
@@ -0,0 +1,55 @@
1
+ require "docthis/engine"
2
+
3
+ # Gem entry point and configuration facilities for the DocThis! gem
4
+ module Docthis
5
+
6
+ # Configures the DocThis! engine. You should pass a block receiving a
7
+ # configuration object. You can use that configuration object to configure
8
+ # the engine. For example:
9
+ #
10
+ # ```
11
+ # Docthis.configure do |config|
12
+ # config.theme = :darkly
13
+ # end
14
+ # ```
15
+ #
16
+ # You can set the following options on the configuration object:
17
+ #
18
+ # * use_basic_auth: True if you want to protect the engine using basic auth.
19
+ # Defaults to false.
20
+ #
21
+ # * basic_auth_username: Set to the username to validate against if using
22
+ # basic auth. Defaults to nil.
23
+ #
24
+ # * basic_auth_password: Set to the password to validate against if using
25
+ # basic auth. Defaults to nil.
26
+ #
27
+ # * docs_folder: Set to the relative path where the documentation files
28
+ # reside. Defaults to "docs".
29
+ #
30
+ # * theme: Set to the stylesheet to apply to DocThis! pages. Can be anything
31
+ # of the following bootswatch themes: amelia, cerulean, cosmo, cyborg,
32
+ # darkly, flatly, journal, lumen, readable, simplex, slate, spacelab,
33
+ # superhero, united, yeti. Defaults to simplex.
34
+ def self.configure
35
+ yield self
36
+ end
37
+
38
+ mattr_accessor :theme
39
+ def self.theme
40
+ @@theme ||= :simplex
41
+ end
42
+
43
+ mattr_accessor :docs_folder
44
+ def self.docs_folder
45
+ @@docs_folder ||= "docs"
46
+ end
47
+
48
+ mattr_accessor :use_basic_auth
49
+ def self.use_basic_auth
50
+ @@use_basic_auth.nil? ? false : @@use_basic_auth
51
+ end
52
+
53
+ mattr_accessor :basic_auth_username
54
+ mattr_accessor :basic_auth_password
55
+ end
@@ -0,0 +1,8 @@
1
+ require "redcarpet"
2
+ require "pygmentize"
3
+
4
+ module Docthis
5
+ class Engine < ::Rails::Engine
6
+ isolate_namespace Docthis
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module Docthis
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: docthis
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Andres Arana
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: pygmentize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: redcarpet
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sqlite3
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Rails engine which takes your markdown documentation stored in your application
70
+ repository and exposes that as a wiki-style, navigateable wiki.
71
+ email:
72
+ - andres.arana@recompensa.mobi
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - README.md
78
+ - Rakefile
79
+ - app/assets/javascripts/docthis/application.js
80
+ - app/assets/javascripts/docthis/bootstrap.min.js
81
+ - app/assets/javascripts/docthis/jquery-2.1.1.min.js
82
+ - app/assets/stylesheets/docthis/application.css
83
+ - app/assets/stylesheets/docthis/themes/amelia.min.css
84
+ - app/assets/stylesheets/docthis/themes/cerulean.min.css
85
+ - app/assets/stylesheets/docthis/themes/cosmo.min.css
86
+ - app/assets/stylesheets/docthis/themes/cyborg.min.css
87
+ - app/assets/stylesheets/docthis/themes/darkly.min.css
88
+ - app/assets/stylesheets/docthis/themes/flatly.min.css
89
+ - app/assets/stylesheets/docthis/themes/journal.min.css
90
+ - app/assets/stylesheets/docthis/themes/lumen.min.css
91
+ - app/assets/stylesheets/docthis/themes/readable.min.css
92
+ - app/assets/stylesheets/docthis/themes/simplex.min.css
93
+ - app/assets/stylesheets/docthis/themes/slate.min.css
94
+ - app/assets/stylesheets/docthis/themes/spacelab.min.css
95
+ - app/assets/stylesheets/docthis/themes/superhero.min.css
96
+ - app/assets/stylesheets/docthis/themes/united.min.css
97
+ - app/assets/stylesheets/docthis/themes/yeti.min.css
98
+ - app/controllers/docthis/application_controller.rb
99
+ - app/controllers/docthis/documentation_controller.rb
100
+ - app/helpers/docthis/application_helper.rb
101
+ - app/models/docthis/page.rb
102
+ - app/models/docthis/renderer.rb
103
+ - app/views/docthis/documentation/show.html.erb
104
+ - app/views/layouts/docthis/application.html.erb
105
+ - config/routes.rb
106
+ - lib/docthis.rb
107
+ - lib/docthis/engine.rb
108
+ - lib/docthis/version.rb
109
+ homepage: https://github.com/recompensa-mobi/docthis
110
+ licenses: []
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubyforge_project:
128
+ rubygems_version: 2.2.2
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: Rails engine to expose your markdown site documentation
132
+ test_files: []