motion-kit-templates 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: da18113b8c787bf066c6791012efe0a7ac3a606d
4
+ data.tar.gz: 050158b99a2f110ed0b92c33bd2632f886e480f0
5
+ SHA512:
6
+ metadata.gz: afdae8ae306648f3f5a002f66ed7b3870bab6d6817c481cf9110c1bd612165997166a07acc872d3a52f4b1d16dc63160f116b0051294cb865c46a09b6a4b743d
7
+ data.tar.gz: 15cf98c7f122b7be6a2e13d5fe9ca17c929955e3abbc9104fa7ebd6caf6e6ca390dc05c794244a4555c7ff46853efaf1d8939633dea4de8757899bc57c1edb81
@@ -0,0 +1,7 @@
1
+ MotionKit::Templates
2
+ --------------------
3
+
4
+ gem install motion-kit-templates
5
+ motion create foo --template=mk-ios
6
+ motion create foo --template=mk-osx
7
+
@@ -0,0 +1,13 @@
1
+ require 'fileutils'
2
+
3
+ dest_templates_dir = File.expand_path('~/Library/RubyMotion/template/')
4
+ FileUtils.mkdir_p(dest_templates_dir) unless File.exist?(dest_templates_dir)
5
+
6
+ src_templates_dir = File.expand_path(File.join(File.dirname(__FILE__), '../templates'))
7
+ template_dirs = %w(mk-ios mk-osx)
8
+ template_dirs.each do |template|
9
+ src = File.join(src_templates_dir, template)
10
+ dest_dir = File.join(dest_templates_dir, template)
11
+
12
+ FileUtils.ln_s src, dest_dir, :force => true
13
+ end
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+ gem 'motion-kit'
@@ -0,0 +1,14 @@
1
+ # -*- coding: utf-8 -*-
2
+ $:.unshift("/Library/RubyMotion/lib")
3
+ require 'motion/project/template/ios'
4
+
5
+ begin
6
+ require 'bundler'
7
+ Bundler.require
8
+ rescue LoadError
9
+ end
10
+
11
+ Motion::Project::App.setup do |app|
12
+ # Use `rake config' to see complete project settings.
13
+ app.name = '<%= name %>'
14
+ end
@@ -0,0 +1,11 @@
1
+ class AppDelegate
2
+ def application(application, didFinishLaunchingWithOptions: options)
3
+ @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
4
+ main_ctlr = MainController.new
5
+ nav_ctlr = UINavigationController.alloc.initWithRootViewController(main_ctlr)
6
+ @window.rootViewController = nav_ctlr
7
+ @window.makeKeyAndVisible
8
+
9
+ true
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class MainController < UIViewController
2
+
3
+ def layout
4
+ @layout ||= MainLayout.new
5
+ end
6
+
7
+ def loadView
8
+ self.view = layout.view
9
+ end
10
+
11
+ end
@@ -0,0 +1,15 @@
1
+ class MainLayout < MK::Layout
2
+
3
+ def layout
4
+ add UILabel, :remove_me
5
+ end
6
+
7
+ def remove_me_style
8
+ text 'Hello!'
9
+ text_color UIColor.whiteColor
10
+ size_to_fit
11
+ center ['50%', '50%']
12
+ autoresizing_mask :pin_to_center
13
+ end
14
+
15
+ end
@@ -0,0 +1,9 @@
1
+ describe "Application '<%= name %>'" do
2
+ before do
3
+ @app = UIApplication.sharedApplication
4
+ end
5
+
6
+ it "has one window" do
7
+ @app.windows.size.should == 1
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+ gem 'motion-kit'
@@ -0,0 +1,14 @@
1
+ # -*- coding: utf-8 -*-
2
+ $:.unshift("/Library/RubyMotion/lib")
3
+ require 'motion/project/template/osx'
4
+
5
+ begin
6
+ require 'bundler'
7
+ Bundler.require
8
+ rescue LoadError
9
+ end
10
+
11
+ Motion::Project::App.setup do |app|
12
+ # Use `rake config' to see complete project settings.
13
+ app.name = '<%= name %>'
14
+ end
@@ -0,0 +1,13 @@
1
+ class AppDelegate
2
+ attr :main_menu_layout
3
+
4
+ def applicationDidFinishLaunching(notification)
5
+ @main_menu_layout = MainMenu.new
6
+ NSApp.mainMenu = @main_menu_layout.menu
7
+
8
+ @main_controller = MainWindowController.alloc.init
9
+ @main_controller.showWindow(self)
10
+ @main_controller.window.orderFrontRegardless
11
+ end
12
+
13
+ end
@@ -0,0 +1,13 @@
1
+ class MainWindowController < NSWindowController
2
+
3
+ def layout
4
+ @layout ||= MainWindowLayout.new
5
+ end
6
+
7
+ def init
8
+ super.tap do
9
+ self.window = layout.window
10
+ end
11
+ end
12
+
13
+ end
@@ -0,0 +1,27 @@
1
+ class MainWindowLayout < MK::WindowLayout
2
+ MAIN_WINDOW_IDENTIFIER = 'MAIN_WINDOW'
3
+
4
+ def layout
5
+ frame [[335, 390], [402, 114]], MAIN_WINDOW_IDENTIFIER
6
+ styleMask NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask
7
+ contentMinSize [402, 92]
8
+
9
+ add NSTextField, :remove_me
10
+ end
11
+
12
+ def remove_me_style
13
+ size [37, 16]
14
+ center ['50%', '50%']
15
+ autoresizing_mask :pin_to_center
16
+ background_color NSColor.clearColor
17
+ opaque false
18
+
19
+ editable false
20
+ selectable true
21
+ bordered false
22
+ bezeled false
23
+
24
+ string_value 'Hello!'
25
+ end
26
+
27
+ end
@@ -0,0 +1,55 @@
1
+ class MainMenu < MK::MenuLayout
2
+
3
+ def layout
4
+ add app_menu
5
+ add file_menu
6
+
7
+ add 'Edit' do
8
+ add item('Undo', action: 'undo:', keyEquivalent: 'z')
9
+ add item('Redo', action: 'redo:', keyEquivalent: 'Z')
10
+ add NSMenuItem.separatorItem
11
+ add item('Cut', action: 'cut:', keyEquivalent: 'x')
12
+ add item('Copy', action: 'copy:', keyEquivalent: 'c')
13
+ add item('Paste', action: 'paste:', keyEquivalent: 'v')
14
+ item = add item('Paste and Match Style', action: 'pasteAsPlainText:', keyEquivalent: 'V')
15
+ item.keyEquivalentModifierMask = NSCommandKeyMask|NSAlternateKeyMask
16
+ add item('Delete', action: 'delete:', keyEquivalent: '')
17
+ add item('Select All', action: 'selectAll:', keyEquivalent: 'a')
18
+ end
19
+
20
+ add 'Format' do
21
+ add 'Font' do
22
+ add item('Show Fonts', action: 'orderFrontFontPanel:', keyEquivalent: 't')
23
+ add item('Bold', action: 'addFontTrait:', keyEquivalent: 'b')
24
+ add item('Italic', action: 'addFontTrait:', keyEquivalent: 'i')
25
+ add item('Underline', action: 'underline:', keyEquivalent: 'u')
26
+ add NSMenuItem.separatorItem
27
+ add item('Bigger', action: 'modifyFont:', keyEquivalent: '+')
28
+ add item('Smaller', action: 'modifyFont:', keyEquivalent: '-')
29
+ end
30
+
31
+ add 'Text' do
32
+ add item('Align Left', action: 'alignLeft:', keyEquivalent: '{')
33
+ add item('Center', action: 'alignCenter:', keyEquivalent: '|')
34
+ add item('Justify', action: 'alignJustified:', keyEquivalent: '')
35
+ add item('Align Right', action: 'alignRight:', keyEquivalent: '}')
36
+ add NSMenuItem.separatorItem
37
+ add item('Show Ruler', action: 'toggleRuler:', keyEquivalent: '')
38
+ item = add item('Copy Ruler', action: 'copyRuler:', keyEquivalent: 'c')
39
+ item.keyEquivalentModifierMask = NSCommandKeyMask|NSControlKeyMask
40
+ item = add item('Paste Ruler', action: 'pasteRuler:', keyEquivalent: 'v')
41
+ item.keyEquivalentModifierMask = NSCommandKeyMask|NSControlKeyMask
42
+ end
43
+ end
44
+
45
+ add 'View' do
46
+ item = add item('Show Toolbar', action: 'toggleToolbarShown:', keyEquivalent: 't')
47
+ item.keyEquivalentModifierMask = NSCommandKeyMask|NSAlternateKeyMask
48
+ add item('Customize Toolbar…', action: 'runToolbarCustomizationPalette:', keyEquivalent: '')
49
+ end
50
+
51
+ NSApp.windowsMenu = add window_menu
52
+ NSApp.helpMenu = add help_menu
53
+ end
54
+
55
+ end
@@ -0,0 +1,29 @@
1
+ {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
2
+ {\colortbl;\red255\green255\blue255;}
3
+ \paperw9840\paperh8400
4
+ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
5
+
6
+ \f0\b\fs24 \cf0 Engineering:
7
+ \b0 \
8
+ Some people\
9
+ \
10
+
11
+ \b Human Interface Design:
12
+ \b0 \
13
+ Some other people\
14
+ \
15
+
16
+ \b Testing:
17
+ \b0 \
18
+ Hopefully not nobody\
19
+ \
20
+
21
+ \b Documentation:
22
+ \b0 \
23
+ Whoever\
24
+ \
25
+
26
+ \b With special thanks to:
27
+ \b0 \
28
+ Mom\
29
+ }
@@ -0,0 +1,9 @@
1
+ describe "Application '<%= name %>'" do
2
+ before do
3
+ @app = NSApplication.sharedApplication
4
+ end
5
+
6
+ it "has one window" do
7
+ @app.windows.size.should == 1
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-kit-templates
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Colin T.A. Gray
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-16 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: ''
14
+ email:
15
+ - colinta@gmail.com
16
+ executables: []
17
+ extensions:
18
+ - ext/extconf.rb
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ext/extconf.rb
22
+ - templates/mk-ios/files/app/app_delegate.rb
23
+ - templates/mk-ios/files/app/main/main_controller.rb
24
+ - templates/mk-ios/files/app/main/main_layout.rb
25
+ - templates/mk-ios/files/Gemfile
26
+ - templates/mk-ios/files/Rakefile.erb
27
+ - templates/mk-ios/files/resources/Default-568h@2x.png
28
+ - templates/mk-ios/files/spec/main_spec.rb.erb
29
+ - templates/mk-osx/files/app/app_delegate.rb
30
+ - templates/mk-osx/files/app/main/main_window_controller.rb
31
+ - templates/mk-osx/files/app/main/main_window_layout.rb
32
+ - templates/mk-osx/files/app/main_menu.rb
33
+ - templates/mk-osx/files/Gemfile
34
+ - templates/mk-osx/files/Rakefile.erb
35
+ - templates/mk-osx/files/resources/Credits.rtf
36
+ - templates/mk-osx/files/spec/main_spec.rb.erb
37
+ - README.md
38
+ homepage: https://github.com/rubymotion/motion-kit-templates
39
+ licenses:
40
+ - BSD
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 2.0.3
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: Create projects with the `motion create --template=motion-kit-...` command.
62
+ test_files: []