lace 0.5.3 → 0.6.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 +4 -4
- data/bin/lace +31 -44
- data/lib/cmd/activate.rb +4 -2
- data/lib/cmd/apply.rb +33 -11
- data/lib/cmd/deactivate.rb +4 -2
- data/lib/cmd/diff.rb +10 -7
- data/lib/cmd/fetch.rb +6 -11
- data/lib/cmd/help.rb +31 -23
- data/lib/cmd/inspect.rb +42 -17
- data/lib/cmd/list.rb +33 -10
- data/lib/cmd/remove.rb +4 -2
- data/lib/cmd/setup.rb +10 -2
- data/lib/cmd/update.rb +4 -1
- data/lib/cmd/upgrade.rb +10 -7
- data/lib/cmd/validate.rb +55 -65
- data/lib/cmd/where.rb +5 -8
- data/lib/extend/ARGV.rb +24 -32
- data/lib/extend/pathname.rb +29 -33
- data/lib/lace/exceptions.rb +56 -25
- data/lib/lace/package/facts.rb +57 -44
- data/lib/lace/package/package.rb +59 -40
- data/lib/lace/package/pkg_lace.rb +73 -0
- data/lib/lace/package/utils.rb +114 -11
- data/lib/lace/package.rb +1 -0
- data/lib/lace/utils.rb +55 -47
- data/lib/lace/version.rb +1 -1
- data/lib/lace.rb +18 -13
- metadata +3 -3
- data/lib/lace/package_cli.rb +0 -4
data/lib/lace/utils.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#Copyright 2009-2014 Max Howell and other contributors.
|
|
1
|
+
# Copyright 2009-2014 Max Howell and other contributors.
|
|
2
2
|
#
|
|
3
|
-
#Redistribution and use in source and binary forms, with or without
|
|
4
|
-
#modification, are permitted provided that the following conditions
|
|
5
|
-
#are met:
|
|
3
|
+
# Redistribution and use in source and binary forms, with or without
|
|
4
|
+
# modification, are permitted provided that the following conditions
|
|
5
|
+
# are met:
|
|
6
6
|
#
|
|
7
7
|
# 1. Redistributions of source code must retain the above copyright
|
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
|
@@ -10,27 +10,27 @@
|
|
|
10
10
|
# notice, this list of conditions and the following disclaimer in the
|
|
11
11
|
# documentation and/or other materials provided with the distribution.
|
|
12
12
|
#
|
|
13
|
-
#THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
14
|
-
#IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
15
|
-
#OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
16
|
-
#IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
17
|
-
#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
18
|
-
#NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
19
|
-
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
20
|
-
#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
21
|
-
#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
22
|
-
#THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
13
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
14
|
+
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
15
|
+
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
16
|
+
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
17
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
18
|
+
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
19
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
20
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
21
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
22
|
+
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
23
23
|
|
|
24
24
|
class Tty
|
|
25
25
|
class << self
|
|
26
|
-
def blue
|
|
27
|
-
def white
|
|
28
|
-
def red
|
|
29
|
-
def yellow
|
|
30
|
-
def reset
|
|
31
|
-
def em
|
|
32
|
-
def green
|
|
33
|
-
def gray
|
|
26
|
+
def blue = bold(34)
|
|
27
|
+
def white = bold(39)
|
|
28
|
+
def red = underline(31)
|
|
29
|
+
def yellow = underline(33)
|
|
30
|
+
def reset = escape(0)
|
|
31
|
+
def em = underline(39)
|
|
32
|
+
def green = color(92)
|
|
33
|
+
def gray = bold(30)
|
|
34
34
|
|
|
35
35
|
def width
|
|
36
36
|
`/usr/bin/tput cols`.strip.to_i
|
|
@@ -42,48 +42,51 @@ class Tty
|
|
|
42
42
|
|
|
43
43
|
private
|
|
44
44
|
|
|
45
|
-
def color
|
|
45
|
+
def color(n)
|
|
46
46
|
escape "0;#{n}"
|
|
47
47
|
end
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
def bold(n)
|
|
49
50
|
escape "1;#{n}"
|
|
50
51
|
end
|
|
51
|
-
|
|
52
|
+
|
|
53
|
+
def underline(n)
|
|
52
54
|
escape "4;#{n}"
|
|
53
55
|
end
|
|
54
|
-
|
|
56
|
+
|
|
57
|
+
def escape(n)
|
|
55
58
|
"\033[#{n}m" if $stdout.tty?
|
|
56
59
|
end
|
|
57
60
|
end
|
|
58
61
|
end
|
|
59
62
|
|
|
60
|
-
def ohai
|
|
63
|
+
def ohai(title, *sput)
|
|
61
64
|
title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?
|
|
62
65
|
puts "#{Tty.blue}==>#{Tty.white} #{title}#{Tty.reset}"
|
|
63
66
|
puts sput unless sput.empty?
|
|
64
67
|
end
|
|
65
68
|
|
|
66
|
-
def oh1
|
|
69
|
+
def oh1(title)
|
|
67
70
|
title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?
|
|
68
71
|
puts "#{Tty.green}==>#{Tty.white} #{title}#{Tty.reset}"
|
|
69
72
|
end
|
|
70
73
|
|
|
71
|
-
def opoo
|
|
72
|
-
|
|
74
|
+
def opoo(warning)
|
|
75
|
+
$stderr.puts "#{Tty.red}Warning#{Tty.reset}: #{warning}"
|
|
73
76
|
end
|
|
74
77
|
|
|
75
|
-
def onoe
|
|
78
|
+
def onoe(error)
|
|
76
79
|
lines = error.to_s.split("\n")
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
$stderr.puts "#{Tty.red}Error#{Tty.reset}: #{lines.shift}"
|
|
81
|
+
$stderr.puts lines unless lines.empty?
|
|
79
82
|
end
|
|
80
83
|
|
|
81
|
-
def ofail
|
|
84
|
+
def ofail(error)
|
|
82
85
|
onoe error
|
|
83
86
|
Lace.failed = true
|
|
84
87
|
end
|
|
85
88
|
|
|
86
|
-
def odie
|
|
89
|
+
def odie(error)
|
|
87
90
|
onoe error
|
|
88
91
|
exit 1
|
|
89
92
|
end
|
|
@@ -96,13 +99,19 @@ def determine_os
|
|
|
96
99
|
end
|
|
97
100
|
end
|
|
98
101
|
|
|
99
|
-
module Lace
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
module Lace
|
|
103
|
+
extend self
|
|
104
|
+
|
|
105
|
+
def system(cmd, *args)
|
|
106
|
+
puts "#{cmd} #{args * ' '}" if ARGV.verbose?
|
|
102
107
|
fork do
|
|
103
108
|
yield if block_given?
|
|
104
|
-
args.collect!{|arg| arg.to_s}
|
|
105
|
-
|
|
109
|
+
args.collect! { |arg| arg.to_s }
|
|
110
|
+
begin
|
|
111
|
+
exec(cmd.to_s, *args)
|
|
112
|
+
rescue StandardError
|
|
113
|
+
nil
|
|
114
|
+
end
|
|
106
115
|
exit! 1 # never gets here unless exec failed
|
|
107
116
|
end
|
|
108
117
|
Process.wait
|
|
@@ -111,15 +120,15 @@ module Lace extend self
|
|
|
111
120
|
end
|
|
112
121
|
|
|
113
122
|
# Kernel.system but with exceptions
|
|
114
|
-
def safe_system
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
123
|
+
def safe_system(cmd, *args)
|
|
124
|
+
return if Lace.system cmd, *args
|
|
125
|
+
|
|
126
|
+
args = args.map { |arg| arg.to_s.gsub ' ', '\\ ' } * ' '
|
|
127
|
+
raise ErrorDuringExecution, "Failure while executing: #{cmd} #{args}"
|
|
119
128
|
end
|
|
120
129
|
|
|
121
130
|
# prints no output
|
|
122
|
-
def quiet_system
|
|
131
|
+
def quiet_system(cmd, *args)
|
|
123
132
|
Lace.system(cmd, *args) do
|
|
124
133
|
# Redirect output streams to `/dev/null` instead of closing as some programs
|
|
125
134
|
# will fail to execute if they can't write to an open stream.
|
|
@@ -127,4 +136,3 @@ def quiet_system cmd, *args
|
|
|
127
136
|
$stderr.reopen('/dev/null')
|
|
128
137
|
end
|
|
129
138
|
end
|
|
130
|
-
|
data/lib/lace/version.rb
CHANGED
data/lib/lace.rb
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require
|
|
1
|
+
require 'lace/utils'
|
|
2
|
+
require 'lace/exceptions'
|
|
3
|
+
require 'lace/version'
|
|
4
|
+
|
|
5
|
+
module Lace
|
|
6
|
+
extend self
|
|
4
7
|
|
|
5
|
-
module Lace extend self
|
|
6
8
|
attr_accessor :failed
|
|
7
|
-
|
|
9
|
+
alias failed? failed
|
|
8
10
|
|
|
9
11
|
def self.pkgs_folder
|
|
10
|
-
packages_folder = Pathname.new(ENV
|
|
12
|
+
packages_folder = Pathname.new(ENV.fetch('HOME', nil)).join('.lace.pkgs')
|
|
11
13
|
|
|
12
|
-
if ENV[
|
|
13
|
-
packages_folder = Pathname.new(ENV["LACE_FOLDER"])
|
|
14
|
-
end
|
|
14
|
+
packages_folder = Pathname.new(ENV['LACE_FOLDER']) if ENV['LACE_FOLDER']
|
|
15
15
|
packages_folder
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
# Load a command file. False when no such command exists; a LoadError
|
|
19
|
+
# from inside the command file is a real bug and propagates.
|
|
20
|
+
def self.require_command(path)
|
|
21
|
+
require path
|
|
22
|
+
true
|
|
23
|
+
rescue LoadError => e
|
|
24
|
+
raise unless e.path == path
|
|
25
|
+
|
|
26
|
+
false
|
|
20
27
|
end
|
|
21
28
|
end
|
|
22
|
-
|
|
23
|
-
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lace
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kai Richard Koenig
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-12-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Lace lets you manage your dotfiles when using them on multiple machines
|
|
14
14
|
email: kai.richard.koenig@gmail.com
|
|
@@ -40,8 +40,8 @@ files:
|
|
|
40
40
|
- lib/lace/package.rb
|
|
41
41
|
- lib/lace/package/facts.rb
|
|
42
42
|
- lib/lace/package/package.rb
|
|
43
|
+
- lib/lace/package/pkg_lace.rb
|
|
43
44
|
- lib/lace/package/utils.rb
|
|
44
|
-
- lib/lace/package_cli.rb
|
|
45
45
|
- lib/lace/utils.rb
|
|
46
46
|
- lib/lace/version.rb
|
|
47
47
|
homepage: https://github.com/kairichard/lace
|
data/lib/lace/package_cli.rb
DELETED