mount_doc 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/.gitignore +18 -0
  2. data/Gemfile +16 -0
  3. data/Guardfile +33 -0
  4. data/LICENSE +22 -0
  5. data/README.md +49 -0
  6. data/Rakefile +2 -0
  7. data/app/assets/stylesheets/mount_doc.css.scss +148 -0
  8. data/app/controllers/mount_doc/application_controller.rb +6 -0
  9. data/app/controllers/mount_doc/mount_doc_controller.rb +77 -0
  10. data/app/helpers/mount_doc/mount_doc_helper.rb +104 -0
  11. data/app/views/layouts/mount_doc.slim +55 -0
  12. data/app/views/mount_doc/mount_doc/action_doc.slim +57 -0
  13. data/app/views/mount_doc/mount_doc/controller_doc.slim +14 -0
  14. data/app/views/mount_doc/mount_doc/index.slim +1 -0
  15. data/app/views/mount_doc/mount_doc/not_found.slim +3 -0
  16. data/config/routes.rb +7 -0
  17. data/lib/mount_doc.rb +11 -0
  18. data/lib/mount_doc/config.rb +74 -0
  19. data/lib/mount_doc/document.rb +38 -0
  20. data/lib/mount_doc/rails.rb +6 -0
  21. data/lib/mount_doc/rails/engine.rb +10 -0
  22. data/lib/mount_doc/rails/generators.rb +5 -0
  23. data/lib/mount_doc/rails/generators/initialize_generator.rb +5 -0
  24. data/lib/mount_doc/rails/route_set.rb +19 -0
  25. data/lib/mount_doc/string_patch.rb +1 -0
  26. data/lib/mount_doc/version.rb +3 -0
  27. data/mount_doc.gemspec +23 -0
  28. data/spec/lib/mount_doc/config_spec.rb +73 -0
  29. data/spec/lib/mount_doc/document_spec.rb +17 -0
  30. data/spec/lib/mount_doc/rails/engine_spec.rb +7 -0
  31. data/spec/lib/mount_doc/rails/route_set_spec.rb +16 -0
  32. data/spec/lib/mount_doc/rails_spec.rb +16 -0
  33. data/spec/mock/rails_3.2.3/.gitignore +15 -0
  34. data/spec/mock/rails_3.2.3/Gemfile +40 -0
  35. data/spec/mock/rails_3.2.3/README.rdoc +261 -0
  36. data/spec/mock/rails_3.2.3/Rakefile +7 -0
  37. data/spec/mock/rails_3.2.3/app/assets/images/rails.png +0 -0
  38. data/spec/mock/rails_3.2.3/app/assets/javascripts/api/documents.js.coffee +3 -0
  39. data/spec/mock/rails_3.2.3/app/assets/javascripts/application.js +15 -0
  40. data/spec/mock/rails_3.2.3/app/assets/javascripts/users.js.coffee +3 -0
  41. data/spec/mock/rails_3.2.3/app/assets/stylesheets/api/documents.css.scss +3 -0
  42. data/spec/mock/rails_3.2.3/app/assets/stylesheets/application.css +13 -0
  43. data/spec/mock/rails_3.2.3/app/assets/stylesheets/scaffolds.css.scss +56 -0
  44. data/spec/mock/rails_3.2.3/app/assets/stylesheets/users.css.scss +3 -0
  45. data/spec/mock/rails_3.2.3/app/controllers/api/documents_controller.rb +121 -0
  46. data/spec/mock/rails_3.2.3/app/controllers/application_controller.rb +3 -0
  47. data/spec/mock/rails_3.2.3/app/controllers/users_controller.rb +83 -0
  48. data/spec/mock/rails_3.2.3/app/helpers/api/documents_helper.rb +2 -0
  49. data/spec/mock/rails_3.2.3/app/helpers/application_helper.rb +2 -0
  50. data/spec/mock/rails_3.2.3/app/helpers/users_helper.rb +2 -0
  51. data/spec/mock/rails_3.2.3/app/mailers/.gitkeep +0 -0
  52. data/spec/mock/rails_3.2.3/app/models/.gitkeep +0 -0
  53. data/spec/mock/rails_3.2.3/app/models/api.rb +5 -0
  54. data/spec/mock/rails_3.2.3/app/models/api/document.rb +3 -0
  55. data/spec/mock/rails_3.2.3/app/models/user.rb +3 -0
  56. data/spec/mock/rails_3.2.3/app/views/api/documents/_form.html.erb +17 -0
  57. data/spec/mock/rails_3.2.3/app/views/api/documents/edit.html.erb +6 -0
  58. data/spec/mock/rails_3.2.3/app/views/api/documents/index.html.erb +21 -0
  59. data/spec/mock/rails_3.2.3/app/views/api/documents/new.html.erb +5 -0
  60. data/spec/mock/rails_3.2.3/app/views/api/documents/show.html.erb +5 -0
  61. data/spec/mock/rails_3.2.3/app/views/layouts/application.html.erb +14 -0
  62. data/spec/mock/rails_3.2.3/app/views/users/_form.html.erb +17 -0
  63. data/spec/mock/rails_3.2.3/app/views/users/edit.html.erb +6 -0
  64. data/spec/mock/rails_3.2.3/app/views/users/index.html.erb +21 -0
  65. data/spec/mock/rails_3.2.3/app/views/users/new.html.erb +5 -0
  66. data/spec/mock/rails_3.2.3/app/views/users/show.html.erb +5 -0
  67. data/spec/mock/rails_3.2.3/config.ru +4 -0
  68. data/spec/mock/rails_3.2.3/config/application.rb +65 -0
  69. data/spec/mock/rails_3.2.3/config/boot.rb +6 -0
  70. data/spec/mock/rails_3.2.3/config/database.yml +25 -0
  71. data/spec/mock/rails_3.2.3/config/environment.rb +5 -0
  72. data/spec/mock/rails_3.2.3/config/environments/development.rb +38 -0
  73. data/spec/mock/rails_3.2.3/config/environments/production.rb +67 -0
  74. data/spec/mock/rails_3.2.3/config/environments/test.rb +37 -0
  75. data/spec/mock/rails_3.2.3/config/initializers/backtrace_silencers.rb +7 -0
  76. data/spec/mock/rails_3.2.3/config/initializers/inflections.rb +15 -0
  77. data/spec/mock/rails_3.2.3/config/initializers/mime_types.rb +5 -0
  78. data/spec/mock/rails_3.2.3/config/initializers/secret_token.rb +7 -0
  79. data/spec/mock/rails_3.2.3/config/initializers/session_store.rb +8 -0
  80. data/spec/mock/rails_3.2.3/config/initializers/wrap_parameters.rb +14 -0
  81. data/spec/mock/rails_3.2.3/config/locales/en.yml +5 -0
  82. data/spec/mock/rails_3.2.3/config/routes.rb +63 -0
  83. data/spec/mock/rails_3.2.3/db/migrate/20120423193431_create_users.rb +8 -0
  84. data/spec/mock/rails_3.2.3/db/migrate/20120426181820_create_api_documents.rb +8 -0
  85. data/spec/mock/rails_3.2.3/db/schema.rb +21 -0
  86. data/spec/mock/rails_3.2.3/db/seeds.rb +7 -0
  87. data/spec/mock/rails_3.2.3/doc/README_FOR_APP +2 -0
  88. data/spec/mock/rails_3.2.3/doc//343/201/206/343/202/223/343/201/223/343/201/227/343/201/237/343/201/204.rdoc +3 -0
  89. data/spec/mock/rails_3.2.3/lib/assets/.gitkeep +0 -0
  90. data/spec/mock/rails_3.2.3/lib/tasks/.gitkeep +0 -0
  91. data/spec/mock/rails_3.2.3/log/.gitkeep +0 -0
  92. data/spec/mock/rails_3.2.3/public/404.html +26 -0
  93. data/spec/mock/rails_3.2.3/public/422.html +26 -0
  94. data/spec/mock/rails_3.2.3/public/500.html +25 -0
  95. data/spec/mock/rails_3.2.3/public/favicon.ico +0 -0
  96. data/spec/mock/rails_3.2.3/public/index.html +241 -0
  97. data/spec/mock/rails_3.2.3/public/robots.txt +5 -0
  98. data/spec/mock/rails_3.2.3/script/rails +6 -0
  99. data/spec/mock/rails_3.2.3/vendor/assets/javascripts/.gitkeep +0 -0
  100. data/spec/mock/rails_3.2.3/vendor/assets/stylesheets/.gitkeep +0 -0
  101. data/spec/mock/rails_3.2.3/vendor/plugins/.gitkeep +0 -0
  102. data/spec/requests/mount_doc_request_spec.rb +34 -0
  103. data/spec/requests/users_request_spec.rb +10 -0
  104. data/spec/spec_helper.rb +34 -0
  105. metadata +313 -0
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the users controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,121 @@
1
+ # Document Test
2
+ class Api::DocumentsController < ApplicationController
3
+ # ちゃんとドキュメントを書いて反映されるかのテスト
4
+ #
5
+ # 書式はRdocだよー
6
+ #
7
+ # @version 1.0
8
+ # @param [optional,int] test パラメータのテスト
9
+ # @param [Hash] hash オプション値のテスト
10
+ # @option hash [String] :title タイトル
11
+ # @option hash [int] :num 数字
12
+ # @todo メモ書き
13
+ # なんかいろいろ書式ためしとかないとまずいなー
14
+ # @response XML
15
+ # <xml>
16
+ # <document>
17
+ # <title>Sample Document</title>
18
+ # <content> ... </content>
19
+ # <views>256</views>
20
+ # </document>
21
+ # </xml>
22
+ # @response json
23
+ # {
24
+ # "document": {
25
+ # "title": "Sample Document",
26
+ # "content": " ... ",
27
+ # "views": 256
28
+ # }
29
+ # }
30
+ # @deprecated こいつは今後一切メンテする気がない!
31
+ #
32
+ # @overload /api/documents.json
33
+ # テスト!!!
34
+ # @param [int] test これは!
35
+ # @overload /api/documents.html
36
+ def index
37
+ @api_documents = Api::Document.all
38
+
39
+ respond_to do |format|
40
+ format.html # index.html.erb
41
+ format.json { render json: @api_documents }
42
+ end
43
+ end
44
+
45
+ # GET /api/documents/1
46
+ # GET /api/documents/1.json
47
+ def show
48
+ @api_document = Api::Document.find(params[:id])
49
+
50
+ respond_to do |format|
51
+ format.html # show.html.erb
52
+ format.json { render json: @api_document }
53
+ end
54
+ end
55
+
56
+ # GET /api/documents/new
57
+ # GET /api/documents/new.json
58
+ def new
59
+ @api_document = Api::Document.new
60
+
61
+ respond_to do |format|
62
+ format.html # new.html.erb
63
+ format.json { render json: @api_document }
64
+ end
65
+ end
66
+
67
+ # GET /api/documents/1/edit
68
+ def edit
69
+ @api_document = Api::Document.find(params[:id])
70
+ end
71
+
72
+ # 新しいドキュメントを生成します。
73
+ #
74
+ # @param [Hash] doc ドキュメントオブジェクト
75
+ # @option doc [String] title ドキュメントのタイトル
76
+ # @option doc [String] body ドキュメントの本文
77
+ #
78
+ # @response 生成に成功した時
79
+ # {"status": "ok", "doc_id": 12}
80
+ def create
81
+ @api_document = Api::Document.new(params[:api_document])
82
+
83
+ respond_to do |format|
84
+ if @api_document.save
85
+ format.html { redirect_to @api_document, notice: 'Document was successfully created.' }
86
+ format.json { render json: @api_document, status: :created, location: @api_document }
87
+ else
88
+ format.html { render action: "new" }
89
+ format.json { render json: @api_document.errors, status: :unprocessable_entity }
90
+ end
91
+ end
92
+ end
93
+
94
+ # PUT /api/documents/1
95
+ # PUT /api/documents/1.json
96
+ def update
97
+ @api_document = Api::Document.find(params[:id])
98
+
99
+ respond_to do |format|
100
+ if @api_document.update_attributes(params[:api_document])
101
+ format.html { redirect_to @api_document, notice: 'Document was successfully updated.' }
102
+ format.json { head :no_content }
103
+ else
104
+ format.html { render action: "edit" }
105
+ format.json { render json: @api_document.errors, status: :unprocessable_entity }
106
+ end
107
+ end
108
+ end
109
+
110
+ # DELETE /api/documents/1
111
+ # DELETE /api/documents/1.json
112
+ def destroy
113
+ @api_document = Api::Document.find(params[:id])
114
+ @api_document.destroy
115
+
116
+ respond_to do |format|
117
+ format.html { redirect_to api_documents_url }
118
+ format.json { head :no_content }
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,83 @@
1
+ class UsersController < ApplicationController
2
+ # GET /users
3
+ # GET /users.json
4
+ def index
5
+ @users = User.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @users }
10
+ end
11
+ end
12
+
13
+ # GET /users/1
14
+ # GET /users/1.json
15
+ def show
16
+ @user = User.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @user }
21
+ end
22
+ end
23
+
24
+ # GET /users/new
25
+ # GET /users/new.json
26
+ def new
27
+ @user = User.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.json { render json: @user }
32
+ end
33
+ end
34
+
35
+ # GET /users/1/edit
36
+ def edit
37
+ @user = User.find(params[:id])
38
+ end
39
+
40
+ # POST /users
41
+ # POST /users.json
42
+ def create
43
+ @user = User.new(params[:user])
44
+
45
+ respond_to do |format|
46
+ if @user.save
47
+ format.html { redirect_to @user, notice: 'User was successfully created.' }
48
+ format.json { render json: @user, status: :created, location: @user }
49
+ else
50
+ format.html { render action: "new" }
51
+ format.json { render json: @user.errors, status: :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /users/1
57
+ # PUT /users/1.json
58
+ def update
59
+ @user = User.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @user.update_attributes(params[:user])
63
+ format.html { redirect_to @user, notice: 'User was successfully updated.' }
64
+ format.json { head :no_content }
65
+ else
66
+ format.html { render action: "edit" }
67
+ format.json { render json: @user.errors, status: :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /users/1
73
+ # DELETE /users/1.json
74
+ def destroy
75
+ @user = User.find(params[:id])
76
+ @user.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to users_url }
80
+ format.json { head :no_content }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,2 @@
1
+ module Api::DocumentsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module UsersHelper
2
+ end
@@ -0,0 +1,5 @@
1
+ module Api
2
+ def self.table_name_prefix
3
+ 'api_'
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ class Api::Document < ActiveRecord::Base
2
+ # attr_accessible :title, :body
3
+ end
@@ -0,0 +1,3 @@
1
+ class User < ActiveRecord::Base
2
+ # attr_accessible :title, :body
3
+ end
@@ -0,0 +1,17 @@
1
+ <%= form_for(@api_document) do |f| %>
2
+ <% if @api_document.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@api_document.errors.count, "error") %> prohibited this api_document from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @api_document.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="actions">
15
+ <%= f.submit %>
16
+ </div>
17
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing api_document</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @api_document %> |
6
+ <%= link_to 'Back', api_documents_path %>
@@ -0,0 +1,21 @@
1
+ <h1>Listing api_documents</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th></th>
6
+ <th></th>
7
+ <th></th>
8
+ </tr>
9
+
10
+ <% @api_documents.each do |api_document| %>
11
+ <tr>
12
+ <td><%= link_to 'Show', api_document %></td>
13
+ <td><%= link_to 'Edit', edit_api_document_path(api_document) %></td>
14
+ <td><%= link_to 'Destroy', api_document, confirm: 'Are you sure?', method: :delete %></td>
15
+ </tr>
16
+ <% end %>
17
+ </table>
18
+
19
+ <br />
20
+
21
+ <%= link_to 'New Document', new_api_document_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New api_document</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', api_documents_path %>
@@ -0,0 +1,5 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+
4
+ <%= link_to 'Edit', edit_api_document_path(@api_document) %> |
5
+ <%= link_to 'Back', api_documents_path %>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Rails323</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,17 @@
1
+ <%= form_for(@user) do |f| %>
2
+ <% if @user.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @user.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="actions">
15
+ <%= f.submit %>
16
+ </div>
17
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @user %> |
6
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,21 @@
1
+ <h1>Listing users</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th></th>
6
+ <th></th>
7
+ <th></th>
8
+ </tr>
9
+
10
+ <% @users.each do |user| %>
11
+ <tr>
12
+ <td><%= link_to 'Show', user %></td>
13
+ <td><%= link_to 'Edit', edit_user_path(user) %></td>
14
+ <td><%= link_to 'Destroy', user, confirm: 'Are you sure?', method: :delete %></td>
15
+ </tr>
16
+ <% end %>
17
+ </table>
18
+
19
+ <br />
20
+
21
+ <%= link_to 'New User', new_user_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,5 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+
4
+ <%= link_to 'Edit', edit_user_path(@user) %> |
5
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails323::Application
@@ -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
+ if defined?(Bundler)
12
+ # If you precompile assets before deploying to production, use this line
13
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
14
+ # If you want your assets lazily compiled in production, use this line
15
+ # Bundler.require(:default, :assets, Rails.env)
16
+ end
17
+
18
+ module Rails323
19
+ class Application < Rails::Application
20
+ # Settings in config/environments/* take precedence over those specified here.
21
+ # Application configuration should go into files in config/initializers
22
+ # -- all .rb files in that directory are automatically loaded.
23
+
24
+ # Custom directories with classes and modules you want to be autoloadable.
25
+ # config.autoload_paths += %W(#{config.root}/extras)
26
+
27
+ # Only load the plugins named here, in the order given (default is alphabetical).
28
+ # :all can be used as a placeholder for all plugins not explicitly named.
29
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
30
+
31
+ # Activate observers that should always be running.
32
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
33
+
34
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
35
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
36
+ # config.time_zone = 'Central Time (US & Canada)'
37
+
38
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
39
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
40
+ # config.i18n.default_locale = :de
41
+
42
+ # Configure the default encoding used in templates for Ruby 1.9.
43
+ config.encoding = "utf-8"
44
+
45
+ # Configure sensitive parameters which will be filtered from the log file.
46
+ config.filter_parameters += [:password]
47
+
48
+ # Use SQL instead of Active Record's schema dumper when creating the database.
49
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
50
+ # like if you have constraints or database-specific column types
51
+ # config.active_record.schema_format = :sql
52
+
53
+ # Enforce whitelist mode for mass assignment.
54
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
55
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
56
+ # parameters by using an attr_accessible or attr_protected declaration.
57
+ config.active_record.whitelist_attributes = true
58
+
59
+ # Enable the asset pipeline
60
+ config.assets.enabled = true
61
+
62
+ # Version of your assets, change this if you want to expire all your assets
63
+ config.assets.version = '1.0'
64
+ end
65
+ end