diver_down 0.0.1.alpha19 → 0.0.1.alpha20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 522d18f65e8013914399ab7d9976a608f4b29d790dd68be6e8a2f87b60bae134
4
- data.tar.gz: aa4b7091a3cbc14fb7461fa21ba89669ea86d6c99040f076481075eae476ef61
3
+ metadata.gz: 04a303a12d7efeecfebf62390b2563cd4f88533a97aab5650ced5a5e23502318
4
+ data.tar.gz: e3630e7e7ee8e0ead48d2682fa0289e8cb197445d20afbca444b97184357e9c6
5
5
  SHA512:
6
- metadata.gz: a0353317f810ce03a550fbca3c2300206fa26109031c07f53e90efba3ccfdfa9811a222e61755938d07cc9ef0cf59a1e0a4a06d3500bbf928bb6fb58c009bf2b
7
- data.tar.gz: 15f9b21eccb93471c8c1e7ee6377649ba4caa3b6e71f847e549e058752a2a636259edb00e3133b19a404cda81a82737ea7a76851455c61b00a75a068b7f6f9df
6
+ metadata.gz: a64dd4352db77dc60abc2b8607d96f816bea28d1b98fc66044151e8fa156458d71b850eeaf8127395e545c194954bf0697c23cfb288f48154fee8d2deb185e71
7
+ data.tar.gz: 6f479d1348f1ff907d2d90752d51bd16113eab22c14e4800f9543d231c124d234d2d49aeb592626519121803b51bc98bb09b7bd14ddb650c8012283288d6e013
data/README.md CHANGED
@@ -122,9 +122,10 @@ This gem is specifically designed to analyze large applications with a modular m
122
122
 
123
123
  - `--definition-dir` Specifies the directory where the analysis results are stored.
124
124
  - `--metadata` Designates a path to save the results that include details on which module each file belongs to. If this option is not specified, the results will be temporarily stored in a default temporary file.
125
+ - `--blob-prefix` Specifies the prefix used to construct GitHub URLs for files, allowing direct access to the repository’s source code.
125
126
 
126
127
  ```sh
127
- bundle exec diver_down_web --definition-dir tmp/diver_down --metadata tmp/metadata.yml
128
+ bundle exec diver_down_web --definition-dir tmp/diver_down --metadata tmp/metadata.yml --blob-prefix https://github.com/alpaca-tc/diver_down/blob/main
128
129
  open http://localhost:8080
129
130
  ```
130
131
 
data/exe/diver_down_web CHANGED
@@ -14,7 +14,7 @@ option_parser = OptionParser.new do |opts|
14
14
  Usage: diver_down_web [options]
15
15
 
16
16
  Example:
17
- diver_down_web --definition-dir /path/to/definitions --metadata /path/to/metadata.yml
17
+ diver_down_web --definition-dir /path/to/definitions --metadata /path/to/metadata.yml --blob-prefix https://github.com/owner/repo/blob/master
18
18
 
19
19
  Options:
20
20
  BANNER
@@ -26,6 +26,10 @@ option_parser = OptionParser.new do |opts|
26
26
  opts.on('--metadata PATH', 'Path to the metadata.yml') do |path|
27
27
  options[:metadata] = path
28
28
  end
29
+
30
+ opts.on('--blob-prefix URL', 'blob url prefix for paths') do |url|
31
+ options[:blob_prefix] = url
32
+ end
29
33
  end
30
34
  option_parser.parse!(ARGV)
31
35
 
@@ -39,7 +43,8 @@ end
39
43
  app = Rack::JSONBodyParser.new(
40
44
  DiverDown::Web.new(
41
45
  definition_dir: options.fetch(:definition_dir),
42
- metadata: DiverDown::Web::Metadata.new(options[:metadata] || Tempfile.new(['metadata', '.yaml']).path)
46
+ metadata: DiverDown::Web::Metadata.new(options[:metadata] || Tempfile.new(['metadata', '.yaml']).path),
47
+ blob_prefix: option_parser.blob_prefix
43
48
  )
44
49
  )
45
50
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DiverDown
4
- VERSION = '0.0.1.alpha19'
4
+ VERSION = '0.0.1.alpha20'
5
5
  end
@@ -18,9 +18,10 @@ module DiverDown
18
18
 
19
19
  # @param store [DiverDown::Definition::Store]
20
20
  # @param metadata [DiverDown::Web::Metadata]
21
- def initialize(store:, metadata:)
21
+ def initialize(store:, metadata:, blob_prefix:)
22
22
  @store = store
23
23
  @metadata = metadata
24
+ @blob_prefix = blob_prefix
24
25
 
25
26
  reload
26
27
  end
@@ -186,6 +187,13 @@ module DiverDown
186
187
  )
187
188
  end
188
189
 
190
+ # GET /api/configuration.json
191
+ def configuration
192
+ json(
193
+ blob_prefix: @blob_prefix
194
+ )
195
+ end
196
+
189
197
  # POST /api/modules/:from_module/dependency_types/:to_module.json
190
198
  def update_module_dependency_type(from_module, to_module, dependency_type)
191
199
  module_dependency_map = fetch_module_dependency_map
@@ -29,9 +29,11 @@ module DiverDown
29
29
 
30
30
  # @param definition_dir [String]
31
31
  # @param metadata [DiverDown::Web::Metadata]
32
+ # @param blob_prefix [String]
32
33
  # @param store [DiverDown::Web::DefinitionStore]
33
- def initialize(definition_dir:, metadata:)
34
+ def initialize(definition_dir:, metadata:, blob_prefix:)
34
35
  @metadata = metadata
36
+ @blob_prefix = blob_prefix&.sub(%r{/+$}, '')
35
37
  @files_server = Rack::Files.new(File.join(WEB_DIR))
36
38
 
37
39
  definition_files = ::Dir["#{definition_dir}/**/*.{yml,yaml,msgpack,json}"].sort
@@ -47,7 +49,7 @@ module DiverDown
47
49
  request = Rack::Request.new(env)
48
50
 
49
51
  if @action&.store.object_id != self.class.store.object_id
50
- @action = DiverDown::Web::Action.new(store: self.class.store, metadata: @metadata)
52
+ @action = DiverDown::Web::Action.new(store: self.class.store, metadata: @metadata, blob_prefix: @blob_prefix)
51
53
  end
52
54
 
53
55
  case [request.request_method, request.path]
@@ -104,6 +106,8 @@ module DiverDown
104
106
  @action.pid
105
107
  in ['GET', %r{\A/api/initialization_status\.json\z}]
106
108
  @action.initialization_status(@total_definition_files_size)
109
+ in ['GET', %r{\A/api/configuration\.json\z}]
110
+ @action.configuration
107
111
  in ['GET', %r{\A/api/source_aliases\.json\z}]
108
112
  @action.source_aliases
109
113
  in ['POST', %r{\A/api/source_aliases\.json\z}]