posh-bundler 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 309277cc095b3194722d4d32d7d2bbc9a2f05b215062341fd2c6707628a283db
4
+ data.tar.gz: a7fde107875690b842cfe2fe5a506e5affef3ad5a32d656a3d1d72240e410ce6
5
+ SHA512:
6
+ metadata.gz: 728721cd026d187b172414a35c52ec19b730932ba4d8638adfaef537f7df69be33ecbba8001e416d8cc549c3cb615359a81a9990e68c542130e927ee6eecc367
7
+ data.tar.gz: e3590f45bd37b5302fba5e25e41c1029299b0a93a3065169686c8323f764f8b84d047ae6ce09da19c322e18828a2b2076b10ab3f752c721a25ba2e00839686c0
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Stanislav Katkov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,137 @@
1
+ # posh-bundler
2
+
3
+ Automatically run [`posh sync`](https://poshtui.com) after `bundle install` and
4
+ `bundle update`, so your local Ruby and gem documentation follows your project's
5
+ resolved dependencies.
6
+
7
+ This is an optional **local-development tool**. Install it on your development
8
+ machine; it is not needed to run or deploy your application, or in CI.
9
+
10
+ ## Requirements
11
+
12
+ - Ruby 2.7 or newer and Bundler >= 2.3.17, < 5.0.
13
+ - The POSH executable installed separately and available on your `PATH`.
14
+ - A Ruby project with a `Gemfile` and `Gemfile.lock`.
15
+
16
+ This gem is a small Bundler plugin, not the POSH executable. See the
17
+ [POSH setup guide](https://poshtui.com/docs) to install POSH.
18
+
19
+ ## Enable automatic sync
20
+
21
+ On your development machine, from the Ruby project where you want automatic sync:
22
+
23
+ ```sh
24
+ bundle plugin install posh-bundler
25
+ ```
26
+
27
+ Bundler installs the plugin locally when you run this inside a project. To enable
28
+ it for all of your projects, run the command outside any directory containing a
29
+ Gemfile, including its parent directories. Global plugins are scoped to your
30
+ user and Bundler's plugin configuration, not every Ruby installation on a machine.
31
+
32
+ After enabling it, use Bundler normally:
33
+
34
+ ```sh
35
+ bundle install
36
+ bundle update
37
+ bundle update rails
38
+ ```
39
+
40
+ The plugin runs `posh sync --project /path/to/project` once after the installer
41
+ succeeds and writes the lockfile. It also runs when all dependencies are already
42
+ installed. POSH reuses installed docsets; syncing still uses the network and runs
43
+ synchronously, so Bundler waits for it to finish.
44
+
45
+ If POSH is missing, cannot download docs, or exits unsuccessfully, the plugin
46
+ prints a warning and leaves Bundler's installation successful. Retry manually
47
+ with `posh sync`. Failed dependency installations do not trigger a sync.
48
+
49
+ The plugin does not add an application dependency or change your Gemfile. Do not
50
+ add it with `gem "posh-bundler"`: Bundler plugins need explicit installation.
51
+ For a shared, project-level opt-in, Bundler also supports this Gemfile directive:
52
+
53
+ ```ruby
54
+ plugin "posh-bundler"
55
+ ```
56
+
57
+ That installs and registers the plugin when contributors run `bundle install`.
58
+ They still need to install POSH separately. The directive is not automatically
59
+ limited to development: prefer the per-developer installation command above if
60
+ you do not want Bundler to install the plugin in CI or production.
61
+
62
+ ## Disable or remove
63
+
64
+ Skip automatic sync for one command, for example while offline, in CI, or during
65
+ a production deployment:
66
+
67
+ ```sh
68
+ POSH_AUTO_SYNC=0 bundle install
69
+ ```
70
+
71
+ If the plugin is present in CI or production, set `POSH_AUTO_SYNC=0` in those
72
+ environments. The plugin does not detect development or production automatically.
73
+ This skips syncing; Bundler can still install a plugin declared in the Gemfile.
74
+ Only the exact value `0` disables the hook. Manual `posh sync` commands are unaffected.
75
+
76
+ Remove a locally installed plugin from the project where you installed it:
77
+
78
+ ```sh
79
+ bundle plugin uninstall posh-bundler
80
+ ```
81
+
82
+ For a global installation, uninstall from outside a project. If you declared the
83
+ plugin in your Gemfile, remove that directive too, or Bundler will reinstall it.
84
+
85
+ ## Scope
86
+
87
+ The plugin uses Bundler's project root even when Bundler is invoked from a
88
+ subdirectory, and starts POSH outside Bundler's modified Ruby environment. It
89
+ targets the standard `Gemfile.lock` that POSH discovers in that project.
90
+
91
+ It does not run after `bundle lock`, `git pull`, or a branch switch. Run
92
+ `posh sync` manually after those operations if your dependencies changed.
93
+
94
+ ## Development
95
+
96
+ ```sh
97
+ bundle install
98
+ bundle exec rake test
99
+ bundle exec standardrb
100
+ bundle exec rake build
101
+ ```
102
+
103
+ Tests use isolated temporary projects and a fake POSH executable. They exercise
104
+ real Bundler plugin installation, dependency installation, and updates without
105
+ network access or changing your user-level plugin configuration.
106
+
107
+ With Bundler 4, you can try the plugin in another project before publishing it:
108
+
109
+ ```sh
110
+ bundle plugin install posh-bundler --path /absolute/path/to/posh-bundler
111
+ ```
112
+
113
+ Bundler runs a path-installed plugin directly from that directory. Reinstall it
114
+ after changing hook registrations in `plugins.rb`.
115
+
116
+ ## Releasing
117
+
118
+ Set the release version in `lib/posh_bundler/version.rb` and commit all changes.
119
+ Then run:
120
+
121
+ ```sh
122
+ bundle exec rake test
123
+ bundle exec standardrb
124
+ bundle exec rake release
125
+ ```
126
+
127
+ The release task uses Bundler's standard gem tasks. It builds the gem in `pkg/`,
128
+ checks for uncommitted changes, creates a `vVERSION` tag (for example, `v0.1.0`),
129
+ pushes the current branch and tag to its Git remote, and publishes the gem to
130
+ RubyGems. You need Git push access and RubyGems authentication with MFA enabled.
131
+
132
+ To build the gem without tagging, pushing, or publishing, use
133
+ `bundle exec rake build` instead.
134
+
135
+ ## License
136
+
137
+ [MIT](LICENSE).
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PoshBundler
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "posh_bundler/version"
4
+
5
+ module PoshBundler
6
+ def self.sync
7
+ return if ENV["POSH_AUTO_SYNC"] == "0"
8
+
9
+ project = Bundler.root.to_s
10
+
11
+ Bundler.with_unbundled_env do
12
+ system("posh", "sync", "--project", project, exception: true)
13
+ end
14
+ rescue => error
15
+ Bundler.ui.warn("POSH: documentation sync failed (#{error.message}). Run `posh sync` to retry.")
16
+ end
17
+ end
data/plugins.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/plugin/api"
4
+ require "posh_bundler"
5
+
6
+ Bundler::Plugin::API.hook("after-install-all") do |_dependencies|
7
+ PoshBundler.sync
8
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: posh-bundler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Stanislav Katkov
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: bundler
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 2.3.17
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '5.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: 2.3.17
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '5.0'
32
+ description: A best-effort Bundler plugin that runs posh sync once after bundle install
33
+ or bundle update, using the project's resolved dependencies.
34
+ email:
35
+ - contact@poshtui.com
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - LICENSE
41
+ - README.md
42
+ - lib/posh_bundler.rb
43
+ - lib/posh_bundler/version.rb
44
+ - plugins.rb
45
+ homepage: https://poshtui.com
46
+ licenses:
47
+ - MIT
48
+ metadata:
49
+ source_code_uri: https://github.com/skatkov/posh-bundler
50
+ documentation_uri: https://poshtui.com/docs#automatic-sync-with-bundler-optional
51
+ bug_tracker_uri: https://github.com/skatkov/posh-bundler/issues
52
+ rubygems_mfa_required: 'true'
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '2.7'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 4.0.19
68
+ specification_version: 4
69
+ summary: Keep POSH documentation in sync after Bundler installs and updates.
70
+ test_files: []