namo 0.32.2 → 0.32.3

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: 175cb09542235c37007cf26ce5146a1c4a92b3ed19f8d30c261e225994f2881b
4
- data.tar.gz: 95eda631ef9ce13aa633c9c6fc17ea1ee6141dc234604a6add9a2912d0a9de78
3
+ metadata.gz: 1cd9dd8978eec2325228fe1c867977bb3a7d3392d97884da2cd92b497f7defd3
4
+ data.tar.gz: 71c01853d939dfecfb060e796b16ee8f29e050e2509657a68078f136f752299b
5
5
  SHA512:
6
- metadata.gz: 4b80fbc059a6824450688df197ca403fd89a74deb2a53f3105985fa4356bec340afdb812eb935906bb1583c52378e5ee784efed155c3c7043c7d353ff4b53a79
7
- data.tar.gz: 9fbe3169c001aac490cd012c1005c92da2a714faed70db57030d36332de589e9c9c424b37ddd304f4055904c633544d3f598294c28327fcf106f44aae645cb1d
6
+ metadata.gz: 9c8f2926ab8e9f94c06a72873c0b20d65754fc1bc5a08f76aeac791bcbb24b12c8909a89d62d7a89df313115f575821eea707ee7836df2d4fe0e682ea9794efc
7
+ data.tar.gz: 9cea051b58185b3ba6d64d737d1d2da6f72378d628cfd7fe196e80f82619cc5ccfcfc06af02ba3400500d45b62dc85e6c51ae92e4f48e2a2570491fb6328a40b
data/CHANGELOG CHANGED
@@ -1,5 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 20260828
4
+
5
+ 0.32.3: ~ install.sh: + ruby-install, for a machine with no package manager at all; the handover is to a clone's own bin/namo where the script was run from one.
6
+
7
+ 1. ~ install.sh: + install_ruby_install, + ruby_from_ruby_install. Where no package manager is found and Homebrew is declined, ruby-install is offered — fetched from its latest release rather than a pinned version, built with make as root, and used to build Ruby. It is the last thing tried and the only route here which builds Ruby rather than fetching it.
8
+ 2. ~ install.sh: ruby-install leaves its Ruby under ~/.rubies, which nothing puts on the PATH — chruby's job, and chruby is not there either — so that directory is added to the PATH of the run and offered to the shell's configuration, as the gem's own directory is.
9
+ 3. ~ install.sh: + wants_on_path, and add_to_path takes none. A machine taking the ruby-install route has a Ruby under ~/.rubies and its gems elsewhere, so two directories want adding; they are gathered as they are found and the shell configuration is written to once, naming both, rather than the same question being asked twice seconds apart. Each is put on the running PATH as it is found, so that `namo setup` happens whether or not the file is written to.
10
+ 4. ~ install.sh: install_namo runs gem install rather than skipping where the command is present. gem install is idempotent for a version already installed and fetches a newer one where there is one, so this is what makes a second run an upgrade.
11
+ 5. ~ bin/namo: + gem_version, + report. Each check states the gem, its version and its status on one line, where the announcement had been a sentence carrying no version — the version being the part neither script had said. install.sh reports in the same shape, and its namo step speaks only where something changed — installed, or upgraded from a version — since gem install says "Successfully installed" whether or not it did anything, and `namo setup` reports the gem and its version a moment later regardless.
12
+ 6. ~ install.sh: + repository, and hand_over takes the clone it was given. install_namo is the bootstrap for the handover and nothing else — a way to have a namo command to run — so a script run from a checkout hands over to that checkout's bin/namo and leaves the gem to `namo setup`, which installs it as its own first act. A checkout with the gem not yet installed now works as it stands, and the gem is named once rather than by both scripts in turn. 0.32.1 had taken the path lookup out for being unconditional, which failed piped from curl where the working directory is not a checkout; it is guarded now on $0 being a readable file beside both bin/namo and the gemspec, none of which holds for the shell's own name, so the curl route finds nothing and installs the gem as it did.
13
+ 7. ~ Namo::VERSION: /0.32.2/0.32.3/
14
+
15
+
3
16
  ## 20260828
4
17
 
5
18
  0.32.2: ~ install.sh: the one command ends with namo runnable from anywhere.
data/README.md CHANGED
@@ -18,7 +18,7 @@ Or in your Gemfile:
18
18
  gem 'namo'
19
19
  ```
20
20
 
21
- Or from nothing at all — Ruby, the gem, and the gems its scripts want, each step skipped where it is already there. Where Ruby is missing, whichever package manager is already installed supplies it — Homebrew, MacPorts, apt, dnf, pacman or zypper; where none is, you are asked before Homebrew is installed; `-y` answers yes in advance, and a machine with nobody at the keyboard is taken to have said no. Where the gem's own directory is not on the PATH, it offers to add it to your shell's configuration, so that a new shell has `namo` in it:
21
+ Or from nothing at all — Ruby, the gem, and the gems its scripts want, each step skipped where it is already there. Where Ruby is missing, whichever package manager is already installed supplies it — Homebrew, MacPorts, apt, dnf, pacman or zypper; where none is, you are asked before Homebrew is installed, and then before ruby-install is built from source; `-y` answers yes in advance, and a machine with nobody at the keyboard is taken to have said no. Where the gem's own directory is not on the PATH, it offers to add it to your shell's configuration, so that a new shell has `namo` in it:
22
22
 
23
23
  ```
