namo.rb 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 +4 -4
- data/CHANGELOG +13 -0
- data/README.md +1 -1
- data/bin/namo +18 -7
- data/lib/Namo/VERSION.rb +1 -1
- data/test/namo_command_test.rb +23 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d48f8f03326a75b23dfcf737b344f2860656d8bfe33b919f1cfb6e25c3480846
|
|
4
|
+
data.tar.gz: e57e139416c1fcb645eeeab6cc381823843e039b09287de63abafc92126632ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ef4a3dbb43016f282d9aac9c6144e77c7b5c442a4ab2fc7a2ba4caf8a32c6624580832857b3e6729363cb771bf6cbb18c0e5b4090e9054241cab6124535cdea0
|
|
7
|
+
data.tar.gz: d04c78da92efd9ff78e9fb5cec14b50cdcc5fc2eae0bc9fd0b92cebfdef6262da463c1c562ca182a12142bfd7d375b7cbc93388e57b691a00fa4475ea26365a8
|
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
|
-
|
|
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
|
-
#
|
|
43
|
-
# on the load path
|
|
44
|
-
#
|
|
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
data/test/namo_command_test.rb
CHANGED
|
@@ -22,11 +22,15 @@ describe 'bin/namo' do
|
|
|
22
22
|
_(output).must_match(/console/)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
|
|
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).
|
|
29
|
-
_(output).must_match(
|
|
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
|
|
38
|
-
#
|
|
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).
|
|
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
|
|