diff --git a/bin/setup_mitamae b/bin/setup_mitamae deleted file mode 100755 index d12caaff..00000000 --- a/bin/setup_mitamae +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# ref: https://github.com/k0kubun/dotfiles/blob/a96f59a147c8b970aa366b8239521071c2ca2f2e/bin/setup - -set -eu - -mitamae_repo="github.com/itamae-kitchen/mitamae" -mitamae_version="1.12.7" - -mitamae_cache="mitamae-${mitamae_version}" -if ! [ -f "bin/${mitamae_cache}" ]; then - case "$(uname)" in - "Darwin") - case "$(uname -m)" in - "x86_64") - mitamae_bin="mitamae-x86_64-darwin" - ;; - "arm64") - mitamae_bin="mitamae-aarch64-darwin" - ;; - *) - echo "unexpected uname: $(uname -m)" - exit 1 - esac - ;; - "Linux") - mitamae_bin="mitamae-x86_64-linux" - ;; - *) - echo "unexpected uname: $(uname)" - exit 1 - ;; - esac - - mitamae_tarball="bin/${mitamae_bin}.tar.gz" - curl -o $mitamae_tarball -fL "https://${mitamae_repo}/releases/download/v${mitamae_version}/${mitamae_bin}.tar.gz" - tar xvzf $mitamae_tarball - - rm $mitamae_tarball - mv "${mitamae_bin}" "bin/${mitamae_cache}" - chmod +x "bin/${mitamae_cache}" -fi -ln -sf "${mitamae_cache}" bin/mitamae diff --git a/config/.ideavimrc b/config/.ideavimrc deleted file mode 100644 index 1d79bff0..00000000 --- a/config/.ideavimrc +++ /dev/null @@ -1 +0,0 @@ -set clipboard=unnamed diff --git a/config/.rbenv/default-gems b/config/.rbenv/default-gems deleted file mode 100644 index e437ce33..00000000 --- a/config/.rbenv/default-gems +++ /dev/null @@ -1,7 +0,0 @@ -bundler -pry -pry-doc -pry-coolline -solargraph -travis -keycutter diff --git a/cookbooks/android/default.rb b/cookbooks/android/default.rb deleted file mode 100644 index 47fd5d93..00000000 --- a/cookbooks/android/default.rb +++ /dev/null @@ -1,8 +0,0 @@ -include_cookbook 'java' - -if node[:platform] == 'darwin' - cask 'android-sdk' - cask 'android-studio' -end - -package 'pidcat' diff --git a/cookbooks/android/files/.keep b/cookbooks/android/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/android/templates/.keep b/cookbooks/android/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/anyenv/default.rb b/cookbooks/anyenv/default.rb deleted file mode 100644 index c9e6f2c3..00000000 --- a/cookbooks/anyenv/default.rb +++ /dev/null @@ -1,34 +0,0 @@ -define :install_env_version, version: nil do - cmd = "#{params[:name]} install #{params[:version]}" - execute cmd do - command cmd - not_if "#{params[:name]} versions --bare | grep '^#{params[:version]}$'" - end -end - -define :install_env_versions, versions: [] do - params[:versions].each do |v| - install_env_version params[:name] do - version v - end - end -end - -define :env_global, version: nil do - vers = [] - if params[:version].is_a? Array - vers = params[:version] - ver = vers.join(" ") - else - ver = params[:version] - vers = [ver] - end - - cmd = "#{params[:name]} global #{ver} && #{params[:name]} rehash" - check_cmd = vers.map { |v| "#{params[:name]} global | grep '#{v}'" }.join(" && ") - - execute cmd do - command cmd - not_if check_cmd - end -end diff --git a/cookbooks/anyenv/files/.keep b/cookbooks/anyenv/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/anyenv/templates/.keep b/cookbooks/anyenv/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/docker/default.rb b/cookbooks/docker/default.rb deleted file mode 100644 index ead3dea4..00000000 --- a/cookbooks/docker/default.rb +++ /dev/null @@ -1,5 +0,0 @@ -if node[:platform] == 'darwin' - # package 'docker' - cask 'docker' - # cask 'docker-toolbox' -end diff --git a/cookbooks/docker/files/.keep b/cookbooks/docker/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/docker/templates/.keep b/cookbooks/docker/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/functions/default.rb b/cookbooks/functions/default.rb deleted file mode 100644 index ca73e11b..00000000 --- a/cookbooks/functions/default.rb +++ /dev/null @@ -1,89 +0,0 @@ -define :dotfile, source: nil do - source = params[:source] || params[:name] - source_path = File.expand_path("../../../config/#{source}", __FILE__) - - fail "#{source_path} does not exist" unless File.exist? source_path - - should_force = codespaces? - - target = File.join(node[:home], params[:name]) - directory File.dirname(target) - link target do - to source_path - force should_force - user node[:user] - end -end - -define :dotfile_template, source: nil, variables: {} do - template File.join(node[:home], params[:name]) do - action :create - source params[:source] - variables params[:variables].merge(platform: node[:platform]) - user node[:user] - end -end - -define :brew_tap do - tapname = params[:name] - user, repo = tapname.split('/') - prefix = brew_prefix - execute "brew tap #{tapname}" do - not_if "test -e #{prefix}/Homebrew/Library/Taps/#{user}/homebrew-#{repo}" - end -end - -define :cask do - caskname = params[:name] - prefix = brew_prefix - execute "brew install --cask #{caskname}" do - not_if "ls -1 #{prefix}/Caskroom/ | grep '#{caskname}'" - end -end - -define :github_release, repo: nil, version: nil, archive: nil, checksum: nil, bin: nil, prefix: nil do - bin_dir = "#{params[:prefix] || default_prefix}/bin" - bin = "#{bin_dir}/#{params[:name]}" - tmp_dir = default_tmp_dir - url = "https://github.com/#{params[:repo]}/releases/download/#{params[:version]}" - - directory tmp_dir do - user node[:user] - end - - execute "curl -sfL -o #{tmp_dir}/#{params[:archive]} #{url}/#{params[:archive]}" do - user node[:user] - not_if "test -f #{bin}" - end - - if params[:checksum] - execute "curl -sfL -o #{tmp_dir}/#{params[:checksum]} #{url}/#{params[:checksum]}" do - user node[:user] - not_if "test -f #{bin}" - end - execute "sha256sum -c #{params[:checksum]} --ignore-missing" do - not_if "test -f #{bin}" - user node[:user] - cwd tmp_dir - end - end - - execute 'unarchive' do - case params[:archive] - when /.zip$/; command "unzip -o #{tmp_dir}/#{params[:archive]}" - when /.tar.gz$/; command "tar -xf #{tmp_dir}/#{params[:archive]}" - end - not_if "test -f #{bin}" - user node[:user] - cwd tmp_dir - end - - directory bin_dir do - user node[:user] - end - - execute "mv #{tmp_dir}/#{params[:bin] || params[:name]} #{bin} && chmod +x #{bin}" do - not_if "test -f #{bin}" - user node[:user] - end -end diff --git a/cookbooks/functions/files/.keep b/cookbooks/functions/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/functions/templates/.keep b/cookbooks/functions/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/homebrew/default.rb b/cookbooks/homebrew/default.rb deleted file mode 100644 index 8f01e573..00000000 --- a/cookbooks/homebrew/default.rb +++ /dev/null @@ -1,4 +0,0 @@ -execute 'Install Homebrew' do - command "/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\" < /dev/null" - not_if "test $(which brew)" -end diff --git a/cookbooks/homebrew/files/.keep b/cookbooks/homebrew/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/homebrew/templates/.keep b/cookbooks/homebrew/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/java/default.rb b/cookbooks/java/default.rb deleted file mode 100644 index 5940c862..00000000 --- a/cookbooks/java/default.rb +++ /dev/null @@ -1,5 +0,0 @@ -package 'jenv' - -if node[:platform] == 'darwin' - package 'java' -end diff --git a/cookbooks/java/files/.keep b/cookbooks/java/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/java/templates/.keep b/cookbooks/java/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/macos_apps/default.rb b/cookbooks/macos_apps/default.rb deleted file mode 100644 index 9edadda0..00000000 --- a/cookbooks/macos_apps/default.rb +++ /dev/null @@ -1,24 +0,0 @@ -brew_tap 'homebrew/cask-versions' - -node[:macos_apps][:cask].each do |app| - cask app -end - -package 'mas' - -define :mas, id: nil do - execute "Install #{params[:name]}" do - command "mas install #{params[:id]}" - not_if "mas list | grep -E '^#{params[:id]} '" - end -end - -# execute 'mas signin' do -# not_if 'mas account' -# end - -node[:macos_apps][:mas].each do |app| - mas app[:name] do - id app[:id] - end -end diff --git a/cookbooks/macos_apps/files/.keep b/cookbooks/macos_apps/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/macos_apps/templates/.keep b/cookbooks/macos_apps/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/macos_defaults/default.rb b/cookbooks/macos_defaults/default.rb deleted file mode 100644 index 77d959a7..00000000 --- a/cookbooks/macos_defaults/default.rb +++ /dev/null @@ -1,8 +0,0 @@ -defaults = node[:macos_defaults] - -case defaults -when Hash - defaults_from_hash defaults -when Array - defaults_from_hash defaults -end diff --git a/cookbooks/macos_defaults/files/.keep b/cookbooks/macos_defaults/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/macos_defaults/templates/.keep b/cookbooks/macos_defaults/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/rbenv/default.rb b/cookbooks/rbenv/default.rb deleted file mode 100644 index 5862a616..00000000 --- a/cookbooks/rbenv/default.rb +++ /dev/null @@ -1,35 +0,0 @@ -include_cookbook 'anyenv' -rbenv_root = "#{ENV["HOME"]}/.rbenv" - -package 'rbenv' - -directory "#{rbenv_root}/plugins" do - action :create -end - -git "#{rbenv_root}/plugins/rbenv-default-gems" do - repository 'https://github.com/sstephenson/rbenv-default-gems' - revision 'de4ff2e101c9221dcd92ed91a41edcea2be41945' -end - -file "#{rbenv_root}/default-gems" do - content "#{(node.dig(:rbenv, :'default-gems') || []).join("\n")}\n" -end - -install_env_versions 'rbenv' do - versions node.dig(:rbenv, :versions) -end - -env_global 'rbenv' do - version node.dig(:rbenv, :global) -end - -(node.dig(:rbenv, :versions) || []).each do |v| - (node.dig(:rbenv, :'default-gems') || []).each do |pkg| - gem = "RBENV_VERSION=#{v} rbenv exec gem" - execute "Install #{pkg} on Ruby v#{v}" do - command "#{gem} install #{pkg}" - not_if "#{gem} list -i -e #{pkg}" - end - end -end diff --git a/cookbooks/rbenv/files/.keep b/cookbooks/rbenv/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/rbenv/templates/.keep b/cookbooks/rbenv/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/rust/default.rb b/cookbooks/rust/default.rb deleted file mode 100644 index a6a51576..00000000 --- a/cookbooks/rust/default.rb +++ /dev/null @@ -1 +0,0 @@ -# rustup component add rls rust-analysis rust-src diff --git a/cookbooks/rust/files/.keep b/cookbooks/rust/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/rust/templates/.keep b/cookbooks/rust/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/tools/default.rb b/cookbooks/tools/default.rb deleted file mode 100644 index 91e0c4a0..00000000 --- a/cookbooks/tools/default.rb +++ /dev/null @@ -1,11 +0,0 @@ -package 'colordiff' -package 'coreutils' -package 'curl' -package 'gcc' -package 'gibo' -package 'lua' -package 'lv' -package 'protobuf' -package 'terraform' -package 'watchman' -package 'wget' diff --git a/cookbooks/tools/files/.keep b/cookbooks/tools/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/tools/templates/.keep b/cookbooks/tools/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/whalebrew/default.rb b/cookbooks/whalebrew/default.rb deleted file mode 100644 index 3292f3ff..00000000 --- a/cookbooks/whalebrew/default.rb +++ /dev/null @@ -1,7 +0,0 @@ -bin = "#{brew_prefix}/bin/whalebrew" -ver = '0.1.0' - -execute 'Install whalebrew' do - command "curl -L \"https://github.com/bfirsh/whalebrew/releases/download/#{ver}/whalebrew-$(uname -s)-$(uname -m)\" -o #{bin}; chmod +x #{bin}" - not_if "test -e #{bin}" -end diff --git a/cookbooks/whalebrew/files/.keep b/cookbooks/whalebrew/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/cookbooks/whalebrew/templates/.keep b/cookbooks/whalebrew/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/recipe.rb b/lib/recipe.rb deleted file mode 100644 index 2d1d8606..00000000 --- a/lib/recipe.rb +++ /dev/null @@ -1,12 +0,0 @@ -include_recipe 'recipe_helper' - -Dir.glob(File.join(root_dir, 'nodes', '**', '*.{yml,yaml,json}')).each do |path| - include_node path -end - -node.reverse_merge!( - user: default_user, - home: home_dir, -) - -include_role node[:platform] diff --git a/lib/recipe_helper.rb b/lib/recipe_helper.rb deleted file mode 100644 index 66a34b85..00000000 --- a/lib/recipe_helper.rb +++ /dev/null @@ -1,98 +0,0 @@ -MItamae::RecipeContext.class_eval do - def include_cookbook(name) - include_recipe File.join(root_dir, 'cookbooks', name, 'default') - end - - def include_role(name) - include_recipe File.join(root_dir, 'roles', name, 'default') - end - - def codespaces? - ENV['CODESPACES'] == 'true' - end - - def root_dir - @root_dir ||= File.expand_path('../..', __FILE__) - end - - def brew_prefix - arch = `uname -m`.chomp - case arch - when 'x86_64'; '/usr/local' - when 'arm64'; '/opt/homebrew' - else fail "unknown arch: #{arch}" - end - end - - def default_prefix - "#{home_dir}/.local" - end - - def default_bin_dir - "#{default_prefix}/bin" - end - - def default_tmp_dir - "#{home_dir}/.tmp" - end - - def default_user - ENV['SUDO_USER'] || ENV['USER'] - end - - def home_dir - File.expand_path("~#{default_user}") - end - - def include_node(path) - raw = File.read(path) - content = - case File.extname(path) - when '.yml', '.yaml' then YAML.load(raw) - when '.json' then JSON.parse(raw) - end - - node.reverse_merge!(content) - end - - def type_from_value value - case value - when String then 'string' - # when ??? then 'data' - when Integer then 'int' - when Float then 'float' - when TrueClass then 'bool' - when FalseClass then 'bool' - # when ??? then 'date' - when Array then 'array' - # when ??? then 'array-add' - # when ??? then 'dict' - # when ??? then 'dict-add' - else - fail "Unexpected type: #{value} (#{value.class})" - end - end - - def execute_macos_defaults(defaults, domain = 'NSGlobalDomain') - key = defaults[:key] - value = defaults[:value] - type = defaults[:type] || type_from_value(value) - execute "defaults write #{domain} #{key} -#{type} #{value}" do - not_if "defaults read #{domain} #{key} | grep -q -E '^#{value}$'" - end - end - - def defaults_from_hash defaults_by_domain - defaults_by_domain.each do |domain, defaults_list| - defaults_list.each do |defaults| - execute_macos_defaults(defaults, domain) - end - end - end - - def defaults_from_array defaults_list - defaults_list.each do |defaults| - execute_macos_defaults(defaults) - end - end -end diff --git a/nodes/macos_apps.yml b/nodes/macos_apps.yml deleted file mode 100644 index d8949412..00000000 --- a/nodes/macos_apps.yml +++ /dev/null @@ -1,34 +0,0 @@ -macos_apps: - cask: - - 1password - - authy - - alacritty - - alfred - - appcleaner - - bettertouchtool - - contexts - - dash - - dropbox - - google-chrome - - google-japanese-ime - - grammarly - - karabiner-elements - - notion - - macfuse # for telepresence - - spotify - - visual-studio-code-insiders - - zoom - - mas: - - name: 'Display Menu' - id: 549083868 - - name: 'Keynote' - id: 409183694 - - name: 'PopClip' - id: 445189367 - - name: 'Xcode' - id: 497799835 - - name: 'Todoist' - id: 585829637 - - name: 'Slack' - id: 803453959 diff --git a/nodes/macos_defaults.yml b/nodes/macos_defaults.yml deleted file mode 100644 index c133a22c..00000000 --- a/nodes/macos_defaults.yml +++ /dev/null @@ -1,58 +0,0 @@ -macos_defaults: - NSGlobalDomain: - - key: KeyRepeat - value: 1 - - - key: InitialKeyRepeat - value: 10 - - - key: com.apple.mouse.scaling - value: 2 - - - key: com.apple.scrollwheel.scaling - value: 2 - - - key: com.apple.trackpad.scaling - value: 2 - - com.apple.dock: - - key: autohide - value: 1 - - - key: orientation - value: right - - com.apple.finder: - - key: ShowPathbar - value: 1 - - - key: ShowPreviewPane - value: 1 - - - key: ShowStatusBar - value: 1 - - - key: ShowTabView - value: 1 - - - key: AppleShowAllFiles - value: 1 - - com.apple.menuextra.battery: - - key: ShowPercent - value: "YES" - - com.apple.screensaver: - - key: askForPassword - value: 1 - - - key: askForPasswordDelay - value: 60 - - com.microsoft.VSCodeInsiders: - - key: ApplePressAndHoldEnabled - value: false - - com.apple.screencapture: - - key: location - value: ~/Downloads diff --git a/nodes/rbenv.yml b/nodes/rbenv.yml deleted file mode 100644 index 45073d2b..00000000 --- a/nodes/rbenv.yml +++ /dev/null @@ -1,14 +0,0 @@ -rbenv: - global: 3.0.2 - versions: - - 2.6.8 - - 2.7.4 - - 3.0.2 - default-gems: - - bundler - - pry - - pry-doc - - pry-coolline - - solargraph - - travis - - keycutter diff --git a/nodes/yarn.yml b/nodes/yarn.yml deleted file mode 100644 index dac02271..00000000 --- a/nodes/yarn.yml +++ /dev/null @@ -1,2 +0,0 @@ -yarn: - version: 1.12.3 diff --git a/roles/darwin/default.rb b/roles/darwin/default.rb deleted file mode 100644 index ed44ad8b..00000000 --- a/roles/darwin/default.rb +++ /dev/null @@ -1,10 +0,0 @@ -include_cookbook 'functions' - -include_cookbook 'homebrew' -include_cookbook 'rbenv' -include_cookbook 'android' -include_cookbook 'docker' -include_cookbook 'whalebrew' -include_cookbook 'macos_apps' -include_cookbook 'tools' -include_cookbook 'macos_defaults' diff --git a/roles/darwin/files/.keep b/roles/darwin/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/roles/darwin/templates/.keep b/roles/darwin/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/roles/debian/default.rb b/roles/debian/default.rb deleted file mode 100644 index 938f7f29..00000000 --- a/roles/debian/default.rb +++ /dev/null @@ -1,16 +0,0 @@ -include_cookbook 'functions' - -# include_cookbook 'rbenv' -# include_cookbook 'pyenv' -# include_cookbook 'nodenv' -# include_cookbook 'yarn' -# include_cookbook 'golang' -# include_cookbook 'android' -# include_cookbook 'hammerspoon' -# include_cookbook 'alacritty' -# include_cookbook 'docker' -# include_cookbook 'whalebrew' -# include_cookbook 'tools' -# include_cookbook 'fonts' -# include_cookbook 'macos_apps' -# include_cookbook 'macos_defaults' diff --git a/roles/debian/files/.keep b/roles/debian/files/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/roles/debian/templates/.keep b/roles/debian/templates/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/roles/ubuntu b/roles/ubuntu deleted file mode 120000 index c543a70e..00000000 --- a/roles/ubuntu +++ /dev/null @@ -1 +0,0 @@ -./debian \ No newline at end of file