newcocoa 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -1,3 +1,20 @@
1
1
  README for newcocoa
2
2
  ===================
3
3
 
4
+ newcocoa is for fast create new Ruby/Cocoa project.
5
+
6
+ Build bundle based on Rakefile.
7
+
8
+ 1. <kbd>newcocoa fooapp</kbd>
9
+ 2. <kbd>cd fooapp</kbd>
10
+ 3. ...
11
+ 4. rake
12
+ 5. rake package
13
+ 6. rake publish
14
+
15
+
16
+ To make ruby skelton from 'Create ... files' of Interface Builder.
17
+
18
+ 1. Save .h file for project directory
19
+ 2. newcocoa -c [FILE]
20
+
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
17
17
  BIN_FILES = %w( newcocoa )
18
18
  #REV = `svn info`[/Revision: (\d+)/, 1]
19
19
  #VERS = '0.0.1' + (REV ? ".#{REV}" : '')
20
- VERS = '0.0.1'
20
+ VERS = '0.0.2'
21
21
 
22
22
 
23
23
 
data/bin/newcocoa CHANGED
@@ -63,21 +63,21 @@ if o.convert
63
63
  end
64
64
 
65
65
  if appname
66
- puts "Creating #{appname} directory..."
66
+ puts "creating: #{appname}"
67
67
  mkdir appname
68
- puts "Entering #{appname}"
69
68
  cd appname do
70
69
  appname = appname.capitalize
71
70
 
72
71
  %w(Rakefile README).each do |file|
73
- puts "Creating #{file} from templates."
72
+ puts "creating: #{file}"
74
73
  File.open(file, 'w') do |f|
75
74
  f.write ERB.new((@templates + 'Rakefile').read).result(binding)
76
75
  end
77
76
  end
78
- puts "Copying other templates"
77
+ puts "creating: other templates"
79
78
  cp_r %w(Info.plist.erb main.rb main.m English.lproj).map{|f| @templates + f}, '.'
80
79
 
81
80
  mkdir 'html'
82
81
  end
82
+ puts 'NOW, Edit Rakefile'
83
83
  end
data/templates/Rakefile CHANGED
@@ -12,6 +12,7 @@ TARGET = "#{APPNAME}.app"
12
12
  VERSION = "rev#{`svn info`[/Revision: (\d+)/, 1]}"
13
13
  RESOURCES = ['*.rb', '*.lproj', 'Credits.*', '*.icns']
14
14
  PKGINC = [TARGET, 'README', 'html', 'client']
15
+ LOCALENIB = ['Japanese.lproj/Main.nib']
15
16
  PUBLISH = 'yourname@yourhost:path'
16
17
 
17
18
  BUNDLEID = "rubyapp.#{APPNAME}"
@@ -23,7 +24,7 @@ task :default => [:test]
23
24
 
24
25
  desc 'Create Application Budle and Run it.'
25
26
  task :test => [TARGET] do
26
- sh %{open #{TARGET}}
27
+ sh %{open '#{TARGET}'}
27
28
  end
28
29
 
29
30
  desc 'Create .dmg file for Publish'
@@ -57,13 +58,25 @@ task :publish => [:package] do
57
58
  }
58
59
  end
59
60
 
61
+ desc 'Make Localized nib from English.lproj and Lang.lproj/nib.strings'
62
+ rule(/.nib$/ => [proc {|tn| File.dirname(tn) + '/nib.strings' }]) do |t|
63
+ p t.name
64
+ lproj = File.dirname(t.name)
65
+ target = File.basename(t.name)
66
+ sh %{
67
+ rm -rf #{t.name}
68
+ nibtool -d #{lproj}/nib.strings -w #{t.name} English.lproj/#{target}
69
+ }
70
+ end
71
+
60
72
  # File tasks
61
- file TARGET => [:clean, APPNAME] do
73
+ desc 'Make executable Application Bundle'
74
+ file TARGET => [:clean, APPNAME] + LOCALENIB do
62
75
  sh %{
63
76
  mkdir -p "#{APPNAME}.app/Contents/MacOS"
64
77
  mkdir "#{APPNAME}.app/Contents/Resources"
65
78
  cp -rp #{RESOURCES.join(' ')} "#{APPNAME}.app/Contents/Resources"
66
- cp #{APPNAME} "#{APPNAME}.app/Contents/MacOS"
79
+ cp '#{APPNAME}' "#{APPNAME}.app/Contents/MacOS"
67
80
  echo -n "APPL????" > "#{APPNAME}.app/Contents/PkgInfo"
68
81
  echo -n #{VERSION} > "#{APPNAME}.app/Contents/Resources/VERSION"
69
82
  }
@@ -74,7 +87,7 @@ end
74
87
 
75
88
  file APPNAME => ['main.m'] do
76
89
  # Universal Binary
77
- sh %{gcc -arch ppc -arch i386 -Wall -lobjc -framework RubyCocoa main.m -o #{APPNAME}}
90
+ sh %{gcc -arch ppc -arch i386 -Wall -lobjc -framework RubyCocoa main.m -o '#{APPNAME}'}
78
91
  end
79
92
 
80
93
  directory 'pkg'
data/templates/main.rb CHANGED
@@ -4,7 +4,6 @@ require 'rubygems'
4
4
  rescue LoadError
5
5
  end
6
6
  require 'osx/cocoa'
7
- require 'osx/hotkey'
8
7
  require 'pathname'
9
8
 
10
9
  def log(*args)
@@ -22,7 +21,7 @@ Pathname.glob(path + '*.rb') do |file|
22
21
  next if file.to_s == __FILE__
23
22
  require(file)
24
23
  end
25
- OSX::NSApplicationWithHotKey.sharedApplication
24
+ OSX::NSApplication.sharedApplication
26
25
  OSX.NSApplicationMain(0, nil)
27
26
 
28
27
 
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: newcocoa
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.1
7
- date: 2006-11-19 00:00:00 +09:00
6
+ version: 0.0.2
7
+ date: 2007-03-25 00:00:00 +09:00
8
8
  summary: Generate new Ruby/Cocoa Application skelton.
9
9
  require_paths:
10
10
  - lib