From a81456b56a2394a9203cd5776fa21140e779c680 Mon Sep 17 00:00:00 2001 From: llenodo Date: Wed, 4 Oct 2017 09:19:25 -0700 Subject: [PATCH 01/14] Change classnames to capitalize `JSON` --- lib/rspec_api_documentation.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rspec_api_documentation.rb b/lib/rspec_api_documentation.rb index 6d6afdc2..6d2f2be0 100644 --- a/lib/rspec_api_documentation.rb +++ b/lib/rspec_api_documentation.rb @@ -37,9 +37,9 @@ module Writers autoload :HtmlWriter autoload :TextileWriter autoload :MarkdownWriter - autoload :JsonWriter + autoload :JSONWriter autoload :AppendJsonWriter - autoload :JsonIodocsWriter + autoload :JSONIodocsWriter autoload :IndexHelper autoload :CombinedTextWriter autoload :CombinedJsonWriter From 4abaee7ddf8985d8232888fe33f5e4fefaa8e577 Mon Sep 17 00:00:00 2001 From: llenodo Date: Wed, 4 Oct 2017 09:22:47 -0700 Subject: [PATCH 02/14] Change JsonIodocsWriter to JSONIodocsWriter --- lib/rspec_api_documentation/writers/json_iodocs_writer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec_api_documentation/writers/json_iodocs_writer.rb b/lib/rspec_api_documentation/writers/json_iodocs_writer.rb index fd2f5c1d..10ff78f6 100644 --- a/lib/rspec_api_documentation/writers/json_iodocs_writer.rb +++ b/lib/rspec_api_documentation/writers/json_iodocs_writer.rb @@ -2,7 +2,7 @@ module RspecApiDocumentation module Writers - class JsonIodocsWriter < Writer + class JSONIodocsWriter < Writer attr_accessor :api_key delegate :docs_dir, :to => :configuration From fb0f142a38e8e69a8736b9ca8870fa32732de14e Mon Sep 17 00:00:00 2001 From: llenodo Date: Wed, 4 Oct 2017 09:23:24 -0700 Subject: [PATCH 03/14] Change JsonWriter to JSONWriter --- lib/rspec_api_documentation/writers/json_writer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec_api_documentation/writers/json_writer.rb b/lib/rspec_api_documentation/writers/json_writer.rb index 022240ad..772e70b0 100644 --- a/lib/rspec_api_documentation/writers/json_writer.rb +++ b/lib/rspec_api_documentation/writers/json_writer.rb @@ -2,7 +2,7 @@ module RspecApiDocumentation module Writers - class JsonWriter < Writer + class JSONWriter < Writer delegate :docs_dir, :to => :configuration def write From 4760e48c1fa15d960c3861df9f19bf335fa362b8 Mon Sep 17 00:00:00 2001 From: llenodo Date: Thu, 5 Oct 2017 09:23:16 -0700 Subject: [PATCH 04/14] Update classname in json_writer_spec --- spec/writers/json_writer_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/writers/json_writer_spec.rb b/spec/writers/json_writer_spec.rb index 4f36d506..9e5e6b8d 100644 --- a/spec/writers/json_writer_spec.rb +++ b/spec/writers/json_writer_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe RspecApiDocumentation::Writers::JsonWriter do +describe RspecApiDocumentation::Writers::JSONWriter do let(:index) { RspecApiDocumentation::Index.new } let(:configuration) { RspecApiDocumentation::Configuration.new } From 4a6725312869a0f9851232b2f5fba8cb9c8f7e46 Mon Sep 17 00:00:00 2001 From: llenodo Date: Thu, 5 Oct 2017 09:24:06 -0700 Subject: [PATCH 05/14] update classname for JSONIodocswriter_spec --- spec/writers/json_iodocs_writer_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/writers/json_iodocs_writer_spec.rb b/spec/writers/json_iodocs_writer_spec.rb index bfee639c..2de95c65 100644 --- a/spec/writers/json_iodocs_writer_spec.rb +++ b/spec/writers/json_iodocs_writer_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe RspecApiDocumentation::Writers::JsonIodocsWriter do +describe RspecApiDocumentation::Writers::JSONIodocsWriter do let(:index) { RspecApiDocumentation::Index.new } let(:configuration) { RspecApiDocumentation::Configuration.new } From 9c456e391b97be475ae176d36af7d169793a4e26 Mon Sep 17 00:00:00 2001 From: llenodo Date: Thu, 5 Oct 2017 09:30:15 -0700 Subject: [PATCH 06/14] Update JSONExample classname --- spec/writers/json_example_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/writers/json_example_spec.rb b/spec/writers/json_example_spec.rb index edcf1f68..24ebca4f 100644 --- a/spec/writers/json_example_spec.rb +++ b/spec/writers/json_example_spec.rb @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- require 'spec_helper' -describe RspecApiDocumentation::Writers::JsonExample do +describe RspecApiDocumentation::Writers::JSONExample do let(:configuration) { RspecApiDocumentation::Configuration.new } describe "#dirname" do @@ -9,7 +9,7 @@ example = double(resource_name: "/test_string") json_example = - RspecApiDocumentation::Writers::JsonExample.new(example, configuration) + RspecApiDocumentation::Writers::JSONExample.new(example, configuration) expect(json_example.dirname).to eq "test_string" end @@ -18,7 +18,7 @@ example = double(resource_name: "test_string/test") json_example = - RspecApiDocumentation::Writers::JsonExample.new(example, configuration) + RspecApiDocumentation::Writers::JSONExample.new(example, configuration) expect(json_example.dirname).to eq "test_string/test" end From 64821a84cffb34d912f46bdcde6e093ce2cb5206 Mon Sep 17 00:00:00 2001 From: llenodo Date: Thu, 5 Oct 2017 09:31:52 -0700 Subject: [PATCH 07/14] update classname for JSONExample --- lib/rspec_api_documentation/writers/json_iodocs_writer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rspec_api_documentation/writers/json_iodocs_writer.rb b/lib/rspec_api_documentation/writers/json_iodocs_writer.rb index 10ff78f6..0f6db5ce 100644 --- a/lib/rspec_api_documentation/writers/json_iodocs_writer.rb +++ b/lib/rspec_api_documentation/writers/json_iodocs_writer.rb @@ -32,7 +32,7 @@ def sections end def examples - @index.examples.map { |example| JsonExample.new(example, @configuration) } + @index.examples.map { |example| JSONExample.new(example, @configuration) } end def as_json(opts = nil) @@ -48,7 +48,7 @@ def as_json(opts = nil) end end - class JsonExample + class JSONExample def initialize(example, configuration) @example = example end From 661232cb0998651c68365d10e1f08fe37ad47f1b Mon Sep 17 00:00:00 2001 From: llenodo Date: Thu, 5 Oct 2017 09:34:12 -0700 Subject: [PATCH 08/14] Update classnames for JSONExample and JSONIndex --- lib/rspec_api_documentation/writers/json_writer.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/rspec_api_documentation/writers/json_writer.rb b/lib/rspec_api_documentation/writers/json_writer.rb index 772e70b0..c23437bf 100644 --- a/lib/rspec_api_documentation/writers/json_writer.rb +++ b/lib/rspec_api_documentation/writers/json_writer.rb @@ -7,14 +7,14 @@ class JSONWriter < Writer def write File.open(docs_dir.join("index.json"), "w+") do |f| - f.write Formatter.to_json(JsonIndex.new(index, configuration)) + f.write Formatter.to_json(JSONIndex.new(index, configuration)) end write_examples end def write_examples index.examples.each do |example| - json_example = JsonExample.new(example, configuration) + json_example = JSONExample.new(example, configuration) FileUtils.mkdir_p(docs_dir.join(json_example.dirname)) File.open(docs_dir.join(json_example.dirname, json_example.filename), "w+") do |f| f.write Formatter.to_json(json_example) @@ -23,7 +23,7 @@ def write_examples end end - class JsonIndex + class JSONIndex def initialize(index, configuration) @index = index @configuration = configuration @@ -34,7 +34,7 @@ def sections end def examples - @index.examples.map { |example| JsonExample.new(example, @configuration) } + @index.examples.map { |example| JSONExample.new(example, @configuration) } end def as_json(opts = nil) @@ -61,7 +61,7 @@ def section_hash(section) end end - class JsonExample + class JSONExample def initialize(example, configuration) @example = example @host = configuration.curl_host From 635a85ce7db8bdd44e90c63c0a80b2f095dcf986 Mon Sep 17 00:00:00 2001 From: llenodo Date: Thu, 5 Oct 2017 09:54:29 -0700 Subject: [PATCH 09/14] load JSONExample correctly in spec --- spec/writers/json_example_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/writers/json_example_spec.rb b/spec/writers/json_example_spec.rb index 24ebca4f..0bbeb0c3 100644 --- a/spec/writers/json_example_spec.rb +++ b/spec/writers/json_example_spec.rb @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- require 'spec_helper' +require 'rspec_api_documentation/writers/json_writer' describe RspecApiDocumentation::Writers::JSONExample do let(:configuration) { RspecApiDocumentation::Configuration.new } From 42d2bc6816b25617a10e7245c624a48b7109facc Mon Sep 17 00:00:00 2001 From: llenodo Date: Thu, 5 Oct 2017 10:29:42 -0700 Subject: [PATCH 10/14] Change classname reference for JSONExample --- lib/rspec_api_documentation/writers/combined_json_writer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec_api_documentation/writers/combined_json_writer.rb b/lib/rspec_api_documentation/writers/combined_json_writer.rb index 2e4111c2..fe78bb64 100644 --- a/lib/rspec_api_documentation/writers/combined_json_writer.rb +++ b/lib/rspec_api_documentation/writers/combined_json_writer.rb @@ -7,7 +7,7 @@ def write File.open(configuration.docs_dir.join("combined.json"), "w+") do |f| examples = [] index.examples.each do |rspec_example| - examples << Formatter.to_json(JsonExample.new(rspec_example, configuration)) + examples << Formatter.to_json(JSONExample.new(rspec_example, configuration)) end f.write "[" From 684368504dc7047a3e794274a88a1988d19474c3 Mon Sep 17 00:00:00 2001 From: llenodo Date: Thu, 5 Oct 2017 10:37:40 -0700 Subject: [PATCH 11/14] update classnames for json_iodocs_writer --- lib/rspec_api_documentation/writers/json_iodocs_writer.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rspec_api_documentation/writers/json_iodocs_writer.rb b/lib/rspec_api_documentation/writers/json_iodocs_writer.rb index 0f6db5ce..b8414045 100644 --- a/lib/rspec_api_documentation/writers/json_iodocs_writer.rb +++ b/lib/rspec_api_documentation/writers/json_iodocs_writer.rb @@ -2,7 +2,7 @@ module RspecApiDocumentation module Writers - class JSONIodocsWriter < Writer + class JsonIodocsWriter < Writer attr_accessor :api_key delegate :docs_dir, :to => :configuration @@ -32,7 +32,7 @@ def sections end def examples - @index.examples.map { |example| JSONExample.new(example, @configuration) } + @index.examples.map { |example| JsonIodocsExample.new(example, @configuration) } end def as_json(opts = nil) @@ -48,7 +48,7 @@ def as_json(opts = nil) end end - class JSONExample + class JsonIodocsExample def initialize(example, configuration) @example = example end From 014f04e401e466d3b1d6ff20230c665f0a7ce1ce Mon Sep 17 00:00:00 2001 From: llenodo Date: Thu, 5 Oct 2017 10:38:25 -0700 Subject: [PATCH 12/14] require json_iodocs_writer in api_documentation --- lib/rspec_api_documentation/api_documentation.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rspec_api_documentation/api_documentation.rb b/lib/rspec_api_documentation/api_documentation.rb index 2503f594..34ad0320 100644 --- a/lib/rspec_api_documentation/api_documentation.rb +++ b/lib/rspec_api_documentation/api_documentation.rb @@ -1,3 +1,5 @@ +require 'rspec_api_documentation/writers/json_iodocs_writer' + module RspecApiDocumentation class ApiDocumentation attr_reader :configuration, :index From 66d676dbc23046a6a66b2378490fe01ce032bc6a Mon Sep 17 00:00:00 2001 From: llenodo Date: Thu, 5 Oct 2017 10:39:25 -0700 Subject: [PATCH 13/14] revert class name change for JsonIodocsWriter --- spec/writers/json_iodocs_writer_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/writers/json_iodocs_writer_spec.rb b/spec/writers/json_iodocs_writer_spec.rb index 2de95c65..bfee639c 100644 --- a/spec/writers/json_iodocs_writer_spec.rb +++ b/spec/writers/json_iodocs_writer_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe RspecApiDocumentation::Writers::JSONIodocsWriter do +describe RspecApiDocumentation::Writers::JsonIodocsWriter do let(:index) { RspecApiDocumentation::Index.new } let(:configuration) { RspecApiDocumentation::Configuration.new } From 72372ada9e3e36d289c73f5f1031cbe7f2722f83 Mon Sep 17 00:00:00 2001 From: llenodo Date: Thu, 5 Oct 2017 11:05:28 -0700 Subject: [PATCH 14/14] revert classname change for JsonIodocsWriter --- lib/rspec_api_documentation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec_api_documentation.rb b/lib/rspec_api_documentation.rb index 6d2f2be0..d19c74c1 100644 --- a/lib/rspec_api_documentation.rb +++ b/lib/rspec_api_documentation.rb @@ -39,7 +39,7 @@ module Writers autoload :MarkdownWriter autoload :JSONWriter autoload :AppendJsonWriter - autoload :JSONIodocsWriter + autoload :JsonIodocsWriter autoload :IndexHelper autoload :CombinedTextWriter autoload :CombinedJsonWriter