24
24
  sh -c "$(curl -fsSL https://raw.githubusercontent.com/thoran/namo/master/install.sh)"
data/bin/namo CHANGED
@@ -31,20 +31,31 @@ def gem_installed?(name)
31
31
  system("gem list -i #{name} > /dev/null 2>&1")
32
32
  end
33
33
 
34
+ def gem_version(name)
35
+ Gem::Specification.find_all_by_name(name).map(&:version).max
36
+ rescue StandardError
37
+ nil
38
+ end
39
+
40
+ def report(name, status)
41
+ puts format(' %-11s %-8s %s', name, gem_version(name) || '-', status)
42
+ end
43
+
44
+ # The status and the version, one line per check. "already installed" on its own
45
+ # was the second script announcing what install.sh had just done; the version is
46
+ # what neither script has said, and is the reason to look.
34
47
  def install_gem(name)
35
48
  if gem_installed?(name)
36
- puts "#{name} is already installed!"
49
+ report(name, 'already installed')
37
50
  else
38
51
  run("gem install #{name}")
52
+ report(name, 'installed')
39
53
  end
40
54
  end
41
55
 
42
- # Namo itself first: arriving by `git clone` leaves the source on disk and nothing
43
- # on the load path, so the gem is what makes `require 'namo'` work from anywhere
44
- # else. Arriving by `gem install namo` has it already, and the step says so.
45
- #
46
- # measurand is the one the demo asks for and does without: its uncertainty section
47
- # skips itself when it is missing, and every other section runs regardless.
56
+ # namo itself first: arriving by `git clone`, or by install.sh before the gem is
57
+ # there, leaves nothing on the load path. measurand the demo asks for and does
58
+ # without, its uncertainty section skipping itself where it is missing.
48
59
  def setup
49
60
  install_gem('namo')
50
61
  install_gem('measurand')
data/lib/Namo/VERSION.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # Namo::VERSION
3
3
 
4
4
  class Namo
5
- VERSION = '0.32.2'
5
+ VERSION = '0.32.3'
6
6
  end
@@ -22,11 +22,15 @@ describe 'bin/namo' do
22
22
  _(output).must_match(/console/)
23
23
  end
24
24
 
25
- it "reports rather than acts where a gem is already there" do
25
+ # A line per check carrying the status and the version. "already installed" on
26
+ # its own repeated what install.sh had just done; the version is the part
27
+ # neither script has said, and the reason to read the line at all.
28
+ it "reports the status and version of each gem it checks" do
26
29
  output = namo('setup')
27
30
  _($?.success?).must_equal true
28
- _(output).must_match(/namo is already installed!/)
29
- _(output).must_match(/measurand is already installed!/)
31
+ _(output.lines.length).must_equal 2
32
+ _(output).must_match(/^\s+namo\s+\d+\.\d+\.\d+\s+already installed$/)
33
+ _(output).must_match(/^\s+measurand\s+\d+\.\d+\.\d+\s+already installed$/)
30
34
  end
31
35
 
32
36
  # install.sh is the part a Ruby script cannot do — the Ruby the script would be
@@ -34,8 +38,11 @@ describe 'bin/namo' do
34
38
  # syntax is asserted and its body is not run: a test which executed it on a
35
39
  # machine without Ruby would install Ruby.
36
40
  #
37
- # It hands over by name rather than by path, which is what lets it run piped
38
- # from curl an assertion that it finds nothing by SCRIPT_DIR.
41
+ # It hands over to a clone's own bin/namo where it was run from one, and fetches
42
+ # the gem only where it was not: the gem is the bootstrap for the handover rather
43
+ # than a second opinion about what wants installing. Piped from curl there is no
44
+ # clone to find, the guard being that $0 is a readable file at all, which the
45
+ # shell's own name is not.
39
46
  #
40
47
  # It installs Homebrew only through `agreed`, which answers no unless -y was
41
48
  # given or somebody is there to say yes. What is asserted is that the curl of
@@ -52,8 +59,18 @@ describe 'bin/namo' do
52
59
  _(body).must_match(/command -v #{manager}/)
53
60
  end
54
61
  _(body).must_match(/ruby_routes/)
62
+ _(body).must_match(/install_ruby_install/)
63
+ # One prompt and one line however many directories want adding: the shell
64
+ # configuration is written to once, not once per directory.
65
+ _(body).must_match(/wants_on_path/)
66
+ _(body.scan(/>> "\$file"/).length).must_equal 1
67
+ # The tag is resolved from the latest release rather than pinned, so that the
68
+ # branch does not rot against a version.
69
+ _(body).wont_match(/ruby-install-0\.\d+\.\d+\.tar\.gz/)
55
70
  _(body).must_match(/namo setup/)
56
- _(body).wont_match(/SCRIPT_DIR/)
71
+ _(body).must_match(/repository\(\) \{\n\s+\[ -f "\$0" \]/)
72
+ _(body).must_match(%r{"\$clone/bin/namo" setup})
73
+ _(body).must_match(/\[ -n "\$clone" \] \|\| install_namo/)
57
74
  _(body).must_match(/elif agreed .*Install Homebrew\?.*; then\n\s+\/bin\/bash -c/)
58
75
  end
59
76
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: namo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.32.2
4
+ version: 0.32.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoran