├── Casks ├── tm-6502-assembler.rb ├── tm-asciidoc.rb ├── tm-ca65-assembler.rb ├── tm-elixir.rb ├── tm-ledger.rb └── tm-linter.rb ├── README.md └── cmd ├── brew-tm.rb └── hbc ├── artifact.rb ├── artifact └── tmbundle.rb ├── config.rb └── dsl.rb /Casks/tm-6502-assembler.rb: -------------------------------------------------------------------------------- 1 | cask "tm-6502-assembler" do 2 | version "r20120906" 3 | sha256 "0d029aafa863f6b9d7449720f184a0e3bcbaa701af4572fa3d05a93d5e608951" 4 | 5 | @commit_sha = "7ca73008dadb5edcd3941b3f8fddb728f876484e" 6 | 7 | url "https://github.com/fastjack/6502-Assembler.tmbundle/archive/#{@commit_sha}.tar.gz" 8 | 9 | name "A TextMate bundle with syntax support for the ACME cross assembler" 10 | homepage "https://github.com/fastjack/6502-Assembler.tmbundle" 11 | 12 | tmbundle "6502-Assembler.tmbundle-#{@commit_sha}", 13 | target: "6502-Assembler.tmbundle" 14 | end 15 | -------------------------------------------------------------------------------- /Casks/tm-asciidoc.rb: -------------------------------------------------------------------------------- 1 | cask "tm-asciidoc" do 2 | version "0.2" 3 | sha256 "d099f2a92667cb8de9233e951181199ec40e542608d33ecd552ea790bda1a8ac" 4 | 5 | url "https://github.com/mattneub/AsciiDoc-TextMate-2.tmbundle/archive/v#{version}.tar.gz" 6 | 7 | name "AsciiDoc bundle for TextMate 2" 8 | homepage "https://github.com/mattneub/AsciiDoc-TextMate-2.tmbundle" 9 | 10 | tmbundle "AsciiDoc-TextMate-2.tmbundle-#{version}", 11 | target: "AsciiDoc-TextMate-2.tmbundle" 12 | end 13 | -------------------------------------------------------------------------------- /Casks/tm-ca65-assembler.rb: -------------------------------------------------------------------------------- 1 | cask "tm-ca65-assembler" do 2 | version "r20060616" 3 | sha256 "a9446d37dfd1351b03ca3fe50b6ad8fccf7df73434302eb851d259339a83abbc" 4 | 5 | url "http://codebase64.org/lib/exe/fetch.php?media=base:6502_assembler.tmbundle.zip" 6 | 7 | name "ca65, 6502 bundle for TextMate" 8 | homepage "http://codebase64.org/doku.php?id=base:crossdev" 9 | 10 | tmbundle "6502 Assembler.tmbundle" 11 | end 12 | -------------------------------------------------------------------------------- /Casks/tm-elixir.rb: -------------------------------------------------------------------------------- 1 | cask "tm-elixir" do 2 | version "1b4315ffd8e01769c254f5f5dbccc23cc469a6b8" 3 | sha256 "6b6277aae39bfb78ea22d99d923adda8f5c242b74aca3433278f5a24d4ea2fa3" 4 | 5 | url "https://github.com/elixir-lang/elixir-tmbundle/archive/#{version}.tar.gz" 6 | 7 | name "A TextMate Bundle for the Elixir programming language." 8 | homepage "https://github.com/elixir-lang/elixir-tmbundle" 9 | 10 | tmbundle "elixir-tmbundle-#{version}", target: "Elixir.tmbundle" 11 | end 12 | -------------------------------------------------------------------------------- /Casks/tm-ledger.rb: -------------------------------------------------------------------------------- 1 | cask "tm-ledger" do 2 | version "r20141019" 3 | sha256 "22d093a4334d00ebc14b14b812b38bbc3469c37be12eb09c0272877e8db3557d" 4 | 5 | @commit_sha = "9fc27f5cf3c49451a5417c2e879783075a3bf9af" 6 | 7 | url "https://github.com/lifepillar/Ledger.tmbundle/archive/#{@commit_sha}.tar.gz" 8 | 9 | name "TextMate support for Ledger 3 (http://www.ledger-cli.org)" 10 | homepage "https://github.com/lifepillar/Ledger.tmbundle" 11 | 12 | tmbundle "Ledger.tmbundle-#{@commit_sha}", 13 | target: "Ledger.tmbundle" 14 | end 15 | -------------------------------------------------------------------------------- /Casks/tm-linter.rb: -------------------------------------------------------------------------------- 1 | cask "tm-linter" do 2 | version "r6.10939dc" 3 | sha256 "b6f54e3d93227ca4b041e8ec33e9a14c08f4fd31e35b0f4c623ffaa8e46abf19" 4 | 5 | @commit_sha = "d1c558a967589ce433f7e2118dea583cf0c83b40" 6 | 7 | url "https://github.com/MikeMcQuaid/Linter.tmbundle/archive/#{@commit_sha}.tar.gz" 8 | 9 | name "Linting functionality for TextMate" 10 | homepage "https://github.com/MikeMcQuaid/Linter.tmbundle" 11 | 12 | tmbundle "Linter.tmbundle-#{@commit_sha}", 13 | target: "Linter.tmbundle" 14 | end 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # What is this? 2 | 3 | This repository is an [external command](https://github.com/Homebrew/brew/blob/master/docs/External-Commands.md) for [Homebrew](https://brew.sh). It helps you **manage bundles** for the popular [TextMate](https://github.com/textmate/textmate) editor, like Homebrew does for apps. 4 | 5 | Or, in other words: it’s a Homebrew [tap](https://github.com/Homebrew/brew/blob/master/docs/brew-tap.md) that allows you to **use the command line to search, install, and uninstall TextMate bundles.** 6 | 7 | 8 | # Three important warnings 9 | 10 | ## This tap is experimental 11 | 12 | **Consider this tap untested.** Do not use it unless you have backed up your important data. 13 | 14 | Issues and pull requests are welcome. 15 | 16 | 17 | ## This tap adds an external command to Homebrew 18 | 19 | **This tap is different to most other taps because it contains executable code.** 20 | 21 | Even if you are very familiar with Homebrew taps, and even if you use them regularly without problems, you may want to be careful with the external command introduced by this tap. 22 | 23 | 24 | ## This tap adds and removes TextMate bundles to/from your Library 25 | 26 | **Be warned that this tap installs and deletes things willy-nilly** inside your `~/Library/Application Support/TextMate/Pristine Copy/Bundles` folder; you may want to take extra care to back up this particular folder before you even tap this repo. 27 | 28 | 29 | # Features 30 | 31 | This tap provides a `brew tm` command, which has the following features, all via the command line: 32 | 33 | - Install one or more TextMate bundles 34 | 35 | - Uninstall TextMate bundles, or reinstall them 36 | 37 | - Search for TextMate bundles inside the repository 38 | 39 | - Shorthand for opening a TextMate bundle’s homepage 40 | 41 | - Support for editing and auditing package files (Casks) for TextMate bundles 42 | 43 | 44 | # Installation 45 | 46 | 1. Make sure you have [Homebrew](https://brew.sh) installed. 47 | 48 | 2. Update TextMate to the latest version. You can do this either manually or via `brew cask reinstall textmate`. 49 | 50 | 3. Run `brew tap claui/textmate` to tap into this repository. 51 | 52 | 53 | # Usage 54 | 55 | Run `brew tm` for information on how to use this tap. 56 | 57 | 58 | # Example 59 | 60 | Search for TextMate bundles that support 6502 assembly: 61 | 62 | $ brew tm search 6502 63 | ==> Partial Match 64 | tm-6502-assembler 65 | 66 | 67 | Install the `tm-6502-assembler` bundle directly into TextMate: 68 | 69 | $ brew tm install 6502-assembler 70 | 71 | 72 | # Troubleshooting 73 | 74 | If you experience any issue using `brew tm`, **do not submit** an issue to the Homebrew project. 75 | 76 | Instead, try the following steps in any order: 77 | 78 | - Run `brew update-reset && brew update` to make sure your Homebrew installation is up to date. (Note that this will reset any changes you have made to taps.) 79 | 80 | - Run `brew untap claui/textmate` and see if the problem goes away. Re-tap by running `brew tap claui/textmate`. 81 | 82 | - Run `brew tm` to list all bundles you have installed, then `brew tm uninstall --force` one bundle at a time. 83 | 84 | - Go to `/usr/local/Caskroom` and delete all the directories that start with `tm-`. 85 | 86 | - Search the `homebrew-textmate` repo on GitHub for the same or similar issues. 87 | 88 | - Follow Homebrew’s [troubleshooting steps](https://github.com/Homebrew/brew/blob/master/docs/Troubleshooting.md). 89 | 90 | - If you are trying to contribute to the repo, the easiest way is to just work in the tap directly. Go to `/usr/local/Homebrew/Library/Taps/claui/homebrew-textmate` and work from there. 91 | 92 | - **If none of these steps help**, file a new issue **with the `homebrew-textmate` project**. **Do not submit** an issue to the Homebrew project if the issue seems to be related to TextMate bundles, or to the `brew tm` command. 93 | 94 | 95 | # Contributing 96 | 97 | Feel free to fork, and contribute to, this repository in any way you like, for example in one or more of the following ways: 98 | 99 | - create new Casks for (official or unofficial) TextMate bundles, 100 | 101 | - submit pull requests to have your work merged with this repo, 102 | 103 | - report issues, or 104 | 105 | - contribute features or bug fixes. 106 | 107 | Contributing Casks for TextMate bundles is easy. They are largely compatible with the [Cask Language Reference](https://github.com/caskroom/homebrew-cask/tree/master/doc); the only actual technical difference is that it introduces a new `tmbundle` stanza. 108 | 109 | 110 | ## Creating a new Cask for TextMate bundles 111 | 112 | An easy method to create a new Cask for TextMate bundles would be to look at the [examples](https://github.com/claui/homebrew-textmate/blob/master/Casks) and learn/copy/paste from them. 113 | 114 | You can also find [excellent documentation](https://github.com/caskroom/homebrew-cask/tree/master/doc) for the Cask Language if that’s more your thing. 115 | 116 | The Caskroom repo also has a detailed [tutorial on creating new Casks](https://github.com/caskroom/homebrew-cask/blob/master/doc/development/adding_a_cask.md). 117 | 118 | The main difference between regular Casks and `brew tm`-style Casks is that the latter introduces a new `tmbundle` stanza. The `tmbundle` stanza is needed to install TextMate bundles to the appropriate directory. The stanza can be used like [any other artifact stanza](https://github.com/caskroom/homebrew-cask/blob/master/doc/cask_language_reference/all_stanzas.md#at-least-one-artifact-stanza-is-also-required) in the Cask definition language. 119 | 120 | When following the [Caskroom’s instructions](https://github.com/caskroom/homebrew-cask/blob/master/doc/development/adding_a_cask.md), be sure to apply the following modifications: 121 | 122 | - When you choose or generate a token for your Cask, always prepend it with the `tm-` prefix when it’s a TextMate bundle. 123 | 124 | - To edit a Cask for a TextMate bundle, use `brew tm audit` instead of `brew cask audit`. 125 | 126 | - To test a Cask for a TextMate bundle, use `brew tm install` instead of `brew cask install`. 127 | 128 | - To audit a Cask for a TextMate bundle prior to submitting a PR, use `brew tm audit` instead of `brew cask audit`. 129 | 130 | - Use the `claui/homebrew-textmate` repository instead of `caskroom/homebrew-cask`. 131 | 132 | - When writing a Cask for a Textmate bundle, use the `tmbundle` stanza instead of `app`. 133 | 134 | - The section [Finding a Home For Your Cask](https://github.com/caskroom/homebrew-cask/blob/master/doc/development/adding_a_cask.md#finding-a-home-for-your-cask) does not apply for TextMate bundles. You can safely ignore it. 135 | 136 | - When you’re ready to submit your pull request, the base fork should be `claui/homebrew-textmate @ master`, and the head fork should be `my-github-username/homebrew-textmate @ my-new-cask`. 137 | 138 | 139 | # FAQ 140 | 141 | ## Why would I need this? 142 | 143 | The command line is good for automating things, for example for unattended mass deployment. Also, some people just generally prefer command-line workflows over a GUI. 144 | 145 | Chances are you don’t; in that case, the `brew tm` command and the `homebrew-textmate` repository are probably not for you. 146 | 147 | ## Is this an official extension to TextMate? 148 | 149 | No. 150 | 151 | ## Is this an official extension to Homebrew? 152 | 153 | No. 154 | 155 | ## Is this an official Homebrew tap? 156 | 157 | No. 158 | 159 | ## What’s wrong with the TextMate » Preferences » Bundles list built into TextMate? 160 | 161 | Nothing wrong in the least; TextMate’s list of built-in bundles is perfectly fine. 162 | 163 | The `brew tm` command and this repo simply want to be an alternative method, designed for people who prefer a CLI workflow, or need to automate installing/uninstalling TextMate bundles for one reason or the other. 164 | 165 | While the `brew tm` command does not support the Preferences » Bundles list built into TextMate today, it may do so in the future. In the meantime, you can freely use one or the other interchangeably, or both at the same time. They should play well with each other. 166 | 167 | ## Does this thing affect TextMate’s own bundle list under TextMate » Preferences » Bundles? 168 | 169 | No. Managed bundles should work alongside the `brew tm` command without any issues. You can use one or the other, or both. 170 | 171 | ## Do I need to be familiar with Homebrew to use this? 172 | 173 | No. 174 | 175 | The `brew tm` command should be pretty self-explanatory; being familiar with Homebrew won’t hurt though. 176 | 177 | ## Do I need to be familiar with brew cask to use this? 178 | 179 | No. 180 | 181 | You don’t need to be familiar with the `brew cask` command, although it will not hurt. In essence, the `brew tm` command is not much more than a façade to `brew cask` but with a focus on TextMate bundles. 182 | 183 | ## Why yet another subcommand for brew? 184 | 185 | In Homebrew, you can add custom features only if you bring along your own unofficial subcommand. 186 | 187 | ## Why not just fork Homebrew, then add support for TextMate bundles as a core feature? 188 | 189 | I don’t believe the Homebrew project will ever be an appropriate home for TextMate bundles. Homebrew has a strong focus on features which are useful for _many_ users (and rightly so). 190 | 191 | In my personal opinion and judgement, the TextMate ecosystem is not notable enough. 192 | 193 | The good thing is that Homebrew allows – and, in fact, encourages – users to extend Homebrew by tapping into repos to their hearts’ content. 194 | 195 | ## How was this implemented? 196 | 197 | Homebrew offers a `brew cask` command which allows you to manage packages related to GUI apps on macOS. 198 | 199 | Homebrew also offers external commands to extend the features of Homebrew. 200 | 201 | This tap takes the `brew cask` feature and applies it to TextMate bundles. 202 | 203 | For installing and removing TextMate bundles, `brew tm` uses a few (unsupported) implementation details of TextMate. 204 | 205 | ## Why doesn’t TextMate show a confirmation dialog during installation? 206 | 207 | It is part of a shared philosophy of many package managers that installing software should be free from needless user interactions. 208 | 209 | The `brew tm` command uses an implementation detail of TextMate to circumvent the confirmation dialog while installing a TextMate bundle. 210 | 211 | ## Will this interfere with Homebrew proper? 212 | 213 | Probably not, but minor cosmetic issues are possible. 214 | 215 | There are a few possible points of contact where the `brew tm` command will cause Homebrew itself to produce errors. 216 | 217 | One of them is that Homebrew keeps a bit of metadata inside the `/usr/local/Caskroom/` hierarchy. This metadata will include instances of the `tmbundle` artifact stanza, which is proprietary for TextMate-related Casks. 218 | 219 | The `tmbundle` stanza is unknown both to Homebrew and to the `brew cask` command. Homebrew does not expect metadata to contain `tmbundle` entries, which possibly leads to warnings or error messages. If you experience issues, refer to the Troubleshooting section. 220 | 221 | ## Will this break TextMate or my bundles in any way? 222 | 223 | I’m not aware of any major issues. However, `brew tm` relies heavily on implementation details in TextMate. Such details can change at any moment on TextMate’s end without notice. This can break `brew tm`, and it won’t be TextMate’s responsibility. (Any project is free to change its private implementation details at its own discretion.) 224 | 225 | I strongly recommend that you prepare for this by making frequent backups. At the very least, those backups should include your `~/Library/Application Support/TextMate` folder and all of its subfolders. 226 | 227 | ## Can I still download and install .tmbundle files manually? 228 | 229 | Yes. 230 | 231 | `brew tm` will not be aware of files you have installed manually; it won’t assist you with uninstalling if you later choose so. 232 | 233 | Apart from that, everything should be fine. 234 | 235 | ## Can I still uninstall bundles manually? 236 | 237 | Yes. 238 | 239 | If you’re referring to a bundle shown in _TextMate » Preferences » Bundles,_ you can uninstall it by removing the check mark in the list. 240 | 241 | If you’re referring to a bundle you have installed manually, you will find it in the `~/Library/Application Support/TextMate/Pristine Copy/Bundles` directory. Simply delete that bundle to uninstall. 242 | 243 | Note that either way, your manual modifications will be kept even after the bundle has been deleted. This is expected behavior. 244 | 245 | ## How do I configure a different location to keep my TextMate bundles? 246 | 247 | The `brew tm` command does not support this feature yet. 248 | 249 | It uses the `~/Library/Application Support/TextMate/Pristine Copy/Bundles` directory as its (hard-coded) default location for the time being. 250 | 251 | ## What happens with my manual changes I have made to bundles? 252 | 253 | Making manual changes to bundles is unrelated to `brew tm`, and should continue to work as expected. 254 | 255 | TextMate goes to extra lengths to preserve each and every manual change you have made, no matter which method you have used to install or uninstall the bundle. Your choice of installation method does not affect the way TextMate preserves your manual changes. 256 | 257 | ## How do I undo my manual changes to bundles? 258 | 259 | The `brew tm` command cannot help you with that yet. A future release might offer a feature to allow you to undo your custom modifications. 260 | 261 | ## How do I uninstall the tap altogether? 262 | 263 | Run `brew untap claui/textmate`. 264 | 265 | ## Can I remove the entire tap but still keep the brew tm command around? 266 | 267 | Not yet. This would involve splitting the repository in two or more taps. I don’t think this would be worth the additional effort on the user’s side, at least for now. 268 | 269 | ## I want to contribute but I don’t want to work in /usr/local/Homebrew/Library/Taps/claui/homebrew-textmate directly. Is there another way? 270 | 271 | Maintaining a local clone, e. g. under your home directory, is probably not worth the hassle that comes with it. As all the `brew` subcommands only look at the taps under `/usr/local/…`, and ignore everything else, you’d have to take care of syncing your custom repo with the tap _all the time_. It’s definitely possible; however for testing, my personal opinion is that it this brings pain, sorrow, and confusion. 272 | 273 | Instead, make sure you have done `brew tap claui/textmate` once; then I recommend that you go to `/usr/local/Homebrew/Library/Taps/claui/homebrew-textmate` and simply work from there. 274 | 275 | 276 | 277 | # Legal notice 278 | 279 | This tap, including the `brew tm` command and all Cask definitions for TextMate bundles, is in no way affiliated with, nor is it endorsed by, the TextMate project nor any of the people who maintain that project, nor MacroMates Ltd., nor the Homebrew project nor any of its maintainers, nor the Caskroom organization. 280 | 281 | 282 | # License 283 | 284 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 285 | 286 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 287 | 288 | 289 | # Acknowledgements 290 | 291 | The idea for this repo comes from a [discussion thread started by じょいすじょん](http://lists.macromates.com/textmate/2017-July/040365.html) on the [TextMate mailing list](http://lists.macromates.com/listinfo/textmate). 292 | -------------------------------------------------------------------------------- /cmd/brew-tm.rb: -------------------------------------------------------------------------------- 1 | #: * `tm` `audit` : 2 | #: Check whether the given Cask is valid for use with 3 | #: `brew tm` and passes all requirements. 4 | #: 5 | #: * `tm` `cat` : 6 | #: Display the Cask that belongs to the given token. 7 | #: 8 | #: * `tm` `edit` : 9 | #: Open the Cask in a text editor. 10 | #: 11 | #: * `tm` `help`: 12 | #: Display this help text. 13 | #: 14 | #: * `tm` `home`: 15 | #: Open the homepage of the external `brew tm` command. 16 | #: 17 | #: * `tm` `home` : 18 | #: Open the project homepage for the given TextMate bundle 19 | #: token. 20 | #: 21 | #: * `tm` `info` : 22 | #: Display information about the TextMate bundle with 23 | #: the given token. 24 | #: 25 | #: * `tm` `install` [--force] : 26 | #: Download and install the TextMate bundle with the 27 | #: given token. 28 | #: 29 | #: * `tm` `reinstall` [--force] : 30 | #: Download and reinstall the TextMate bundle with the 31 | #: given token; if an old installation exists, it will be 32 | #: removed before reinstalling. 33 | #: 34 | #: * `tm` `search`: 35 | #: List all known TextMate bundles in all tapped 36 | #: repositories. 37 | #: 38 | #: * `tm` `search` : 39 | #: Search all tapped repositories for TextMate bundles 40 | #: whose token starts with the given substring. 41 | #: 42 | #: * `tm` `uninstall` [--force] : 43 | #: Uninstall the TextMate bundle with the given token. 44 | 45 | $LOAD_PATH.unshift("#{HOMEBREW_LIBRARY_PATH}/cask/lib") 46 | require "hbc" 47 | 48 | require_relative "hbc/artifact" 49 | require_relative "hbc/config" 50 | require_relative "hbc/dsl" 51 | 52 | BREW_TM_HOME = "https://github.com/claui/homebrew-textmate" 53 | 54 | module Homebrew 55 | module_function 56 | 57 | def run! 58 | odebug "Invoking the custom `brew tm` command" 59 | 60 | exec help_command if ARGV.empty? 61 | 62 | case sub_command 63 | when "audit" then default! 64 | when "cat" then default! 65 | when "edit" then default! 66 | when "help" then exec help_command 67 | when "home" then home! 68 | when "info" then default! 69 | when "install" then default! 70 | when "reinstall" then default! 71 | when "search" then search! 72 | when "uninstall" then default! 73 | else onoe "Unsupported command: #{sub_command}" 74 | end 75 | end 76 | 77 | def home! 78 | if sub_args.empty? 79 | odebug "Opening the tap homepage" 80 | Hbc::CLI::Home.open_url(BREW_TM_HOME) 81 | else 82 | odebug "Calling brew cask to open the project homepage" 83 | Hbc::CLI.run(sub_command, *sub_args) 84 | end 85 | end 86 | 87 | def search! 88 | if sub_args.reject { |arg| arg.start_with?("-") }.empty? 89 | odebug "Using brew cask to search for all TextMate bundles" 90 | Hbc::CLI.run(sub_command, ["/^tm-/"].concat(sub_args)) 91 | else 92 | odebug "Using brew cask to search for a token" 93 | Hbc::CLI.run(sub_command, *sub_args) 94 | end 95 | end 96 | 97 | def default! 98 | if sub_args.empty? 99 | odebug "Showing help due to missing arguments" 100 | exec help_command 101 | else 102 | odebug "Handing over to brew cask" 103 | Hbc::CLI.run(sub_command, *sub_args) 104 | end 105 | end 106 | 107 | def help_command 108 | "brew help tm" 109 | end 110 | 111 | def sub_command 112 | @sub_command = ARGV.first 113 | end 114 | 115 | def sub_args 116 | @sub_args ||= begin 117 | mapped_args = ARGV[1..-1].map do |arg, index| 118 | next arg if arg.start_with?("-") 119 | next arg if arg.start_with?("tm-") 120 | "tm-#{arg}" 121 | end 122 | mapped_args.compact 123 | end 124 | end 125 | 126 | run! 127 | 128 | odebug "`brew tm` command completed" 129 | end 130 | -------------------------------------------------------------------------------- /cmd/hbc/artifact.rb: -------------------------------------------------------------------------------- 1 | require "hbc/artifact" 2 | require_relative "artifact/tmbundle" 3 | -------------------------------------------------------------------------------- /cmd/hbc/artifact/tmbundle.rb: -------------------------------------------------------------------------------- 1 | require "hbc/artifact/moved" 2 | 3 | module Hbc 4 | module Artifact 5 | class Tmbundle < Moved 6 | def self.artifact_english_name 7 | "TextMate bundle" 8 | end 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /cmd/hbc/config.rb: -------------------------------------------------------------------------------- 1 | require "hbc/locations" 2 | 3 | module Hbc 4 | class Config 5 | attr_reader :tmbundledir 6 | 7 | def tmbundledir=(path) 8 | @tmbundledir = Pathname(path).expand_path 9 | end 10 | 11 | global.tmbundledir = 12 | "~/Library/Application Support/TextMate/Pristine Copy/Bundles" 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /cmd/hbc/dsl.rb: -------------------------------------------------------------------------------- 1 | module Hbc 2 | class DSL 3 | def tmbundle(*args) 4 | klass = Hbc::Artifact::Tmbundle 5 | if [ 6 | *artifacts.map(&:class), klass 7 | ].include?(Artifact::StageOnly) && 8 | (artifacts.map(&:class) & 9 | ACTIVATABLE_ARTIFACT_CLASSES).any? 10 | raise CaskInvalidError.new( 11 | cask, 12 | "'stage_only' must be the only activatable artifact." 13 | ) 14 | end 15 | 16 | artifacts.add(klass.from_args(cask, *args)) 17 | rescue CaskInvalidError 18 | raise 19 | rescue StandardError => e 20 | raise CaskInvalidError.new( 21 | cask, "invalid '#{klass.dsl_key}' stanza: #{e}" 22 | ) 23 | end 24 | end 25 | end 26 | --------------------------------------------------------------------------------