Move all code under an Hbc:: namespace

* convert existing Cask:: namespace to Hbc::
* move Homebrew-fork code under Hbc::
* move freestanding classes such as Tty and TopologicalHash under Hbc::
* recast HOMEBREW_CASK_ constants as HBC_
* modify our Homebrew Formula for backward compatibility
* devscripts and dev docs
This commit is contained in:
Roland Walker
2015-01-02 07:27:03 -05:00
parent e83b90d4d7
commit 202d6019f8
214 changed files with 1591 additions and 1575 deletions
+9 -2
View File
@@ -1,8 +1,15 @@
require Pathname(__FILE__).realpath.dirname.join("lib", "cask", "version")
begin
require Pathname(__FILE__).realpath.dirname.join("lib", "hbc", "version")
rescue
# todo: transitional, defensive, should not be needed.
# remove the begin/rescue logic after 1 Feb 2015
require Pathname(__FILE__).realpath.dirname.join("lib", "cask", "version")
HBC_VERSION = HOMEBREW_CASK_VERSION
end
class BrewCask < Formula
homepage "https://github.com/caskroom/homebrew-cask/"
url "https://github.com/caskroom/homebrew-cask.git", :tag => "v#{HOMEBREW_CASK_VERSION}"
url "https://github.com/caskroom/homebrew-cask.git", :tag => "v#{HBC_VERSION}"
head "https://github.com/caskroom/homebrew-cask.git", :branch => "master"
skip_clean "bin"
+2 -2
View File
@@ -14,9 +14,9 @@ require 'rubygems'
### configurable constants
###
VERSION_FILE = 'lib/cask/version.rb'
VERSION_FILE = 'lib/hbc/version.rb'
VERSION_PAT = %r[\d+\.\d+\.\d+]i
VERSION_CONSTANT_NAME = 'HOMEBREW_CASK_VERSION'
VERSION_CONSTANT_NAME = 'HBC_VERSION'
###
### methods
+1 -1
View File
@@ -69,7 +69,7 @@ changelog.
$ export NEW_RELEASE_TAG="$(./developer/bin/get_release_tag -next -patch)"; echo "$NEW_RELEASE_TAG"
```
7. Make sure the value in `$NEW_RELEASE_TAG` is what you want.
8. Bump the `HOMEBREW_CASK_VERSION` string which is stored in the file
8. Bump the `HBC_VERSION` string which is stored in the file
`lib/cask/version.rb`:
```bash
+2 -2
View File
@@ -13,7 +13,7 @@ $LOAD_PATH.unshift(File.expand_path('..', Pathname.new(__FILE__).realpath))
# todo remove internal Homebrew dependencies and remove this line
require 'vendor/homebrew-fork/global'
require 'cask'
require 'hbc'
Cask::CLI.process(ARGV)
Hbc::CLI.process(ARGV)
exit 0
-68
View File
@@ -1,68 +0,0 @@
module Cask::Artifact; end
require 'cask/artifact/base'
require 'cask/artifact/uninstall_base'
require 'cask/artifact/symlinked'
require 'cask/artifact/hardlinked'
require 'cask/artifact/app'
require 'cask/artifact/artifact' # generic 'artifact' stanza
require 'cask/artifact/binary'
require 'cask/artifact/colorpicker'
require 'cask/artifact/font'
require 'cask/artifact/input_method'
require 'cask/artifact/installer'
require 'cask/artifact/internet_plugin'
require 'cask/artifact/nested_container'
require 'cask/artifact/pkg'
require 'cask/artifact/postflight_block'
require 'cask/artifact/preflight_block'
require 'cask/artifact/prefpane'
require 'cask/artifact/qlplugin'
require 'cask/artifact/screen_saver'
require 'cask/artifact/service'
require 'cask/artifact/stage_only'
require 'cask/artifact/suite'
require 'cask/artifact/uninstall'
require 'cask/artifact/widget'
require 'cask/artifact/zap'
module Cask::Artifact
#
# NOTE: order is important here, since we want to extract nested containers
# before we handle any other artifacts
#
def self.artifacts
[
Cask::Artifact::PreflightBlock,
Cask::Artifact::NestedContainer,
Cask::Artifact::Installer,
Cask::Artifact::App,
Cask::Artifact::Suite,
Cask::Artifact::Artifact, # generic 'artifact' stanza
Cask::Artifact::Colorpicker,
Cask::Artifact::Pkg,
Cask::Artifact::Prefpane,
Cask::Artifact::Qlplugin,
Cask::Artifact::Font,
Cask::Artifact::Widget,
Cask::Artifact::Service,
Cask::Artifact::StageOnly,
Cask::Artifact::Binary,
Cask::Artifact::InputMethod,
Cask::Artifact::InternetPlugin,
Cask::Artifact::ScreenSaver,
Cask::Artifact::Uninstall,
Cask::Artifact::PostflightBlock,
Cask::Artifact::Zap,
]
end
def self.for_cask(cask)
odebug "Determining which artifacts are present in Cask #{cask}"
artifacts.select do |artifact|
odebug "Checking for artifact class #{artifact}"
artifact.me?(cask)
end
end
end
-2
View File
@@ -1,2 +0,0 @@
class Cask::Artifact::App < Cask::Artifact::Symlinked
end
-5
View File
@@ -1,5 +0,0 @@
class Cask::Artifact::Binary < Cask::Artifact::Symlinked
def install_phase
super unless Cask.no_binaries
end
end
-2
View File
@@ -1,2 +0,0 @@
class Cask::Artifact::Colorpicker < Cask::Artifact::Symlinked
end
-2
View File
@@ -1,2 +0,0 @@
class Cask::Artifact::Font < Cask::Artifact::Hardlinked
end
-2
View File
@@ -1,2 +0,0 @@
class Cask::Artifact::InputMethod < Cask::Artifact::Symlinked
end
-3
View File
@@ -1,3 +0,0 @@
class Cask::Artifact::InternetPlugin < Cask::Artifact::Symlinked
end
-3
View File
@@ -1,3 +0,0 @@
class Cask::Artifact::ScreenSaver < Cask::Artifact::Symlinked
end
-2
View File
@@ -1,2 +0,0 @@
class Cask::Artifact::Service < Cask::Artifact::Symlinked
end
-2
View File
@@ -1,2 +0,0 @@
class Cask::Artifact::Uninstall < Cask::Artifact::UninstallBase
end
-2
View File
@@ -1,2 +0,0 @@
class Cask::Artifact::Widget < Cask::Artifact::Symlinked
end
-17
View File
@@ -1,17 +0,0 @@
class Cask::CLI::Uninstall < Cask::CLI::Base
def self.run(*args)
cask_tokens = cask_tokens_from(args)
raise CaskUnspecifiedError if cask_tokens.empty?
force = args.include? '--force'
cask_tokens.each do |cask_token|
odebug "Uninstalling Cask #{cask_token}"
cask = Cask.load(cask_token)
raise CaskNotInstalledError.new(cask) unless cask.installed? or force
Cask::Installer.new(cask).uninstall(force)
end
end
def self.help
"uninstalls the given Cask"
end
end
-62
View File
@@ -1,62 +0,0 @@
class Cask::Container; end
require 'cask/container/base'
require 'cask/container/air'
require 'cask/container/bzip2'
require 'cask/container/cab'
require 'cask/container/criteria'
require 'cask/container/dmg'
require 'cask/container/generic_unar'
require 'cask/container/gzip'
require 'cask/container/naked'
require 'cask/container/otf'
require 'cask/container/pkg'
require 'cask/container/seven_zip'
require 'cask/container/sit'
require 'cask/container/tar'
require 'cask/container/ttf'
require 'cask/container/rar'
require 'cask/container/xar'
require 'cask/container/zip'
class Cask::Container
def self.autodetect_containers
[
Cask::Container::Pkg,
Cask::Container::Ttf,
Cask::Container::Otf,
Cask::Container::Air,
Cask::Container::Cab,
Cask::Container::Dmg,
Cask::Container::SevenZip,
Cask::Container::Sit,
Cask::Container::Tar, # or compressed tar
Cask::Container::Rar,
Cask::Container::Zip,
Cask::Container::Bzip2,
Cask::Container::Gzip, # pure gzip, not tar/gzip
Cask::Container::Xar,
]
# for explicit use only (never autodetected):
# Cask::Container::Naked
# Cask::Container::GenericUnar
end
def self.for_path(path, command)
odebug "Determining which containers to use based on filetype"
criteria = Cask::Container::Criteria.new(path, command)
autodetect_containers.find do |c|
odebug "Checking container class #{c}"
c.me?(criteria)
end
end
def self.from_type(type)
odebug "Determining which containers to use based on 'container :type'"
begin
Cask::Container.const_get(type.to_s.split('_').map(&:capitalize).join)
rescue NameError
false
end
end
end
-6
View File
@@ -1,6 +0,0 @@
class Cask::DSL::Preflight < Cask::DSL::Base
def method_missing(method, *args)
Cask::Utils.method_missing_message(method, @cask.to_s, 'preflight')
return nil
end
end
-6
View File
@@ -1,6 +0,0 @@
class Cask::DSL::UninstallPostflight < Cask::DSL::Base
def method_missing(method, *args)
Cask::Utils.method_missing_message(method, @cask.to_s, 'uninstall_postflight')
return nil
end
end
-10
View File
@@ -1,10 +0,0 @@
require 'cask/staged'
class Cask::DSL::UninstallPreflight < Cask::DSL::Base
include Cask::Staged
def method_missing(method, *args)
Cask::Utils.method_missing_message(method, @cask.to_s, 'uninstall_preflight')
return nil
end
end

Some files were not shown because too many files have changed in this diff Show More