diff --git a/Bootstrapfile b/Bootstrapfile index cd2a680..7473a1d 100644 --- a/Bootstrapfile +++ b/Bootstrapfile @@ -29,6 +29,7 @@ end unix do install "zsh" + install "zellij" install "rbenv" install "nvm" install "rcm" diff --git a/bashrc b/bashrc index 49fa19a..9d24de7 100644 --- a/bashrc +++ b/bashrc @@ -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" diff --git a/bootstrap/lib/bootstrap/package/sources.yml b/bootstrap/lib/bootstrap/package/sources.yml index d06f41f..8b969b8 100644 --- a/bootstrap/lib/bootstrap/package/sources.yml +++ b/bootstrap/lib/bootstrap/package/sources.yml @@ -161,4 +161,11 @@ xournalpp: alacritty: ubuntu: - snap: true \ No newline at end of file + snap: true + +zellij: + ubuntu: + snap: true + fedora: + dnf: + copr: varlad/zellij diff --git a/bootstrap/lib/bootstrap/package_manager.rb b/bootstrap/lib/bootstrap/package_manager.rb index 608dae6..cc4e00c 100644 --- a/bootstrap/lib/bootstrap/package_manager.rb +++ b/bootstrap/lib/bootstrap/package_manager.rb @@ -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(" ", "-") @@ -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"]) diff --git a/bootstrap/test/bootstrap/package_test.rb b/bootstrap/test/bootstrap/package_test.rb index ef22726..eb0c1b1 100644 --- a/bootstrap/test/bootstrap/package_test.rb +++ b/bootstrap/test/bootstrap/package_test.rb @@ -46,6 +46,10 @@ def third_party_package Package.new("third-party-pkg", environment: Environment.new) end + def other_third_party_package + Package.new("other-third-party-pkg", environment: Environment.new) + end + def script_package Package.new("script-pkg", environment: Environment.new) end @@ -184,7 +188,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", } @@ -202,6 +206,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 + other_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 diff --git a/bootstrap/test/fixtures/files/sources.yml b/bootstrap/test/fixtures/files/sources.yml index 052764f..62ca110 100644 --- a/bootstrap/test/fixtures/files/sources.yml +++ b/bootstrap/test/fixtures/files/sources.yml @@ -8,7 +8,11 @@ third-party-pkg: name: test baseurl: testuri gpgkey: testgpgkey - + +other-third-party-pkg: + fedora: + dnf: + copr: some/repo script-pkg: macos: diff --git a/test/bootstrap/macos_test.rb b/test/bootstrap/macos_test.rb index be7fdbe..dd1460c 100644 --- a/test/bootstrap/macos_test.rb +++ b/test/bootstrap/macos_test.rb @@ -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") diff --git a/zshrc b/zshrc index f33b019..9203c44 100644 --- a/zshrc +++ b/zshrc @@ -1,5 +1,7 @@ #!/bin/zsh +source ~/.bashrc + source ~/.zsh/antigen/bin/antigen.zsh antigen use oh-my-zsh @@ -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