From 4e4e076801f5e47a8c6eae31d811da587669c693 Mon Sep 17 00:00:00 2001 From: BJ Neilsen Date: Mon, 2 Jan 2012 12:05:40 -0700 Subject: [PATCH] Add yard and simplecov for documentation and coverage reports --- .gitignore | 3 +++ .yardopts | 5 +++++ Gemfile.lock | 16 ++++++++++++++-- lib/protobuf/descriptor/descriptor_builder.rb | 12 ++++++------ protobuf.gemspec | 6 +++++- spec/spec_helper.rb | 3 +++ 6 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 .yardopts diff --git a/.gitignore b/.gitignore index 87a1c069..1c987c7e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ pkg/* .bundle .rvmrc *.log +coverage +doc +.yardoc diff --git a/.yardopts b/.yardopts new file mode 100644 index 00000000..1263c9db --- /dev/null +++ b/.yardopts @@ -0,0 +1,5 @@ +--no-private +--hide-void-return + +--markup-provider=redcarpet +--markup=markdown diff --git a/Gemfile.lock b/Gemfile.lock index 991a8dfa..0e79687f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,8 @@ PATH specs: protobuf (1.0.1) eventmachine (~> 0.12.10) - json_pure + eventually (~> 0.1.0) + json_pure (~> 1.6.4) GEM remote: http://rubygems.org/ @@ -11,8 +12,11 @@ GEM diff-lcs (1.1.3) eventmachine (0.12.10) eventmachine (0.12.10-java) - json_pure (1.6.3) + eventually (0.1.0) + json_pure (1.6.4) + multi_json (1.0.4) rake (0.8.7) + redcarpet (1.17.2) rspec (2.7.0) rspec-core (~> 2.7.0) rspec-expectations (~> 2.7.0) @@ -21,6 +25,11 @@ GEM rspec-expectations (2.7.0) diff-lcs (~> 1.1.2) rspec-mocks (2.7.0) + simplecov (0.5.4) + multi_json (~> 1.0.3) + simplecov-html (~> 0.5.3) + simplecov-html (0.5.3) + yard (0.7.4) PLATFORMS java @@ -29,4 +38,7 @@ PLATFORMS DEPENDENCIES protobuf! rake (~> 0.8.7) + redcarpet (~> 1.17.2) rspec (~> 2.7.0) + simplecov (~> 0.5.4) + yard (~> 0.7.4) diff --git a/lib/protobuf/descriptor/descriptor_builder.rb b/lib/protobuf/descriptor/descriptor_builder.rb index 857aa76d..3eea9c58 100644 --- a/lib/protobuf/descriptor/descriptor_builder.rb +++ b/lib/protobuf/descriptor/descriptor_builder.rb @@ -107,12 +107,12 @@ def self.id2label(label_id) def self.label2id(label) require 'protobuf/descriptor/descriptor_proto' case label - when :required - Google::Protobuf::FieldDescriptorProto::Label::LABEL_REQUIRED then - when :optional - Google::Protobuf::FieldDescriptorProto::Label::LABEL_OPTIONAL then - when :repeated - Google::Protobuf::FieldDescriptorProto::Label::LABEL_REPEATED then + when :required then + Google::Protobuf::FieldDescriptorProto::Label::LABEL_REQUIRED + when :optional then + Google::Protobuf::FieldDescriptorProto::Label::LABEL_OPTIONAL + when :repeated then + Google::Protobuf::FieldDescriptorProto::Label::LABEL_REPEATED else raise ArgumentError, "Invalid label: #{label}" end diff --git a/protobuf.gemspec b/protobuf.gemspec index 7530d36d..af4bad11 100644 --- a/protobuf.gemspec +++ b/protobuf.gemspec @@ -19,8 +19,12 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] s.add_dependency 'eventmachine', '~> 0.12.10' - s.add_dependency 'json_pure' + s.add_dependency 'eventually', '~> 0.1.0' + s.add_dependency 'json_pure', '~> 1.6.4' s.add_development_dependency 'rake', '~> 0.8.7' s.add_development_dependency 'rspec', '~> 2.7.0' + s.add_development_dependency 'yard', '~> 0.7.4' + s.add_development_dependency 'redcarpet', '~> 1.17.2' + s.add_development_dependency 'simplecov', '~> 0.5.4' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fc9da686..37cdd597 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,6 @@ +require 'simplecov' +SimpleCov.start + require 'rubygems' require 'bundler' Bundler.setup :default, :development, :test