gemstar 1.0.2 → 1.1

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: b290f73ca813d6ef39789e23d883f3bd382fbdcc17f0803cd5fdc296d7f60582
4
- data.tar.gz: '058a2d17b98461a62d463ba673d170b621471e8f9693ea294da403382da5a759'
3
+ metadata.gz: bd80f7bf53281fd8f5b80138f9f564ff8e393ffaec44276168dc020765c6ae7a
4
+ data.tar.gz: 3d6b9c2f9a2e0955d6ace8c34100c05390cd9579aa8c8993361799450e36c625
5
5
  SHA512:
6
- metadata.gz: fe408b9d9259ab0771e41522238b35c259e624759ac27ffe013d689c76ebe0164905c5ee67bb7868e8cc43ff361568f854f8dccf2e513468176685a395bb9786
7
- data.tar.gz: 149884982e1e2d124f7ade0bf565604106a455db2bab04f6b3811b316fb0386f72ed3fdaa0969369c310e3811e7735d97d29c147f9263f32f62c6c2fcb0d7487
6
+ metadata.gz: 79d87285b961fdd88c6e898b2016d2bc4cc65b508a5f2c7480f865f0144b12ca5a53be3ff7833d48ed1a66cf4851134a6dbe41fdfc44d807f720e0c63fe52a05
7
+ data.tar.gz: 4803b9f217fef1aae5b671fdc5a356229697aba7d5cec4b2f1a05588d63a9ca88c38f876ed4aa1d2579451d6196097818a3d9aa866f8071004c45a9966c66a95
data/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.1
4
+
5
+ - Server: Add **JavaScript package support** to browse change logs for your project's packages. This currently
6
+ supports packages in `importmap.rb` and `package-lock.json`.
7
+ - Server: Change launch behavior to more reliably start cache warmer at launch.
8
+ - Server: Add `--open` option to open the server root in a local browser at launch.
9
+ - Server: Defer initial detail rendering so the page becomes interactive sooner on startup.
10
+ - Server: Persist the Details disclosure state between gem views.
11
+ - Server: Continue background warming with cached parsed release sections, not just raw fetched pages.
12
+ - Server: Improve GitHub release discovery with direct tag-page fallback and paginated GitHub tags support.
13
+ - Server: Prefer real changelog file entries over GitHub-derived placeholders when both exist.
14
+ - Server: Short gem description now rendered as markdown (for minitest gem).
15
+ - Server: Improve section parsing for simplecov and similar gems.
16
+ - Server: Increase limit for number of recent commits to show in menu to 100.
17
+ - Server: Add page icon.
18
+ - Server: Unless a port has been specified, server will now attempt binding from ports 2112 up.
19
+ - Diff: Add **JavaScript package support.** Like with Server, this supports `importmap.rb` and `package-lock.json`.
20
+ - Diff: Add `--ecosystem` parameter to choose js/gems/all.
21
+ - Diff: Add `--project` directive to point at the project root to diff.
22
+ - Diff: Add `--since` parameter to limit diff to commits since a specific date, e.g. `--since "3 weeks ago"`.
23
+ - Diff: Add "file://" to generated report output to fix click-to-open in certain terminal apps.
24
+ - Diff: Add list of considered git commits to diff report.
25
+ - Special cases for specific packages now moved into json configuration files.
26
+ - `gemstar` is now a shortcut for `gemstar server --open`.
27
+
28
+ ## 1.0.4
29
+
30
+ - Server: Improve layout, detail panel state management, and initial gem selection
31
+ - Server: Gem details now in collapsible panel
32
+ - Server: Arrow left/right navigation improved
33
+ - Enhance changelog parsing with GitHub tag and release support
34
+ - Extend `LockFile` with dependency requirements, spec sources, and platform parsing
35
+ - Refactor dependency processing to include platform and source details
36
+ - Refactor changelog parsing to merge GitHub release and changelog sections
37
+
38
+ ## 1.0.3
39
+
40
+ - Load our own WEBrick to avoid conflicts with hosting puma.rb etc.
41
+
3
42
  ## 1.0.2
4
43
 
5
44
  - General server performance improvements.
@@ -21,7 +60,6 @@
21
60
  - Removed Railtie from this gem.
22
61
  - Improve how git root dir is determined.
23
62
 
24
-
25
63
  ## 0.0.2
26
64
 
