Skip to content

Commit

Permalink
Add zellij
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcgibbon committed Nov 29, 2024
1 parent 9dd7cba commit 4c4faac
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 10 deletions.
1 change: 1 addition & 0 deletions Bootstrapfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ end

unix do
install "zsh"
install "zellij"
install "rbenv"
install "nvm"
install "rcm"
Expand Down
4 changes: 4 additions & 0 deletions bashrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

# zellij
export ZELLIJ_AUTO_EXIT=true
eval "$(zellij setup --generate-auto-start bash)"

# aliases
alias b="bundle"
alias be="bundle exec"
Expand Down
9 changes: 8 additions & 1 deletion bootstrap/lib/bootstrap/package/sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,11 @@ xournalpp:

alacritty:
ubuntu:
snap: true
snap: true

zellij:
ubuntu:
snap: true
fedora:
dnf:
copr: varlad/zellij
24 changes: 18 additions & 6 deletions bootstrap/lib/bootstrap/package_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,24 @@ def install(package_name)
end

def source(repo)
if repo.key?("copr")
source_copr(repo)
else
source_repo(repo)
end
end

def sudo?
true
end

private

def source_copr(repo)
dnf("copr", "enable", "-y", repo["copr"])
end

def source_repo(repo)
return if repo_exists?(repo)

repo_file = repo["name"].downcase.gsub(" ", "-")
Expand All @@ -144,12 +162,6 @@ def source(repo)
dnf("update")
end

def sudo?
true
end

private

def repo_exists?(repo)
Dir["/etc/yum.repos.d/*"].find do |file|
File.read(file).match?(repo["baseurl"])
Expand Down
20 changes: 19 additions & 1 deletion bootstrap/test/bootstrap/package_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class PackageFedoraInstallTest < PackageInstallTest
end
end

test "#install on fedora with third party source" do
test "#install on fedora with third party repo source" do
repo_source = {
"name" => "test", "baseurl" => "testuri", "gpgkey" => "testgpgkey",
}
Expand All @@ -202,6 +202,24 @@ class PackageFedoraInstallTest < PackageInstallTest
end
end

test "#install on fedora with third party copr source" do
copr_source = {
"copr" => "some/repo"
}

with_ruby_platform("Linux") do
with_linux_version("Red Hat") do
assert_called(Package, :sources, returns: test_dependencies) do
assert_called_with(Dnf, :source, [copr_source]) do
assert_called_with(Dnf, :install, %w(other-third-party-pkg)) do
third_party_package.install
end
end
end
end
end
end

test "#install on fedora with script source" do
with_ruby_platform("Linux") do
with_linux_version("Red Hat") do
Expand Down
5 changes: 4 additions & 1 deletion bootstrap/test/fixtures/files/sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ third-party-pkg:
name: test
baseurl: testuri
gpgkey: testgpgkey


other-third-party-package:
fedora:
copr: some/repo

script-pkg:
macos:
Expand Down
4 changes: 4 additions & 0 deletions test/bootstrap/macos_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ class MacosTest < TestCase
assert_brew_installed("fd")
end

test "installs zellij" do
assert_brew_installed("zellij")
end

if gui?
test "installs iterm2" do
assert_brew_cask_installed("iterm2")
Expand Down
3 changes: 2 additions & 1 deletion zshrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/zsh

source ~/.bashrc

source ~/.zsh/antigen/bin/antigen.zsh

antigen use oh-my-zsh
Expand All @@ -11,6 +13,5 @@ antigen bundle zsh-users/zsh-syntax-highlighting
antigen apply

source ~/.zsh/themes/sparkle.zsh-theme
source ~/.bashrc

[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local

0 comments on commit 4c4faac

Please # to comment.