Skip to content

Remove assets #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 24, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -32,11 +32,10 @@ See the `example` folder for a sample Rails app that has been documented.
## Configuration options
- app - Set the application that Rack::Test uses, defaults to `Rails.application`
- docs_dir - Output folder
- format - An array of output format(s). Possible values are :json, :html, or :wurl. The final option is similar to :html, but includes the wURL console.
- format - An array of output format(s). Possible values are :json, :html
- template_path - Location of templates
- filter - Filter by example document type
- exclusion_filter - Filter by example document type
- url_prefix - Add before all links on the index page, useful if docs are located in `public/docs`, must include a leading `/`, no trailing `/`; eg `/docs`
- curl_host - Used when adding a cURL output to the docs
- keep_source_order - By default examples and resources are ordered by description. Set to true keep the source order.
- api_name - Change the name of the API on index pages, default is "API Documentation"
@@ -50,7 +49,6 @@ RspecApiDocumentation.configure do |config|

config.define_group :public do |config|
config.docs_dir = Rails.root.join("public", "docs")
config.url_prefix = "/docs"
end
end
```
2 changes: 1 addition & 1 deletion example/Gemfile
Original file line number Diff line number Diff line change
@@ -22,5 +22,5 @@ end
group :test, :development do
gem 'rspec-rails'
gem 'rspec_api_documentation', :path => "../"
gem 'raddocs', '0.1.0'
gem 'raddocs', :github => "smartlogic/raddocs"
end
32 changes: 19 additions & 13 deletions example/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
GIT
remote: git://github.com/smartlogic/raddocs.git
revision: 00cfb5cfc97ce98bcdef236088ee385327b4f68f
specs:
raddocs (0.1.3)
haml
json
sinatra

PATH
remote: ../
specs:
rspec_api_documentation (0.9.0)
rspec_api_documentation (0.9.1)
activesupport (>= 3.0.0)
i18n (>= 0.1.0)
json (>= 1.4.6)
@@ -55,7 +64,8 @@ GEM
erubis (2.7.0)
execjs (1.2.12)
multi_json (~> 1.0)
haml (3.1.6)
haml (4.0.2)
tilt
has_scope (0.5.1)
hike (1.2.1)
i18n (0.6.0)
@@ -65,7 +75,7 @@ GEM
jquery-rails (1.0.19)
railties (~> 3.0)
thor (~> 0.14)
json (1.6.3)
json (1.7.7)
json_spec (0.7.0)
multi_json (~> 1.0.0)
rspec (~> 2.0)
@@ -82,16 +92,12 @@ GEM
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-protection (1.2.0)
rack-protection (1.5.0)
rack
rack-ssl (1.3.2)
rack
rack-test (0.6.2)
rack (>= 1.0)
raddocs (0.1.0)
haml
json
sinatra
rails (3.1.3)
actionmailer (= 3.1.3)
actionpack (= 3.1.3)
@@ -130,17 +136,17 @@ GEM
railties (~> 3.1.0)
sass (~> 3.1.10)
tilt (~> 1.3.2)
sinatra (1.3.1)
rack (~> 1.3, >= 1.3.4)
rack-protection (~> 1.1, >= 1.1.2)
sinatra (1.3.3)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
thor (0.14.6)
tilt (1.3.3)
tilt (1.3.7)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
@@ -160,7 +166,7 @@ DEPENDENCIES
inherited_resources
jquery-rails
json_spec
raddocs (= 0.1.0)
raddocs!
rails (= 3.1.3)
rspec-rails
rspec_api_documentation!
2 changes: 1 addition & 1 deletion example/config/initializers/raddocs.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Raddocs.configure do |config|
config.docs_dir = "public/docs"
config.docs_dir = "docs"
end
7 changes: 1 addition & 6 deletions example/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -33,12 +33,7 @@
end

RspecApiDocumentation.configure do |config|
config.docs_dir = Rails.root.join("public", "docs")
# html pages with the wURL console
config.format = [:json, :wurl, :combined_text]
# html pages without the wURL console
#config.format = [:json, :html]
config.url_prefix = "/docs"
config.format = [:json, :combined_text]
config.curl_host = 'http://localhost:3000'
config.api_name = "Example App API"
end
4 changes: 2 additions & 2 deletions features/step_definitions/html_steps.rb
Original file line number Diff line number Diff line change
@@ -42,11 +42,11 @@
end

Then /^I should see the following request body:$/ do |request_body|
page.should have_css("div.request.body", :text => request_body)
page.should have_css("pre.request.body", :text => request_body)
end

Then /^I should see the following response body:$/ do |response_body|
page.should have_css("div.response.body", :text => response_body)
page.should have_css("pre.response.body", :text => response_body)
end

Then /^I should see the api name "(.*?)"$/ do |name|
1 change: 0 additions & 1 deletion lib/rspec_api_documentation.rb
Original file line number Diff line number Diff line change
@@ -25,7 +25,6 @@ module RspecApiDocumentation
autoload :OAuth2MACClient, "rspec_api_documentation/oauth2_mac_client"
autoload :TestServer
autoload :HtmlWriter
autoload :WurlWriter
autoload :JsonWriter
autoload :JsonIodocsWriter
autoload :IndexWriter
1 change: 0 additions & 1 deletion lib/rspec_api_documentation/api_documentation.rb
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ def clear_docs
FileUtils.rm_rf(docs_dir, :secure => true)
end
FileUtils.mkdir_p(docs_dir)
FileUtils.cp_r(File.join(configuration.template_path, "assets"), docs_dir)
end

def document_example(rspec_example)
2 changes: 0 additions & 2 deletions lib/rspec_api_documentation/configuration.rb
Original file line number Diff line number Diff line change
@@ -17,7 +17,6 @@ def define_group(name, &block)
subconfig = self.class.new(self)
subconfig.filter = name
subconfig.docs_dir = self.docs_dir.join(name.to_s)
subconfig.url_prefix = "#{self.url_prefix}/#{name}"
yield subconfig
groups << subconfig
end
@@ -47,7 +46,6 @@ def self.add_setting(name, opts = {})
add_setting :template_path, :default => File.expand_path("../../../templates", __FILE__)
add_setting :filter, :default => :all
add_setting :exclusion_filter, :default => nil
add_setting :url_prefix, :default => ""
add_setting :app, :default => lambda { |config|
if defined?(Rails)
Rails.application
9 changes: 0 additions & 9 deletions lib/rspec_api_documentation/html_writer.rb
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ class HtmlWriter
attr_accessor :index, :configuration

def initialize(index, configuration)
warn "[NOTICE] Assets will be gone from the next release. Please use Raddocs for nicer looking docs"
self.index = index
self.configuration = configuration
end
@@ -44,10 +43,6 @@ def sections
IndexWriter.sections(examples, @configuration)
end

def url_prefix
@configuration.url_prefix
end

def examples
@index.examples.map { |example| HtmlExample.new(example, @configuration) }
end
@@ -92,10 +87,6 @@ def requests
end
end

def url_prefix
configuration.url_prefix
end

private
def format_hash(hash = {})
return nil unless hash.present?
110 changes: 0 additions & 110 deletions lib/rspec_api_documentation/wurl_writer.rb

This file was deleted.

8 changes: 0 additions & 8 deletions spec/configuration_spec.rb
Original file line number Diff line number Diff line change
@@ -49,7 +49,6 @@
its(:exclusion_filter) { should be_nil }
its(:app) { should be_nil }
its(:curl_host) { should be_nil }
its(:url_prefix) { should be_blank }
its(:keep_source_order) { should be_false }
its(:api_name) { should == "API Documentation" }
end
@@ -86,13 +85,6 @@
config.docs_dir.should == subject.docs_dir.join('sub')
end
end

it "should scope the url_prefix directory" do
subject.url_prefix = "/docs"
subject.define_group(:sub) do |config|
config.url_prefix.should == "/docs/sub"
end
end
end

it { should be_a(Enumerable) }
Binary file removed templates/assets/img/glyphicons-halflings-white.png
Binary file not shown.
Binary file removed templates/assets/img/glyphicons-halflings.png
Binary file not shown.
250 changes: 0 additions & 250 deletions templates/assets/javascripts/application.js

This file was deleted.

3,636 changes: 0 additions & 3,636 deletions templates/assets/javascripts/codemirror.js

This file was deleted.

9,401 changes: 0 additions & 9,401 deletions templates/assets/javascripts/jquery-1-7-2.js

This file was deleted.

189 changes: 0 additions & 189 deletions templates/assets/javascripts/jquery-base64.js

This file was deleted.

226 changes: 0 additions & 226 deletions templates/assets/javascripts/jquery-livequery.js

This file was deleted.

791 changes: 0 additions & 791 deletions templates/assets/javascripts/jquery-ui-1-8-16-min.js

This file was deleted.

124 changes: 0 additions & 124 deletions templates/assets/javascripts/mode/css/css.js

This file was deleted.

85 changes: 0 additions & 85 deletions templates/assets/javascripts/mode/htmlmixed/htmlmixed.js

This file was deleted.

361 changes: 0 additions & 361 deletions templates/assets/javascripts/mode/javascript/javascript.js

This file was deleted.

325 changes: 0 additions & 325 deletions templates/assets/javascripts/mode/xml/xml.js

This file was deleted.

68 changes: 0 additions & 68 deletions templates/assets/stylesheets/application.css

This file was deleted.

4,960 changes: 0 additions & 4,960 deletions templates/assets/stylesheets/bootstrap.css

This file was deleted.

230 changes: 0 additions & 230 deletions templates/assets/stylesheets/codemirror.css

This file was deleted.

53 changes: 12 additions & 41 deletions templates/rspec_api_documentation/html_example.mustache
Original file line number Diff line number Diff line change
@@ -3,45 +3,6 @@
<head>
<title>{{resource_name}} API</title>
<meta charset="utf-8">
<link rel="stylesheet" href="{{url_prefix}}/assets/stylesheets/bootstrap.css"/>
<link rel="stylesheet" href="{{url_prefix}}/assets/stylesheets/codemirror.css"/>
<link rel="stylesheet" href="{{url_prefix}}/assets/stylesheets/application.css"/>
<script src="{{url_prefix}}/assets/javascripts/jquery-1-7-2.js"></script>
<script src="{{url_prefix}}/assets/javascripts/codemirror.js"></script>
<script src="{{url_prefix}}/assets/javascripts/mode/css/css.js"></script>
<script src="{{url_prefix}}/assets/javascripts/mode/htmlmixed/htmlmixed.js"></script>
<script src="{{url_prefix}}/assets/javascripts/mode/javascript/javascript.js"></script>
<script src="{{url_prefix}}/assets/javascripts/mode/xml/xml.js"></script>
<script>
function mirror(textarea, contentType, options) {
$textarea = $(textarea);
if ($textarea.val() != '') {
if(contentType.indexOf('json') >= 0) {
$textarea.val(JSON.stringify(JSON.parse($textarea.val()), undefined, 2));
options.json = true;
options.mode = 'javascript';
} else if (contentType.indexOf('javascript') >= 0) {
options.mode = 'javascript';
} else if (contentType.indexOf('xml') >= 0) {
options.mode = 'xml';
} else {
options.mode = 'htmlmixed';
}
}
return CodeMirror.fromTextArea(textarea, options);
};
$(function(){
$(".request.body").each(function(i, el) {
el = $(el);
mirror(el.find("textarea")[0], el.data("content-type"), { "readOnly": true, "lineNumbers": true });
});
$(".response.body").each(function(i, el) {
el = $(el);
mirror(el.find("textarea")[0], el.data("content-type"), { "readOnly": true, "lineNumbers": true });
});
});
</script>
<style>
td.required .name:after {
float: right;
@@ -54,6 +15,16 @@
padding: 15px;
font-size: 130%;
}
pre {
white-space: pre-wrap;
}
body {
margin-left: auto;
margin-right: auto;
width: 900px;
}
</style>
</head>
<body>
@@ -109,7 +80,7 @@

{{# request_body }}
<h4>Body</h4>
<div class="request body" data-content-type="{{ request_content_type }}"><textarea>{{{ request_body }}}</textarea></div>
<pre class="request body">{{{ request_body }}}</pre>
{{/ request_body }}

{{# curl }}
@@ -125,7 +96,7 @@
<pre class="response status">{{ response_status }} {{ response_status_text}}</pre>
{{# response_body }}
<h4>Body</h4>
<div class="response body" data-content-type="{{ response_content_type }}"><textarea>{{{ response_body }}}</textarea></div>
<pre class="response body">{{{ response_body }}}</pre>
{{/ response_body }}
{{/ response_status }}
{{/ requests }}
11 changes: 9 additions & 2 deletions templates/rspec_api_documentation/html_index.mustache
Original file line number Diff line number Diff line change
@@ -3,7 +3,14 @@
<head>
<title>{{ api_name }}</title>
<meta charset="utf-8">
<link rel="stylesheet" href="{{ url_prefix }}/assets/stylesheets/bootstrap.css"/>

<style>
body {
margin-left: auto;
margin-right: auto;
width: 900px;
}
</style>
</head>
<body>
<div class="container">
@@ -16,7 +23,7 @@
<ul>
{{# examples }}
<li>
<a href="{{ url_prefix }}/{{ dirname }}/{{ filename }}">{{ description }}</a>
<a href="{{ dirname }}/{{ filename }}">{{ description }}</a>
</li>
{{/ examples }}
</ul>
242 changes: 0 additions & 242 deletions templates/rspec_api_documentation/wurl_example.mustache

This file was deleted.

27 changes: 0 additions & 27 deletions templates/rspec_api_documentation/wurl_index.mustache

This file was deleted.