Module: Geoffrey

Defined in:
lib/geoffrey/reporter.rb,
lib/geoffrey.rb,
lib/geoffrey/cli.rb,
lib/geoffrey/plist.rb,
lib/geoffrey/package.rb,
lib/geoffrey/version.rb,
lib/geoffrey/template.rb,
lib/geoffrey/file_helper.rb

Overview

/H4X

Defined Under Namespace

Modules: FileHelper, Reporter Classes: CLI, DecompressionError, NotFoundError, Package, Plist, Template

Constant Summary collapse

VERSION =
"1.1.3"

Class Method Summary collapse

Class Method Details

.environmentObject



11
12
13
# File 'lib/geoffrey.rb', line 11

def environment
  @@environment ||= :production
end

.environment=(value) ⇒ Object



8
9
10
# File 'lib/geoffrey.rb', line 8

def environment=(value)
  @@environment = value if value
end

.package(&block) ⇒ Object

Define a package installation from the URL specified. It will download the file, and if it’s compressed, it will decompress it.It currently supports zip, tar.gz, .gz and .dmg files. Once extracted it will look for a .pkg or a .app file and try to install it.

Some options can be defined:

  • :sudo if it has to be executed as sudo. Generally .pkg files that ask for a password will require this.

  • :unless a Proc defining if it doesn’t have to try to install it.

  • :if inverse of inverse

  • :file what file has to be installed from all of the ones that came in the compressed file.

  • :filename set the name of the file you are downloading.

If what you’re going to test to see if you have to install something or not is the existance of a file (most likely), you can just specify the path in a creates statement (see examples).

If you don’t want to install a .pkg but do something else, you can just override the install method. See the examples

Examples:

Geoffrey.package do
  url 'http://www.culater.net/dl/files/SIMBL-0.9.7a.zip'
  creates "/Library/LaunchAgents/net.culater.SIMBL.Agent.plist"
  options :sudo => true
end
Geoffrey.package do
  url "http://github.com/dabeeeenster/terminaltabswitching/raw/master/TerminalTabSwitching.bundle.zip"
  options :file => "TerminalTabSwitching.bundle"
  def install
    plugins_dir = "#{ENV["HOME"]}/Library/Application Support/SIMBL/Plugins"
    FileUtils.mkdir_p plugins_dir
    FileUtils.mv file_to_install, plugins_dir, :force => true
  end
end


54
55
56
57
58
# File 'lib/geoffrey.rb', line 54

def package(&block)
  package = Package.new
  package.instance_eval &block
  package.process
end

.plist(&block) ⇒ Object

Help you configure an application editing its .plist file.

You specify the file and then act on it through options as if it were a simple hash.

Some OSX applications dump their settings into the plist file when they quit, so you might want to stop them before applying changes. Geoffrey can do it for you with affects.

Examples:

Geoffrey.plist do
  file :terminal
  affects "/Applications/Utilities/Terminal.app"

  options["Default Window Settings"] = "Pro"
  options["Startup Window Settings"] = "Pro"
  options["HasMigratedDefaults"] = true
  options["Window Settings"]["Pro"]["Font"] = "bplist00\xD4\x01\x02\x03\x04\x05\x06\x18\x19X$versionX$objectsY$archiverT$top\x12\x00\x01\x86\xA0\xA4\a\b\x11\x12U$null\xD4\t\n\v\f\r\x0E\x0F\x10V$classVNSNameVNSSizeXNSfFlags\x80\x03\x80\x02\#@,\x00\x00\x00\x00\x00\x00\x10\x10]Menlo-Regular\xD2\x13\x14\x15\x16Z$classnameX$classesVNSFont\xA2\x15\x17XNSObject_\x10\x0FNSKeyedArchiver\xD1\x1A\eTroot\x80\x01\b\x11\x1A#-27<BKRY`ikmvx\x86\x8B\x96\x9F\xA6\xA9\xB2\xC4\xC7\xCC\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x1C\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xCE"
  options["Window Settings"]["Pro"]["Font"].blob = true
  options["Window Settings"]["Pro"]["columnCount"] = 520
  options["Window Settings"]["Pro"]["rowCount"]    = 100
end

See Also:



84
85
86
87
88
# File 'lib/geoffrey.rb', line 84

def plist(&block)
  plist = Plist.new
  plist.instance_eval &block
  plist.save
end