lace 0.5.0 → 0.5.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 +4 -4
- data/lib/cmd/list.rb +4 -22
- data/lib/lace/package/package.rb +8 -5
- data/lib/lace/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46881767c22f451c4e42104713158a054acfe41eee483ab2cac43416d8e99738
|
|
4
|
+
data.tar.gz: b8d483c8695e034ddd022522362b8aaad46a9947c98bf02bd92f9880cbda3280
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3200530a5a2007710f79508f5027c1caa72bf08377f296a6adb6b94db404a7b6dca9abbcd5dfe7d9e8bc1945741c9f61299e06cbf7e15a5ac74e2ced4d81ee1e
|
|
7
|
+
data.tar.gz: 0a6019e2cae178f0a276ecc943466445f493b6a30df7f0ae5f36db9a344b2641bfde336cced8e6be47e02b979ed7d749632d6e0057e544a65d21b50f3c219242
|
data/lib/cmd/list.rb
CHANGED
|
@@ -2,38 +2,20 @@ require 'lace/package'
|
|
|
2
2
|
|
|
3
3
|
module Lace extend self
|
|
4
4
|
|
|
5
|
-
def linked_files
|
|
6
|
-
home_dir = Pathname.new ENV["HOME"]
|
|
7
|
-
find_links home_dir
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def find_links dir
|
|
11
|
-
dir.children.map do |path|
|
|
12
|
-
if path.directory? && !path.symlink?
|
|
13
|
-
find_links path
|
|
14
|
-
else
|
|
15
|
-
File.readlink path if path.symlink?
|
|
16
|
-
end
|
|
17
|
-
end.flatten.compact.uniq
|
|
18
|
-
end
|
|
19
|
-
|
|
20
5
|
def active_packages
|
|
21
|
-
|
|
22
|
-
Pathname.new(File.dirname(path)).basename.to_s
|
|
23
|
-
end.uniq
|
|
6
|
+
installed_packages.select(&:is_active?)
|
|
24
7
|
end
|
|
25
8
|
|
|
26
9
|
def installed_packages
|
|
27
10
|
Dir.glob(File.join(Lace.pkgs_folder, "**")).sort.map do |p|
|
|
28
|
-
Pathname.new(p).basename.to_s
|
|
11
|
+
Package.new(Pathname.new(p).basename.to_s, false)
|
|
29
12
|
end
|
|
30
13
|
end
|
|
31
14
|
|
|
32
15
|
def list
|
|
33
16
|
if installed_packages.length > 0
|
|
34
|
-
installed_packages.map do |
|
|
35
|
-
package
|
|
36
|
-
puts "[#{Tty.green}#{package.is_active? ? "*" : " "}#{Tty.reset}] #{d}#{package.is_modified? ? " (has local changes)":""}"
|
|
17
|
+
installed_packages.map do |package|
|
|
18
|
+
puts "[#{Tty.green}#{package.is_active? ? "*" : " "}#{Tty.reset}] #{package.name}#{package.is_modified? ? " (has local changes)":""}"
|
|
37
19
|
end
|
|
38
20
|
else
|
|
39
21
|
puts "There are no pkgs installed"
|
data/lib/lace/package/package.rb
CHANGED
|
@@ -7,10 +7,9 @@ class Package
|
|
|
7
7
|
attr_reader :name, :facts, :path
|
|
8
8
|
|
|
9
9
|
def initialize name, flavor=nil
|
|
10
|
-
require 'cmd/list'
|
|
11
|
-
raise PackageNotInstalled.new(name) unless Lace.installed_packages.include?(name)
|
|
12
10
|
@name = name
|
|
13
11
|
@path = Lace.pkgs_folder/name
|
|
12
|
+
raise PackageNotInstalled.new(name) unless @path.exist?
|
|
14
13
|
@flavor = flavor
|
|
15
14
|
read_facts!
|
|
16
15
|
end
|
|
@@ -46,12 +45,15 @@ class Package
|
|
|
46
45
|
end
|
|
47
46
|
|
|
48
47
|
def is_active?
|
|
48
|
+
home_dir = ENV["HOME"]
|
|
49
49
|
if @facts.has_flavors? && @flavor == false
|
|
50
50
|
@facts.flavors.any?{|f| Package.new(@name, f).is_active?}
|
|
51
51
|
else
|
|
52
|
-
|
|
53
|
-
config_files
|
|
54
|
-
|
|
52
|
+
config_files = Set.new @facts.config_files
|
|
53
|
+
config_files.all? do |p|
|
|
54
|
+
dotfile = p.as_dotfile(home_dir, @path)
|
|
55
|
+
dotfile.exist? and dotfile.symlink? and dotfile.readlink.dirname.to_s.include?(@path)
|
|
56
|
+
end
|
|
55
57
|
end
|
|
56
58
|
end
|
|
57
59
|
|
|
@@ -90,6 +92,7 @@ class Package
|
|
|
90
92
|
end
|
|
91
93
|
|
|
92
94
|
def link_file_or_directory(src, dest)
|
|
95
|
+
puts "link_file"
|
|
93
96
|
unless dest.dirname.exist?
|
|
94
97
|
dest.dirname.mkpath
|
|
95
98
|
end
|
data/lib/lace/version.rb
CHANGED
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.5.
|
|
4
|
+
version: 0.5.1
|
|
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: 2024-12-
|
|
11
|
+
date: 2024-12-13 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
|