27
65
  - Diff: Fix regex warnings shown in terminal.
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![JRuby Build](https://github.com/FDj/gemstar/workflows/JRuby%20Build/badge.svg)](https://github.com/FDj/gemstar/actions)
4
4
 
5
5
  # Gemstar
6
- A very preliminary gem to help you keep track of your gems.
6
+ Helps you keep track of your gems and JavaScript packages.
7
7
 
8
8
  ## Installation
9
9
 
@@ -34,17 +34,23 @@ gemstar server
34
34
 
35
35
  By default, the server listens to http://127.0.0.1:2112/
36
36
 
37
+ To open the root page in your browser after startup:
38
+
39
+ ```shell
40
+ gemstar server --open
41
+ ```
42
+
37
43
 
38
44
  ### gemstar diff
39
45
 
40
- Run this after you've updated your gems.
46
+ Run this after you've updated your dependencies.
41
47
 
42
48
  ```shell
43
49
  # in your project directory, after bundle update:
44
50
  gemstar diff
45
51
  ```
46
52
 
47
- This will generate an html diff report with changelog entries for each gem that was updated:
53
+ This will generate an html diff report with changelog entries for each updated package:
48
54
 
49
55
  ![Gemstar diff command output](docs/diff.png)
50
56
 
@@ -54,12 +60,31 @@ You can also specify from and to hashes or tags to generate a diff report for a
54
60
  gemstar diff --from 8e3aa96b7027834cdbabc0d8cbd5f9455165e930 --to HEAD
55
61
  ```
56
62
 
63
+ To use a time range instead of choosing the starting commit yourself:
64
+
65
+ ```shell
66
+ gemstar diff --project ~/Code/my-app --since "3 weeks"
67
+ ```
68
+
57
69
  To examine a specific Gemfile.lock, pass it like this:
58
70
 
59
71
  ```shell
60
72
  gemstar diff --lockfile=~/MyProject/Gemfile.lock
61
73
  ```
62
74
 
75
+ To diff a project from anywhere, pass the project directory or a supported project file. In project mode, gemstar includes Ruby gems plus JS packages from `importmap.rb` and `package-lock.json` when present:
76
+
77
+ ```shell
78
+ gemstar diff --project ~/Code/my-app
79
+ ```
80
+
81
+ To filter a project diff down to one ecosystem:
82
+
83
+ ```shell
84
+ gemstar diff --project ~/Code/my-app --ecosystem js
85
+ gemstar diff --project ~/Code/my-app --ecosystem gems
86
+ ```
87
+
63
88
  To write markdown instead of html:
64
89
 
65
90
  ```shell
data/bin/gemstar CHANGED
@@ -4,4 +4,8 @@
4
4
  $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
5
5
  require_relative "../lib/gemstar"
6
6
 
7
- Gemstar::CLI.start(ARGV)
7
+ if ARGV.empty?
8
+ Gemstar::Commands::Server.new(open: true).run
9
+ else
10
+ Gemstar::CLI.start(ARGV)
11
+ end
@@ -21,47 +21,60 @@ module Gemstar
21
21
  @completed_count = 0
22
22
  end
23
23
 
24
- def enqueue_many(gem_names)
25
- names = gem_names.uniq
24
+ def enqueue_many(package_states)
25
+ states = normalize_package_states(package_states)
26
26
 
27
27
  @mutex.synchronize do
28
- names.each do |gem_name|
29
- next if @completed.include?(gem_name) || @queued.include?(gem_name) || @in_progress.include?(gem_name)
28
+ states.each do |package_state|
29
+ key = package_key(package_state)
30
+ next if @completed.include?(key) || @queued.include?(key) || @in_progress.include?(key)
30
31
 
31
- @queue << gem_name
32
- @queued << gem_name
32
+ @queue << package_state
33
+ @queued << key
33
34
  end
34
- @total += names.count
35
+ @total += states.count
35
36
  start_workers_unlocked unless @started
36
37
  end
37
38
 
38
- log "Background cache refresh queued for #{names.count} gems."
39
+ log "Background cache refresh queued for #{states.count} packages."
39
40
  @condition.broadcast
40
41
  self
41
42
  end
42
43
 
43
- def prioritize(gem_name)
44
+ def prioritize(package_name)
44
45
  @mutex.synchronize do
45
- return if @completed.include?(gem_name) || @in_progress.include?(gem_name)
46
+ existing = @queue.find do |item|
47
+ item[:name] == package_name || item.dig(:source, :package_name) == package_name
48
+ end
46
49
 
47
- if @queued.include?(gem_name)
48
- @queue.delete(gem_name)
50
+ if existing
51
+ key = package_key(existing)
52
+ return if @completed.include?(key) || @in_progress.include?(key)
53
+ @queue.delete(existing)
54
+ @queue.unshift(existing)
49
55
  else
50
- @queued << gem_name
56
+ synthetic = {
57
+ name: package_name,
58
+ package_scope: "gems",
59
+ source: {}
60
+ }
61
+ key = package_key(synthetic)
62
+ return if @completed.include?(key) || @in_progress.include?(key)
63
+ @queued << key
64
+ @queue.unshift(synthetic)
51
65
  @total += 1
52
66
  end
53
-
54
- @queue.unshift(gem_name)
55
67
  start_workers_unlocked unless @started
56
68
  end
57
69
 
58
- log "Prioritized #{gem_name}"
70
+ log "Prioritized #{package_name}"
59
71
  @condition.broadcast
60
72
  end
61
73
 
62
- def pending?(gem_name)
74
+ def pending?(package_name)
63
75
  @mutex.synchronize do
64
- @queued.include?(gem_name) || @in_progress.include?(gem_name)
76
+ @queue.any? { |item| item[:name] == package_name || item.dig(:source, :package_name) == package_name } ||
77
+ @in_progress.any? { |key| key.end_with?(":#{package_name}") }
65
78
  end
66
79
  end
67
80
 
@@ -80,47 +93,92 @@ module Gemstar
80
93
  Thread.current.name = "gemstar-cache-worker" if Thread.current.respond_to?(:name=)
81
94
 
82
95
  loop do
83
- gem_name = @mutex.synchronize do
96
+ package_state = @mutex.synchronize do
84
97
  while @queue.empty?
85
98
  @condition.wait(@mutex)
86
99
  end
87
100
 
88
- next_gem = @queue.shift
89
- @queued.delete(next_gem)
90
- @in_progress << next_gem
91
- next_gem
101
+ next_package = @queue.shift
102
+ key = package_key(next_package)
103
+ @queued.delete(key)
104
+ @in_progress << key
105
+ next_package
92
106
  end
93
107
 
94
- warm_cache_for_gem(gem_name)
108
+ warm_cache_for_package(package_state)
95
109
 
96
110
  current = @mutex.synchronize do
97
- @in_progress.delete(gem_name)
98
- @completed << gem_name
111
+ key = package_key(package_state)
112
+ @in_progress.delete(key)
113
+ @completed << key
99
114
  @completed_count += 1
100
115
  end
101
116
 
102
- log_progress(gem_name, current)
117
+ log_progress(package_label(package_state), current)
103
118
  end
104
119
  end
105
120
 
106
- def warm_cache_for_gem(gem_name)
107
- metadata = Gemstar::RubyGemsMetadata.new(gem_name)
108
- metadata.meta
109
- metadata.repo_uri
110
- Gemstar::ChangeLog.new(metadata).sections
121
+ def warm_cache_for_package(package_state)
122
+ metadata = metadata_adapter_for(package_state)
123
+ return unless metadata
124
+
125
+ metadata.warm_cache(versions: package_versions(package_state))
111
126
  rescue StandardError => e
112
- log "Cache refresh failed for #{gem_name}: #{e.class}: #{e.message}"
127
+ log "Cache refresh failed for #{package_label(package_state)}: #{e.class}: #{e.message}"
113
128
  end
114
129
 
115
- def log_progress(gem_name, current)
130
+ def log_progress(package_name, current)
116
131
  return unless @debug
117
132
  return unless current <= 5 || (current % 25).zero?
118
133
 
119
- log "Background cache refresh #{current}/#{@total}: #{gem_name}"
134
+ log "Background cache refresh #{current}/#{@total}: #{package_name}"
120
135
  end
121
136
 
122
137
  def log(message)
123
138
  @io.puts(message)
124
139
  end
140
+
141
+ def normalize_package_states(package_states)
142
+ Array(package_states).filter_map do |package_state|
143
+ next unless package_state.is_a?(Hash)
144
+
145
+ package_state
146
+ end.uniq { |package_state| package_key(package_state) }
147
+ end
148
+
149
+ def package_key(package_state)
150
+ scope = package_state[:package_scope].to_s
151
+ source_type = package_state[:package_source_file].to_s
152
+ package_name = package_state.dig(:source, :package_name) || package_state[:name]
153
+ "#{scope}:#{source_type}:#{package_name}"
154
+ end
155
+
156
+ def package_label(package_state)
157
+ package_state.dig(:source, :package_name) || package_state[:name]
158
+ end
159
+
160
+ def package_versions(package_state)
161
+ [
162
+ package_state[:old_version],
163
+ package_state[:new_version],
164
+ package_state[:raw_old_version],
165
+ package_state[:raw_new_version],
166
+ package_state.dig(:source, :package_version)
167
+ ].compact
168
+ end
169
+
170
+ def metadata_adapter_for(package_state)
171
+ if package_state[:package_scope] == "js"
172
+ provider_gem = package_state.dig(:source, :provider_gem)
173
+ return Gemstar::RubyGemsMetadata.new(provider_gem) unless provider_gem.to_s.empty?
174
+
175
+ package_name = package_state.dig(:source, :package_name) || package_state[:name]
176
+ return nil if package_name.to_s.empty?
177
+
178
+ return Gemstar::NpmMetadata.new(package_name)
179
+ end
180
+
181
+ Gemstar::RubyGemsMetadata.new(package_state[:name])
182
+ end
125
183
  end
126
184
  end