Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 176 lines (146 sloc) 4.678 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
# -*- mode:ruby; indent-tabs-mode:nil; coding:utf-8 -*-
# vim:ts=2:sw=2:expandtab:
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'pathname'

# Application own Settings
APPNAME = "Gmail Notifr"
TARGET = "#{APPNAME}.app"
#APPVERSION = "rev#{`svn info`[/Revision: (\d+)/, 1]}"
APPVERSION = Time.now.strftime("%Y-%m-%d")
PUBLISH = 'yourname@yourhost:path'
DEFAULT_TARGET = APPNAME
DEFAULT_CONFIGURATION = 'Release'
RELEASE_CONFIGURATION = 'Release'

# Tasks
task :default => [:run]

desc "Build the default and run it."
task :run => [:build] do
  sh %{open "build/Release/#{APPNAME}.app"}
end

desc 'Build the default target using the default configuration'
task :build => "xcode:build:#{DEFAULT_TARGET}:#{DEFAULT_CONFIGURATION}"

desc 'Deep clean of everything'
task :clean do
  puts %x{ xcodebuild -alltargets clean }
end

desc "Add files to Xcode project"
task :add do |t|
 files = ARGV[1..-1]
 project = %x{ xcodebuild -list }[/Information about project "([^"]+)":/, 1]
 files << "#{project}.xcodeproj"
 exec("rubycocoa", "add", *files)
end

desc "Create ruby skelton and add to Xcode project"
task :create do |t|
 args = ARGV[1..-1]
 if system("rubycocoa", "create", *args)
   project = %x{ xcodebuild -list }[/Information about project "([^"]+)":/, 1]
   exec("rubycocoa", "add", args.last + ".rb", "#{project}.xcodeproj")
 end
end

desc "Update nib with ruby file"
task :update do |t|
 args = ARGV[1..-1]
 args.unshift("English.lproj/MainMenu.nib")
 exec("rubycocoa", "update", *args)
end

desc "Package the application"
task :package => ["xcode:build:#{DEFAULT_TARGET}:#{RELEASE_CONFIGURATION}", "pkg"] do
  name = "#{APPNAME}.#{APPVERSION}"
  mkdir "image"
  sh %{rubycocoa standaloneify "build/#{DEFAULT_CONFIGURATION}/#{APPNAME}.app" "image/#{APPNAME}.app"}
  puts 'Creating Image...'
  sh %{
hdiutil create -volname '#{name}' -srcfolder image '#{name}'.dmg
rm -rf image
mv '#{name}.dmg' pkg
}
end

directory 'pkg'

desc 'Make Localized nib from English.lproj and Lang.lproj/nib.strings'
rule(/.nib$/ => [proc {|tn| File.dirname(tn) + '/nib.strings' }]) do |t|
  p t.name
  lproj = File.dirname(t.name)
  target = File.basename(t.name)
  rm_rf t.name
  sh %{
nibtool -d #{lproj}/nib.strings -w #{t.name} English.lproj/#{target}
}
end

# [Rubycocoa-devel 906] dynamically xcode rake tasks
# [Rubycocoa-devel 907]
#
def xcode_targets
  out = %x{ xcodebuild -list }
  out.scan(/.*Targets:\s+(.*)Build Configurations:.*/m)

  targets = []
  $1.each_line do |l|
    l = l.strip.sub(' (Active)', '')
    targets << l unless l.nil? or l.empty?
  end
  targets
end

def xcode_configurations
  out = %x{ xcodebuild -list }
  out.scan(/.*Build Configurations:\s+(.*)If no build configuration.*/m)

  configurations = []
  $1.each_line do |l|
    l = l.strip.sub(' (Active)', '')
    configurations << l unless l.nil? or l.empty?
  end
  configurations
end

namespace :xcode do
 targets = xcode_targets
 configs = xcode_configurations

 %w{build clean}.each do |action|
   namespace "#{action}" do

     targets.each do |target|
       desc "#{action} #{target}"
       task "#{target}" do |t|
         puts %x{ xcodebuild -target '#{target}' #{action} }
       end

       # alias the task above using a massaged name
       massaged_target = target.downcase.gsub(/[\s*|\-]/, '_')
       task "#{massaged_target}" => "xcode:#{action}:#{target}"


       namespace "#{target}" do
         configs.each do |config|
           desc "#{action} #{target} #{config}"
           task "#{config}" do |t|
             puts %x{ xcodebuild -target '#{target}' -configuration '#{config}' #{action} }
           end
         end
       end

       # namespace+task aliases of the above using massaged names
       namespace "#{massaged_target}" do
         configs.each { |conf| task "#{conf.downcase.gsub(/[\s*|\-]/, '_')}" => "xcode:#{action}:#{target}:#{conf}" }
       end

     end

   end
 end
end


if ["update", "add", "create"].include? ARGV[0]
  # dupe rake
  ARGV.map! {|a| a.sub(/^\+/, "-") }
  Rake.application[ARGV[0].to_sym].invoke
  exit # will not reach
end

require "choctop"

ChocTop::Configuration.new do |s|
  s.host = 'assets.ashchan.com'
  #s.remote_dir = '/var/www/ashchan.com/shared/gmailnotifr'

  # Optional, showing defaults
  s.base_url = "http://#{s.host}/gmailnotifr"
  s.release_notes = "release_notes.html"

  # # Custom DMG
  s.background_file = "dmg_background.jpg"
  s.app_icon_position = [90, 200]
  s.applications_icon_position = [390, 200]
  #
  # # Custom DMG options
  s.volume_icon = "app.icns"
  # s.icon_size = 104
end
Something went wrong with that request. Please try again.