diff --git a/.bundle/config b/.bundle/config new file mode 100755 index 00000000..df3c2f25 --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_JOBS: 8 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.rspec b/.rspec old mode 100644 new mode 100755 diff --git a/.travis.yml b/.travis.yml old mode 100644 new mode 100755 diff --git a/Gemfile b/Gemfile old mode 100644 new mode 100755 diff --git a/Gemfile.lock b/Gemfile.lock old mode 100644 new mode 100755 diff --git a/LICENSE.md b/LICENSE.md old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/Rakefile b/Rakefile old mode 100644 new mode 100755 diff --git a/example/.gitignore b/example/.gitignore old mode 100644 new mode 100755 diff --git a/example/.rspec b/example/.rspec old mode 100644 new mode 100755 diff --git a/example/Gemfile b/example/Gemfile old mode 100644 new mode 100755 diff --git a/example/Gemfile.lock b/example/Gemfile.lock old mode 100644 new mode 100755 index 646d4b01..c1913ff5 --- a/example/Gemfile.lock +++ b/example/Gemfile.lock @@ -10,13 +10,12 @@ GIT PATH remote: ../ specs: - rspec_api_documentation (1.1.0) + rspec_api_documentation (2.0.0) activesupport (>= 3.0.0) i18n (>= 0.1.0) json (>= 1.4.6) mustache (>= 0.99.4) rspec (>= 2.14.0) - webmock (>= 1.7.0) GEM remote: http://rubygems.org/ @@ -49,7 +48,6 @@ GEM activesupport (= 3.1.3) activesupport (3.1.3) multi_json (~> 1.0) - addressable (2.3.5) arel (2.2.3) builder (3.0.4) coffee-rails (3.1.1) @@ -59,8 +57,6 @@ GEM coffee-script-source execjs coffee-script-source (1.6.3) - crack (0.4.1) - safe_yaml (~> 0.9.0) diff-lcs (1.2.4) erubis (2.7.0) execjs (1.4.0) @@ -86,7 +82,7 @@ GEM treetop (~> 1.4.8) mime-types (1.23) multi_json (1.7.9) - mustache (0.99.4) + mustache (0.99.5) polyglot (0.3.3) rack (1.3.10) rack-cache (1.2) @@ -134,7 +130,6 @@ GEM rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) rspec-mocks (~> 2.14.0) - safe_yaml (0.9.5) sass (3.2.10) sass-rails (3.1.7) actionpack (~> 3.1.0) @@ -159,9 +154,6 @@ GEM uglifier (2.1.2) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) - webmock (1.13.0) - addressable (>= 2.2.7) - crack (>= 0.3.2) PLATFORMS ruby diff --git a/example/README b/example/README old mode 100644 new mode 100755 diff --git a/example/Rakefile b/example/Rakefile old mode 100644 new mode 100755 diff --git a/example/app/assets/images/rails.png b/example/app/assets/images/rails.png old mode 100644 new mode 100755 diff --git a/example/app/assets/javascripts/application.js b/example/app/assets/javascripts/application.js old mode 100644 new mode 100755 diff --git a/example/app/assets/stylesheets/application.css b/example/app/assets/stylesheets/application.css old mode 100644 new mode 100755 diff --git a/example/app/controllers/application_controller.rb b/example/app/controllers/application_controller.rb old mode 100644 new mode 100755 diff --git a/example/app/controllers/orders_controller.rb b/example/app/controllers/orders_controller.rb old mode 100644 new mode 100755 diff --git a/example/app/helpers/application_helper.rb b/example/app/helpers/application_helper.rb old mode 100644 new mode 100755 diff --git a/example/app/mailers/.gitkeep b/example/app/mailers/.gitkeep old mode 100644 new mode 100755 diff --git a/example/app/models/.gitkeep b/example/app/models/.gitkeep old mode 100644 new mode 100755 diff --git a/example/app/models/order.rb b/example/app/models/order.rb old mode 100644 new mode 100755 diff --git a/example/app/views/layouts/application.html.erb b/example/app/views/layouts/application.html.erb old mode 100644 new mode 100755 diff --git a/example/config.ru b/example/config.ru old mode 100644 new mode 100755 diff --git a/example/config/application.rb b/example/config/application.rb old mode 100644 new mode 100755 diff --git a/example/config/boot.rb b/example/config/boot.rb old mode 100644 new mode 100755 diff --git a/example/config/database.yml b/example/config/database.yml old mode 100644 new mode 100755 diff --git a/example/config/environment.rb b/example/config/environment.rb old mode 100644 new mode 100755 diff --git a/example/config/environments/development.rb b/example/config/environments/development.rb old mode 100644 new mode 100755 diff --git a/example/config/environments/production.rb b/example/config/environments/production.rb old mode 100644 new mode 100755 diff --git a/example/config/environments/test.rb b/example/config/environments/test.rb old mode 100644 new mode 100755 diff --git a/example/config/initializers/backtrace_silencers.rb b/example/config/initializers/backtrace_silencers.rb old mode 100644 new mode 100755 diff --git a/example/config/initializers/inflections.rb b/example/config/initializers/inflections.rb old mode 100644 new mode 100755 diff --git a/example/config/initializers/mime_types.rb b/example/config/initializers/mime_types.rb old mode 100644 new mode 100755 diff --git a/example/config/initializers/raddocs.rb b/example/config/initializers/raddocs.rb old mode 100644 new mode 100755 diff --git a/example/config/initializers/secret_token.rb b/example/config/initializers/secret_token.rb old mode 100644 new mode 100755 diff --git a/example/config/initializers/session_store.rb b/example/config/initializers/session_store.rb old mode 100644 new mode 100755 diff --git a/example/config/initializers/wrap_parameters.rb b/example/config/initializers/wrap_parameters.rb old mode 100644 new mode 100755 diff --git a/example/config/locales/en.yml b/example/config/locales/en.yml old mode 100644 new mode 100755 diff --git a/example/config/routes.rb b/example/config/routes.rb old mode 100644 new mode 100755 diff --git a/example/db/migrate/20111215005439_create_orders.rb b/example/db/migrate/20111215005439_create_orders.rb old mode 100644 new mode 100755 diff --git a/example/db/schema.rb b/example/db/schema.rb old mode 100644 new mode 100755 diff --git a/example/db/seeds.rb b/example/db/seeds.rb old mode 100644 new mode 100755 diff --git a/example/doc/README_FOR_APP b/example/doc/README_FOR_APP deleted file mode 100644 index fe41f5cc..00000000 --- a/example/doc/README_FOR_APP +++ /dev/null @@ -1,2 +0,0 @@ -Use this README file to introduce your application and point to useful places in the API for learning more. -Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/example/lib/assets/.gitkeep b/example/lib/assets/.gitkeep old mode 100644 new mode 100755 diff --git a/example/lib/tasks/.gitkeep b/example/lib/tasks/.gitkeep old mode 100644 new mode 100755 diff --git a/example/log/.gitkeep b/example/log/.gitkeep old mode 100644 new mode 100755 diff --git a/example/public/404.html b/example/public/404.html old mode 100644 new mode 100755 diff --git a/example/public/422.html b/example/public/422.html old mode 100644 new mode 100755 diff --git a/example/public/500.html b/example/public/500.html old mode 100644 new mode 100755 diff --git a/example/public/favicon.ico b/example/public/favicon.ico old mode 100644 new mode 100755 diff --git a/example/public/index.html b/example/public/index.html old mode 100644 new mode 100755 diff --git a/example/public/robots.txt b/example/public/robots.txt old mode 100644 new mode 100755 diff --git a/example/spec/acceptance/orders_spec.rb b/example/spec/acceptance/orders_spec.rb old mode 100644 new mode 100755 diff --git a/example/spec/spec_helper.rb b/example/spec/spec_helper.rb old mode 100644 new mode 100755 diff --git a/features/callbacks.feature b/features/callbacks.feature old mode 100644 new mode 100755 diff --git a/features/combined_json.feature b/features/combined_json.feature old mode 100644 new mode 100755 diff --git a/features/combined_text.feature b/features/combined_text.feature old mode 100644 new mode 100755 diff --git a/features/curl.feature b/features/curl.feature old mode 100644 new mode 100755 diff --git a/features/example_request.feature b/features/example_request.feature old mode 100644 new mode 100755 diff --git a/features/fixtures/file.png b/features/fixtures/file.png old mode 100644 new mode 100755 diff --git a/features/folder_structure.feature b/features/folder_structure.feature old mode 100644 new mode 100755 diff --git a/features/headers.feature b/features/headers.feature old mode 100644 new mode 100755 diff --git a/features/html_documentation.feature b/features/html_documentation.feature old mode 100644 new mode 100755 diff --git a/features/json_iodocs.feature b/features/json_iodocs.feature old mode 100644 new mode 100755 diff --git a/features/oauth2_mac_client.feature b/features/oauth2_mac_client.feature old mode 100644 new mode 100755 diff --git a/features/patch.feature b/features/patch.feature old mode 100644 new mode 100755 diff --git a/features/readme.md b/features/readme.md old mode 100644 new mode 100755 diff --git a/features/redefining_client.feature b/features/redefining_client.feature old mode 100644 new mode 100755 diff --git a/features/step_definitions/curl_steps.rb b/features/step_definitions/curl_steps.rb old mode 100644 new mode 100755 diff --git a/features/step_definitions/html_steps.rb b/features/step_definitions/html_steps.rb old mode 100644 new mode 100755 diff --git a/features/step_definitions/image_steps.rb b/features/step_definitions/image_steps.rb old mode 100644 new mode 100755 diff --git a/features/step_definitions/json_steps.rb b/features/step_definitions/json_steps.rb old mode 100644 new mode 100755 diff --git a/features/support/capybara.rb b/features/support/capybara.rb old mode 100644 new mode 100755 diff --git a/features/support/env.rb b/features/support/env.rb old mode 100644 new mode 100755 diff --git a/features/textile_documentation.feature b/features/textile_documentation.feature old mode 100644 new mode 100755 diff --git a/features/upload_file.feature b/features/upload_file.feature old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation.rb b/lib/rspec_api_documentation.rb old mode 100644 new mode 100755 index f3bba058..d2ed5f76 --- a/lib/rspec_api_documentation.rb +++ b/lib/rspec_api_documentation.rb @@ -33,6 +33,7 @@ module Writers autoload :HtmlWriter autoload :TextileWriter autoload :JsonWriter + autoload :JsonSwaggerWriter autoload :AppendJsonWriter autoload :JsonIodocsWriter autoload :IndexHelper diff --git a/lib/rspec_api_documentation/api_documentation.rb b/lib/rspec_api_documentation/api_documentation.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/api_formatter.rb b/lib/rspec_api_documentation/api_formatter.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/client_base.rb b/lib/rspec_api_documentation/client_base.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/configuration.rb b/lib/rspec_api_documentation/configuration.rb old mode 100644 new mode 100755 index 3afd896e..feffd25b --- a/lib/rspec_api_documentation/configuration.rb +++ b/lib/rspec_api_documentation/configuration.rb @@ -56,6 +56,8 @@ def self.add_setting(name, opts = {}) add_setting :curl_headers_to_filter, :default => nil add_setting :curl_host, :default => nil + add_setting :base_api_path, :default => nil + add_setting :api_version, :default => nil add_setting :keep_source_order, :default => false add_setting :api_name, :default => "API Documentation" add_setting :io_docs_protocol, :default => "http" diff --git a/lib/rspec_api_documentation/curl.rb b/lib/rspec_api_documentation/curl.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/dsl.rb b/lib/rspec_api_documentation/dsl.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/dsl/callback.rb b/lib/rspec_api_documentation/dsl/callback.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/dsl/endpoint.rb b/lib/rspec_api_documentation/dsl/endpoint.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/dsl/resource.rb b/lib/rspec_api_documentation/dsl/resource.rb old mode 100644 new mode 100755 index 4b82a49e..713a819f --- a/lib/rspec_api_documentation/dsl/resource.rb +++ b/lib/rspec_api_documentation/dsl/resource.rb @@ -9,6 +9,7 @@ def self.define_action(method) options[:method] = method options[:route] = args.first options[:api_doc_dsl] = :endpoint + options[:descriptionf] = "afdsfasdfsdf" args.push(options) args[0] = "#{method.to_s.upcase} #{args[0]}" context(*args, &block) @@ -41,10 +42,39 @@ def parameter(name, description, options = {}) parameters.push(options.merge(:name => name.to_s, :description => description)) end + def modified_root_path(path) + metadata[:modified_root_path] = path + if superclass_metadata && metadata[:modified_root_path].equal?(superclass_metadata[:modified_root_path]) + metadata[:modified_root_path] = Marshal.load(Marshal.dump(superclass_metadata[:modified_root_path])) + end + metadata[:modified_root_path] + end + def header(name, value) headers[name] = value end + def descriptionf(text) + example.metadata[:descriptionf] = text + end + + def example(title, params={}, &block) + metadata[:mute] = !!params[:mute] + if superclass_metadata && metadata[:mute].equal?(superclass_metadata[:mute]) + metadata[:mute] = Marshal.load(Marshal.dump(superclass_metadata[:mute])) + end + + super title, &block + end + + def root_path(path) + metadata[:root_path] = path + if superclass_metadata && metadata[:root_path].equal?(superclass_metadata[:root_path]) + metadata[:root_path] = Marshal.load(Marshal.dump(superclass_metadata[:root_path])) + end + metadata[:root_path] + end + private def parameters metadata[:parameters] ||= [] diff --git a/lib/rspec_api_documentation/example.rb b/lib/rspec_api_documentation/example.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/headers.rb b/lib/rspec_api_documentation/headers.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/index.rb b/lib/rspec_api_documentation/index.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/oauth2_mac_client.rb b/lib/rspec_api_documentation/oauth2_mac_client.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/rack_test_client.rb b/lib/rspec_api_documentation/rack_test_client.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/railtie.rb b/lib/rspec_api_documentation/railtie.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/test_server.rb b/lib/rspec_api_documentation/test_server.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/views/html_example.rb b/lib/rspec_api_documentation/views/html_example.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/views/html_index.rb b/lib/rspec_api_documentation/views/html_index.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/views/markup_example.rb b/lib/rspec_api_documentation/views/markup_example.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/views/markup_index.rb b/lib/rspec_api_documentation/views/markup_index.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/views/textile_example.rb b/lib/rspec_api_documentation/views/textile_example.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/views/textile_index.rb b/lib/rspec_api_documentation/views/textile_index.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/writers/append_json_writer.rb b/lib/rspec_api_documentation/writers/append_json_writer.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/writers/combined_json_writer.rb b/lib/rspec_api_documentation/writers/combined_json_writer.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/writers/combined_text_writer.rb b/lib/rspec_api_documentation/writers/combined_text_writer.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/writers/formatter.rb b/lib/rspec_api_documentation/writers/formatter.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/writers/general_markup_writer.rb b/lib/rspec_api_documentation/writers/general_markup_writer.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/writers/html_writer.rb b/lib/rspec_api_documentation/writers/html_writer.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/writers/index_helper.rb b/lib/rspec_api_documentation/writers/index_helper.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/writers/json_iodocs_writer.rb b/lib/rspec_api_documentation/writers/json_iodocs_writer.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/writers/json_swagger_writer.rb b/lib/rspec_api_documentation/writers/json_swagger_writer.rb new file mode 100755 index 00000000..bdebe6c3 --- /dev/null +++ b/lib/rspec_api_documentation/writers/json_swagger_writer.rb @@ -0,0 +1,141 @@ +require 'rspec_api_documentation/writers/formatter' + +module RspecApiDocumentation + module Writers + class JsonSwaggerWriter < Writer + delegate :docs_dir, :to => :configuration + + def write + FileUtils.rm_rf docs_dir.join('v1') + FileUtils.mkdir_p(docs_dir.join('v1')) + + File.open(docs_dir.join('v1', "index.json"), "w+") do |f| + f.write Formatter.to_json(JsonSwaggerIndex.new(index, configuration)) + end + write_examples + end + + def write_examples + json_examples = {} + a = [] + index.examples.each do |example| + unless example.mute + a << example.route + json_example = JsonSwaggerExample.new(example, configuration) + dirname = example.route.split('/').reject(&:blank?) + FileUtils.mkdir_p(docs_dir.join(dirname[0..-2].join('/'))) + #(json_examples[docs_dir.join(dirname.join('/') << '.json')] ||= []) << JsonSwaggerExample.new(example, configuration) + (json_examples[docs_dir.join('v1', (example.root_path.gsub(/^\//, "") << '.json'))] ||= []) << JsonSwaggerExample.new(example, configuration) + end + end + + json_examples.each do |dirname, examples| + #directory = File.dirname(dirname) + + File.open(docs_dir.join(dirname), "a+") do |f| + f.write Formatter.to_json(format_examples(examples)) + end + end + end + + def format_examples(json_examples) + json_examples_sorted = {} + json_examples.each do |example| + root_path = example.root_path + root_path = example.modified_root_path if example.try(:modified_root_path) + (json_examples_sorted[root_path] ||= []) << example + end + + { + basePath: @configuration.base_api_path, + apiVersion: @configuration.api_version, + apis: json_examples_sorted.map { |path, examples| { path: path, operations: examples } } + } + end + end + + class JsonSwaggerIndex + def initialize(index, configuration) + @index = index + @configuration = configuration + end + + def sections + IndexHelper.sections(examples, @configuration) + end + + def examples + @index.examples.map { |example| JsonSwaggerExample.new(example, @configuration) } + end + + def as_json(opts = nil) + { + apiVersion: @configuration.api_version, + apis: section_hash + } + end + + def section_hash + sections.map do |section| + { + path: section[:examples].first.metadata[:root_path], + description: section[:resource_name] + } + end + end + end + + class JsonSwaggerExample + def initialize(example, configuration) + @example = example + @host = configuration.curl_host + @filter_headers = configuration.curl_headers_to_filter + end + + def method_missing(method, *args, &block) + @example.send(method, *args, &block) + end + + def respond_to?(method, include_private = false) + super || @example.respond_to?(method, include_private) + end + + def dirname + resource_name.downcase.gsub(/\s+/, '_') + end + + def filename + basename = description.downcase.gsub(/\s+/, '_').gsub(/[^a-z_]/, '') + "#{basename}.json" + end + + def as_json(opts = nil) + { + method: http_method, + type: resource_name, + summary: description, + nickname: "#{http_method}#{resource_name}", + parameters: respond_to?(:parameters) ? formatted_parameters : [], + responseMessages: [] + } + end + + def requests + super.map do |hash| + if @host + if hash[:curl].is_a? RspecApiDocumentation::Curl + hash[:curl] = hash[:curl].output(@host, @filter_headers) + end + else + hash[:curl] = nil + end + hash + end + end + + def formatted_parameters + parameters + end + end + end +end diff --git a/lib/rspec_api_documentation/writers/json_writer.rb b/lib/rspec_api_documentation/writers/json_writer.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/writers/textile_writer.rb b/lib/rspec_api_documentation/writers/textile_writer.rb old mode 100644 new mode 100755 diff --git a/lib/rspec_api_documentation/writers/writer.rb b/lib/rspec_api_documentation/writers/writer.rb old mode 100644 new mode 100755 diff --git a/lib/tasks/docs.rake b/lib/tasks/docs.rake old mode 100644 new mode 100755 diff --git a/rspec_api_documentation.gemspec b/rspec_api_documentation.gemspec old mode 100644 new mode 100755 diff --git a/spec/api_documentation_spec.rb b/spec/api_documentation_spec.rb old mode 100644 new mode 100755 diff --git a/spec/api_formatter_spec.rb b/spec/api_formatter_spec.rb old mode 100644 new mode 100755 diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb old mode 100644 new mode 100755 diff --git a/spec/curl_spec.rb b/spec/curl_spec.rb old mode 100644 new mode 100755 diff --git a/spec/dsl_spec.rb b/spec/dsl_spec.rb old mode 100644 new mode 100755 diff --git a/spec/example_spec.rb b/spec/example_spec.rb old mode 100644 new mode 100755 diff --git a/spec/index_spec.rb b/spec/index_spec.rb old mode 100644 new mode 100755 diff --git a/spec/rack_test_client_spec.rb b/spec/rack_test_client_spec.rb old mode 100644 new mode 100755 diff --git a/spec/rspec_api_documentation_spec.rb b/spec/rspec_api_documentation_spec.rb old mode 100644 new mode 100755 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb old mode 100644 new mode 100755 diff --git a/spec/views/html_example_spec.rb b/spec/views/html_example_spec.rb old mode 100644 new mode 100755 diff --git a/spec/writers/combined_text_example_spec.rb b/spec/writers/combined_text_example_spec.rb old mode 100644 new mode 100755 diff --git a/spec/writers/html_writer_spec.rb b/spec/writers/html_writer_spec.rb old mode 100644 new mode 100755 diff --git a/spec/writers/index_helper_spec.rb b/spec/writers/index_helper_spec.rb old mode 100644 new mode 100755 diff --git a/spec/writers/json_iodocs_writer_spec.rb b/spec/writers/json_iodocs_writer_spec.rb old mode 100644 new mode 100755 diff --git a/spec/writers/json_swagger_writer.rb b/spec/writers/json_swagger_writer.rb new file mode 100755 index 00000000..d32d13f3 --- /dev/null +++ b/spec/writers/json_swagger_writer.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe RspecApiDocumentation::Writers::JsonWriter do + let(:index) { RspecApiDocumentation::Index.new } + let(:configuration) { RspecApiDocumentation::Configuration.new } + + describe ".write" do + let(:writer) { double(:writer) } + + it "should build a new writer and write the docs" do + described_class.stub(:new).with(index, configuration).and_return(writer) + writer.should_receive(:write) + described_class.write(index, configuration) + end + end + + describe "#write" do + let(:writer) { described_class.new(index, configuration) } + + before do + FileUtils.mkdir_p(configuration.docs_dir) + end + + it "should write the index" do + writer.write + index_file = File.join(configuration.docs_dir, "index.json") + File.exists?(index_file).should be_true + end + end +end diff --git a/spec/writers/json_writer_spec.rb b/spec/writers/json_writer_spec.rb old mode 100644 new mode 100755 diff --git a/spec/writers/textile_writer_spec.rb b/spec/writers/textile_writer_spec.rb old mode 100644 new mode 100755 diff --git a/templates/rspec_api_documentation/html_example.mustache b/templates/rspec_api_documentation/html_example.mustache old mode 100644 new mode 100755 diff --git a/templates/rspec_api_documentation/html_index.mustache b/templates/rspec_api_documentation/html_index.mustache old mode 100644 new mode 100755 diff --git a/templates/rspec_api_documentation/textile_example.mustache b/templates/rspec_api_documentation/textile_example.mustache old mode 100644 new mode 100755 diff --git a/templates/rspec_api_documentation/textile_index.mustache b/templates/rspec_api_documentation/textile_index.mustache old mode 100644 new mode 100755