diff --git a/Gemfile.lock b/Gemfile.lock index 44f2390..99d2268 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,6 @@ PATH specs: diver_down (0.0.1.alpha1) activesupport (>= 7.0.0) - msgpack (>= 1.7.0) rack-contrib (>= 2.3.0) GEM @@ -32,7 +31,6 @@ GEM json (2.7.2) language_server-protocol (3.17.0.3) minitest (5.22.3) - msgpack (1.7.2) mutex_m (0.2.0) nio4r (2.7.1) parallel (1.24.0) diff --git a/README.md b/README.md index eb3938b..6b893a8 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ end ``` The analysis results should be output to a specific directory. -Files saved in `.msgpack`, `.json`, or `.yaml` can be read by `DiverDown::Web`. +Files saved in `.json` or `.yaml` can be read by `DiverDown::Web`. ```ruby dir = 'tmp/diver_down' @@ -67,7 +67,6 @@ definition = tracer.trace do # do something end -File.binwrite(File.join(dir, "#{definition.title}.msgpack"), definition.to_msgpack) File.write(File.join(dir, "#{definition.title}.json"), definition.to_h.to_json) File.write(File.join(dir, "#{definition.title}.yaml"), definition.to_h.to_yaml) ``` diff --git a/diver_down.gemspec b/diver_down.gemspec index e87cbb9..b466fe8 100644 --- a/diver_down.gemspec +++ b/diver_down.gemspec @@ -26,6 +26,5 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.add_dependency 'activesupport', '>= 7.0.0' - spec.add_dependency 'msgpack', '>= 1.7.0' spec.add_dependency 'rack-contrib', '>= 2.3.0' end diff --git a/lib/diver_down.rb b/lib/diver_down.rb index 8af45cf..eb9d66e 100644 --- a/lib/diver_down.rb +++ b/lib/diver_down.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require 'msgpack' require_relative 'diver_down/version' module DiverDown diff --git a/lib/diver_down/definition.rb b/lib/diver_down/definition.rb index be6ed86..0572057 100644 --- a/lib/diver_down/definition.rb +++ b/lib/diver_down/definition.rb @@ -79,11 +79,6 @@ def to_h } end - # @return [String] - def to_msgpack - MessagePack.pack(to_h) - end - # @param other [Object, DiverDown::Definition::Source] # @return [Boolean] def ==(other) diff --git a/lib/diver_down/web/definition_loader.rb b/lib/diver_down/web/definition_loader.rb index 445da5c..8b989a0 100644 --- a/lib/diver_down/web/definition_loader.rb +++ b/lib/diver_down/web/definition_loader.rb @@ -8,8 +8,6 @@ def load_file(path) hash = case File.extname(path) when '.yaml', '.yml' from_yaml(path) - when '.msgpack' - from_msgpack(path) when '.json' from_json(path) else @@ -28,10 +26,6 @@ def from_json(path) def from_yaml(path) YAML.load_file(path) end - - def from_msgpack(path) - MessagePack.unpack(File.binread(path)) - end end end end diff --git a/spec/diver_down/definition_spec.rb b/spec/diver_down/definition_spec.rb index 9f3c15f..0b88475 100644 --- a/spec/diver_down/definition_spec.rb +++ b/spec/diver_down/definition_spec.rb @@ -159,66 +159,6 @@ end end - describe '#to_msgpack' do - it 'converts definition to message-pack' do - definition = described_class.new( - title: 'title', - sources: [ - DiverDown::Definition::Source.new( - source_name: 'a.rb', - dependencies: [ - DiverDown::Definition::Dependency.new( - source_name: 'b.rb', - method_ids: [ - DiverDown::Definition::MethodId.new( - name: 'A', - context: 'class', - paths: ['a.rb'] - ), - ] - ), - DiverDown::Definition::Dependency.new( - source_name: 'c.rb' - ), - ] - ), - ] - ) - - expect(definition.to_msgpack).to eq(MessagePack.pack(definition.to_h)) - end - - it 'can be loaded' do - definition = described_class.new( - title: 'title', - sources: [ - DiverDown::Definition::Source.new( - source_name: 'a.rb', - dependencies: [ - DiverDown::Definition::Dependency.new( - source_name: 'b.rb', - method_ids: [ - DiverDown::Definition::MethodId.new( - name: 'A', - context: 'class', - paths: ['a.rb'] - ), - ] - ), - DiverDown::Definition::Dependency.new( - source_name: 'c.rb' - ), - ] - ), - ] - ) - - msgpack = definition.to_msgpack - hash = DiverDown::Helper.deep_symbolize_keys(MessagePack.unpack(msgpack)) - expect(described_class.from_hash(hash)).to eq(definition) - end - end - describe '#hash' do it 'returns a hash' do definition = described_class.new( diff --git a/spec/diver_down/web/definition_loader_spec.rb b/spec/diver_down/web/definition_loader_spec.rb index a57775d..5b836ec 100644 --- a/spec/diver_down/web/definition_loader_spec.rb +++ b/spec/diver_down/web/definition_loader_spec.rb @@ -38,18 +38,6 @@ expect(loader.load_file(path)).to eq(definition) end - - it 'loads msgpack' do - dir = Dir.mktmpdir - path = File.join(dir, 'a.msgpack') - - definition = DiverDown::Definition.new(title: 'a') - File.write(path, definition.to_h.to_msgpack) - - loader = DiverDown::Web::DefinitionLoader.new - - expect(loader.load_file(path)).to eq(definition) - end end end end diff --git a/spec/diver_down/web_spec.rb b/spec/diver_down/web_spec.rb index 733a2b0..bc15d49 100644 --- a/spec/diver_down/web_spec.rb +++ b/spec/diver_down/web_spec.rb @@ -206,7 +206,7 @@ def assert_source(source, expected_ids) ), ] ) - File.binwrite(File.join(definition_dir, '1.msgpack'), definition.to_h.to_msgpack) + File.write(File.join(definition_dir, '1.yaml'), definition.to_h.to_yaml) get '/api/initialization_status.json'