Skip to content

Commit

Permalink
install_choctop: --tmbundle/--textmate flag
Browse files Browse the repository at this point in the history
  • Loading branch information
drnic committed Jul 29, 2010
1 parent 74251fd commit c84353b
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 13 deletions.
1 change: 1 addition & 0 deletions History.txt
@@ -1,3 +1,4 @@
* install_choctop: --tmbundle/--textmate flag
* Don't mention CocoaApp in usage; choctop can do more now

== 0.13.1 2010-07-07
Expand Down
1 change: 1 addition & 0 deletions Manifest.txt
Expand Up @@ -9,6 +9,7 @@ README.rdoc
Rakefile
app_generators/install_choctop/install_choctop_generator.rb
app_generators/install_choctop/templates/Rakefile.erb
app_generators/install_choctop/templates/Rakefile.textmate.erb
app_generators/install_choctop/templates/release_notes.txt.erb
app_generators/install_choctop/templates/release_notes_template.html.erb
assets/DefaultVolumeIcon.icns
Expand Down
38 changes: 26 additions & 12 deletions app_generators/install_choctop/install_choctop_generator.rb
@@ -1,7 +1,5 @@
class InstallChoctopGenerator < RubiGen::Base
attr_reader :name, :module_name, :urlname, :version

default_options :version => "0.1.0"
attr_reader :name, :module_name, :urlname, :version, :github_user

def initialize(runtime_args, runtime_options = {})
super
Expand All @@ -17,18 +15,23 @@ def manifest
record do |m|
%w( appcast/build ).each { |path| m.directory path }

m.template "Rakefile.erb", "Rakefile"
m.template "release_notes.txt.erb", "release_notes.txt"
m.file "release_notes_template.html.erb", "release_notes_template.html.erb"
case options[:project_type]
when :textmate
m.template "Rakefile.textmate.erb", "Rakefile"
else
m.template "Rakefile.erb", "Rakefile"
m.template "release_notes.txt.erb", "release_notes.txt"
m.file "release_notes_template.html.erb", "release_notes_template.html.erb"
end
end
end

protected
def banner
<<-EOS
Installs choctop into your Cocoa application. This gives you
rake tasks to build and deploy your Cocoa app's latest version for
Sparkle appcast mechanism.
Installs choctop into your project/Cocoa application. This gives you
rake tasks to build and deploy your project's latest version into a DMG
and for release via Sparkle appcast mechanism.
USAGE: #{spec.name} path/to/project
EOS
Expand All @@ -38,12 +41,23 @@ def add_options!(opts)
opts.separator ''
opts.separator 'Options:'
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
opts.on("--textmate", "--tmbundle",
"Target project is a TextMate bundle",
"Default: false") { |o| options[:project_type] = :textmate }
opts.on("-V", "--initial-version",
"Show the #{File.basename($0)} version number and quit.",
"Set initial version number.",
"Default: 0.1.0") { |o| options[:version] = o }
end

def extract_options
@version = options[:version]
@version = options[:version]
@github_user = options[:github_user]
end

def self.default_github_user
`git config github.user || whoami`.strip
end
end

default_options :version => "0.1.0", :github_user => default_github_user

end
14 changes: 14 additions & 0 deletions app_generators/install_choctop/templates/Rakefile.textmate.erb
@@ -0,0 +1,14 @@
require "rubygems"
require "rake"

require "choctop"

ChocTop::Configuration.new do |s|
s.name = '<%= name %>'

s.add_root :position => [290, 200], :exclude => %w[build .bundle .git]
# s.add_link 'http://github.com/<%= github_user %>/<%= name %>', 'GitHub', :position => [520, 200]

# s.background_file = 'Support/dmg/dmg_background.png'
# s.volume_icon = 'Support/dmg/dmg_volume_icon.icns'
end
13 changes: 12 additions & 1 deletion features/initial_generator.feature
Expand Up @@ -21,4 +21,15 @@ Feature: Setup a Cocoa app with choctop
When I run local executable "install_choctop" with arguments "."
Then file "release_notes.txt" is created
And file "release_notes.txt" contents does match /Initial release/


Scenario: Install into a tmbundle
Given a TextMate bundle project "MyBundle"
When I run local executable "install_choctop" with arguments ". --textmate"
Then file "Rakefile" is created
Then file "release_notes.txt" is not created
When I invoke task "rake dmg"
And dmg "appcast/build/MyBundle.tmbundle.dmg" is mounted as "MyBundle.tmbundle"
And file "MyBundle.tmbundle" in mounted volume is created
And file "Applications" in mounted volume is not created


0 comments on commit c84353b

Please sign in to comment.