motion-momentum 0.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +17 -0
- data/Rakefile +37 -0
- data/app/ios/app_delegate.rb +5 -0
- data/app/osx/app_delegate.rb +15 -0
- data/app/osx/menu.rb +130 -0
- data/lib/motion-momentum-ios/controller/view_controller.rb +5 -0
- data/lib/motion-momentum-ios/controller/view_controller_module.rb +62 -0
- data/lib/motion-momentum-osx/.gitkeep +0 -0
- data/lib/motion-momentum.rb +4 -0
- data/lib/motion-momentum/delegate/delegate.rb +5 -0
- data/lib/motion-momentum/delegate/delegate_module.rb +18 -0
- data/lib/motion-momentum/version.rb +3 -0
- data/motion-momentum.gemspec +24 -0
- data/resources/ios/.gitkeep +0 -0
- data/resources/osx/.gitkeep +0 -0
- data/spec/motion-momentum-ios/controller/view_controller_spec.rb +92 -0
- data/spec/motion-momentum-ios/mocks/controllers/custom_mock_controller.rb +5 -0
- data/spec/motion-momentum-ios/mocks/controllers/mock_controller.rb +8 -0
- data/spec/motion-momentum-ios/mocks/controllers/no_setup_mock_controller.rb +2 -0
- data/spec/motion-momentum-ios/mocks/delegates/custom_data_source.rb +2 -0
- data/spec/motion-momentum-ios/mocks/delegates/mock_delegate.rb +2 -0
- data/spec/motion-momentum-ios/mocks/stylesheets/custom_styles.rb +2 -0
- data/spec/motion-momentum-ios/mocks/stylesheets/mock_stylesheet.rb +2 -0
- data/spec/motion-momentum-ios/mocks/views/custom_mock_scroll_view.rb +2 -0
- data/spec/motion-momentum-ios/mocks/views/mock_view.rb +11 -0
- data/spec/motion-momentum-ios/mocks/views/no_delegate_or_data_source_mock_view.rb +2 -0
- data/spec/motion-momentum-osx/fake_spec.rb +5 -0
- data/spec/motion-momentum/delegate/delegate_spec.rb +9 -0
- data/spec/motion-momentum/mocks/callback_helper.rb +11 -0
- data/spec/motion-momentum/mocks/general_mock_delegate.rb +2 -0
- metadata +139 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ddc2e4b530fce838ceab0386e65b3f0a9b7d8a96
|
4
|
+
data.tar.gz: 07d02f37340b839d82333534cfd24a5bc7b95594
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4438273e9bb261496f03fa5b78242525b446241a2440bda22ca296433b756db5267f5c53aca4bec1ee80fd4c6c720482155cefebd68aea292c34b63778365ff3
|
7
|
+
data.tar.gz: 1a816fbfd0943af5fc2de2dafcdca02ab86dbad872aa345168b82dde66a210b1feb7b3c876de78efd5b6e482c2e0754dbd5fcfb7c8fa7922b05a13009dcc4ef0
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Jack Dean Watson-Hamblin
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Momentum
|
2
|
+
|
3
|
+
[](https://travis-ci.org/FluffyJack/motion-momentum) [](https://codeclimate.com/github/FluffyJack/motion-momentum) [](https://gemnasium.com/FluffyJack/motion-momentum)
|
4
|
+
|
5
|
+
Momentum is a RubyMotion framework for creating iOS and OS X applications the "Rails" way.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Proposed ideas can be found in this gist: [https://gist.github.com/FluffyJack/9409243](https://gist.github.com/FluffyJack/9409243)
|
10
|
+
|
11
|
+
## Contributing
|
12
|
+
|
13
|
+
1. Fork it ( http://github.com/FluffyJack/motion-momentum/fork )
|
14
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
15
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
16
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
17
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
$:.unshift("/Library/RubyMotion/lib")
|
2
|
+
if ENV['osx']
|
3
|
+
require 'motion/project/template/osx'
|
4
|
+
else
|
5
|
+
require 'motion/project/template/ios'
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'bundler'
|
9
|
+
Bundler.require(:development)
|
10
|
+
|
11
|
+
require 'motion-momentum'
|
12
|
+
|
13
|
+
module Motion
|
14
|
+
module Project
|
15
|
+
class Config
|
16
|
+
def spec_files=(spec_files)
|
17
|
+
@spec_files = spec_files
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Motion::Project::App.setup do |app|
|
24
|
+
app.name = 'MomentumTest'
|
25
|
+
app.identifier = 'tv.motioninmotion.MomentumTest'
|
26
|
+
app.version = Momentum::VERSION
|
27
|
+
app.redgreen_style = :full
|
28
|
+
app.detect_dependencies = true
|
29
|
+
|
30
|
+
# Get correct files for iOS or OS X
|
31
|
+
app.files -= Dir.glob('./app/**/*.rb')
|
32
|
+
app.files += Dir.glob("./app/#{app.template}/**/*.rb")
|
33
|
+
app.spec_files -= Dir.glob('./spec/**/*.rb')
|
34
|
+
app.spec_files += Dir.glob('./spec/motion-momentum/**/*.rb')
|
35
|
+
app.spec_files += Dir.glob("./spec/motion-momentum-#{app.template}/**/*.rb")
|
36
|
+
app.resources_dirs = ["resources/#{app.template}"]
|
37
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class AppDelegate
|
2
|
+
def applicationDidFinishLaunching(notification)
|
3
|
+
buildMenu
|
4
|
+
buildWindow
|
5
|
+
end
|
6
|
+
|
7
|
+
def buildWindow
|
8
|
+
@mainWindow = NSWindow.alloc.initWithContentRect([[240, 180], [480, 360]],
|
9
|
+
styleMask: NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask,
|
10
|
+
backing: NSBackingStoreBuffered,
|
11
|
+
defer: false)
|
12
|
+
@mainWindow.title = NSBundle.mainBundle.infoDictionary['CFBundleName']
|
13
|
+
@mainWindow.orderFrontRegardless
|
14
|
+
end
|
15
|
+
end
|
data/app/osx/menu.rb
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
class AppDelegate
|
2
|
+
def buildMenu
|
3
|
+
@mainMenu = NSMenu.new
|
4
|
+
|
5
|
+
addAppNameMenu
|
6
|
+
addFileMenu
|
7
|
+
addEditMenu
|
8
|
+
|
9
|
+
fontMenu = createFontMenu
|
10
|
+
textMenu = createTextMenu
|
11
|
+
addMenu('Format') do
|
12
|
+
addItem fontMenu
|
13
|
+
addItem textMenu
|
14
|
+
end
|
15
|
+
|
16
|
+
addViewMenu
|
17
|
+
|
18
|
+
NSApp.windowsMenu = addMenu('Window') do
|
19
|
+
addItemWithTitle('Minimize', action: 'performMiniaturize:', keyEquivalent: 'm')
|
20
|
+
addItemWithTitle('Zoom', action: 'performZoom:', keyEquivalent: '')
|
21
|
+
addItem(NSMenuItem.separatorItem)
|
22
|
+
addItemWithTitle('Bring All To Front', action: 'arrangeInFront:', keyEquivalent: '')
|
23
|
+
end.menu
|
24
|
+
|
25
|
+
NSApp.helpMenu = addMenu('Help') do
|
26
|
+
addItemWithTitle("#{NSBundle.mainBundle.infoDictionary['CFBundleName']} Help", action: 'showHelp:', keyEquivalent: '?')
|
27
|
+
end.menu
|
28
|
+
|
29
|
+
NSApp.mainMenu = @mainMenu
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def addAppNameMenu
|
35
|
+
appName = NSBundle.mainBundle.infoDictionary['CFBundleName']
|
36
|
+
addMenu(appName) do
|
37
|
+
addItemWithTitle("About #{appName}", action: 'orderFrontStandardAboutPanel:', keyEquivalent: '')
|
38
|
+
addItem(NSMenuItem.separatorItem)
|
39
|
+
addItemWithTitle('Preferences', action: 'openPreferences:', keyEquivalent: ',')
|
40
|
+
addItem(NSMenuItem.separatorItem)
|
41
|
+
servicesItem = addItemWithTitle('Services', action: nil, keyEquivalent: '')
|
42
|
+
NSApp.servicesMenu = servicesItem.submenu = NSMenu.new
|
43
|
+
addItem(NSMenuItem.separatorItem)
|
44
|
+
addItemWithTitle("Hide #{appName}", action: 'hide:', keyEquivalent: 'h')
|
45
|
+
item = addItemWithTitle('Hide Others', action: 'hideOtherApplications:', keyEquivalent: 'H')
|
46
|
+
item.keyEquivalentModifierMask = NSCommandKeyMask|NSAlternateKeyMask
|
47
|
+
addItemWithTitle('Show All', action: 'unhideAllApplications:', keyEquivalent: '')
|
48
|
+
addItem(NSMenuItem.separatorItem)
|
49
|
+
addItemWithTitle("Quit #{appName}", action: 'terminate:', keyEquivalent: 'q')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def addFileMenu
|
54
|
+
addMenu('File') do
|
55
|
+
addItemWithTitle('New', action: 'newDocument:', keyEquivalent: 'n')
|
56
|
+
addItemWithTitle('Open…', action: 'openDocument:', keyEquivalent: 'o')
|
57
|
+
addItem(NSMenuItem.separatorItem)
|
58
|
+
addItemWithTitle('Close', action: 'performClose:', keyEquivalent: 'w')
|
59
|
+
addItemWithTitle('Save…', action: 'saveDocument:', keyEquivalent: 's')
|
60
|
+
addItemWithTitle('Revert to Saved', action: 'revertDocumentToSaved:', keyEquivalent: '')
|
61
|
+
addItem(NSMenuItem.separatorItem)
|
62
|
+
addItemWithTitle('Page Setup…', action: 'runPageLayout:', keyEquivalent: 'P')
|
63
|
+
addItemWithTitle('Print…', action: 'printDocument:', keyEquivalent: 'p')
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def addEditMenu
|
68
|
+
addMenu('Edit') do
|
69
|
+
addItemWithTitle('Undo', action: 'undo:', keyEquivalent: 'z')
|
70
|
+
addItemWithTitle('Redo', action: 'redo:', keyEquivalent: 'Z')
|
71
|
+
addItem(NSMenuItem.separatorItem)
|
72
|
+
addItemWithTitle('Cut', action: 'cut:', keyEquivalent: 'x')
|
73
|
+
addItemWithTitle('Copy', action: 'copy:', keyEquivalent: 'c')
|
74
|
+
addItemWithTitle('Paste', action: 'paste:', keyEquivalent: 'v')
|
75
|
+
item = addItemWithTitle('Paste and Match Style', action: 'pasteAsPlainText:', keyEquivalent: 'V')
|
76
|
+
item.keyEquivalentModifierMask = NSCommandKeyMask|NSAlternateKeyMask
|
77
|
+
addItemWithTitle('Delete', action: 'delete:', keyEquivalent: '')
|
78
|
+
addItemWithTitle('Select All', action: 'selectAll:', keyEquivalent: 'a')
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def addViewMenu
|
83
|
+
addMenu('View') do
|
84
|
+
item = addItemWithTitle('Show Toolbar', action: 'toggleToolbarShown:', keyEquivalent: 't')
|
85
|
+
item.keyEquivalentModifierMask = NSCommandKeyMask|NSAlternateKeyMask
|
86
|
+
addItemWithTitle('Customize Toolbar…', action: 'runToolbarCustomizationPalette:', keyEquivalent: '')
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def addMenu(title, &b)
|
91
|
+
item = createMenu(title, &b)
|
92
|
+
@mainMenu.addItem item
|
93
|
+
item
|
94
|
+
end
|
95
|
+
|
96
|
+
def createFontMenu
|
97
|
+
createMenu('Font') do
|
98
|
+
addItemWithTitle('Show Fonts', action: 'orderFrontFontPanel:', keyEquivalent: 't')
|
99
|
+
addItemWithTitle('Bold', action: 'addFontTrait:', keyEquivalent: 'b')
|
100
|
+
addItemWithTitle('Italic', action: 'addFontTrait:', keyEquivalent: 'i')
|
101
|
+
addItemWithTitle('Underline', action: 'underline:', keyEquivalent: 'u')
|
102
|
+
addItem(NSMenuItem.separatorItem)
|
103
|
+
addItemWithTitle('Bigger', action: 'modifyFont:', keyEquivalent: '+')
|
104
|
+
addItemWithTitle('Smaller', action: 'modifyFont:', keyEquivalent: '-')
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def createTextMenu
|
109
|
+
createMenu('Text') do
|
110
|
+
addItemWithTitle('Align Left', action: 'alignLeft:', keyEquivalent: '{')
|
111
|
+
addItemWithTitle('Center', action: 'alignCenter:', keyEquivalent: '|')
|
112
|
+
addItemWithTitle('Justify', action: 'alignJustified:', keyEquivalent: '')
|
113
|
+
addItemWithTitle('Align Right', action: 'alignRight:', keyEquivalent: '}')
|
114
|
+
addItem(NSMenuItem.separatorItem)
|
115
|
+
addItemWithTitle('Show Ruler', action: 'toggleRuler:', keyEquivalent: '')
|
116
|
+
item = addItemWithTitle('Copy Ruler', action: 'copyRuler:', keyEquivalent: 'c')
|
117
|
+
item.keyEquivalentModifierMask = NSCommandKeyMask|NSControlKeyMask
|
118
|
+
item = addItemWithTitle('Paste Ruler', action: 'pasteRuler:', keyEquivalent: 'v')
|
119
|
+
item.keyEquivalentModifierMask = NSCommandKeyMask|NSControlKeyMask
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def createMenu(title, &b)
|
124
|
+
menu = NSMenu.alloc.initWithTitle(title)
|
125
|
+
menu.instance_eval(&b) if b
|
126
|
+
item = NSMenuItem.alloc.initWithTitle(title, action: nil, keyEquivalent: '')
|
127
|
+
item.submenu = menu
|
128
|
+
item
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Momentum
|
2
|
+
module ViewControllerModule
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
base.extend(ClassMethods)
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
%w(view delegate stylesheet).each do |class_helper_method|
|
10
|
+
define_method class_helper_method.to_sym do |class_string|
|
11
|
+
send :define_method, "#{class_helper_method}_class".to_sym do
|
12
|
+
if Object.const_defined? class_string
|
13
|
+
Object.const_get class_string
|
14
|
+
else
|
15
|
+
puts "[Momentum Warning] ::: The #{class_helper_method} class #{class_string} does not exist, you attempted to use it in #{self.class}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def title(title)
|
22
|
+
send :define_method, :class_title do
|
23
|
+
title
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
attr_accessor :delegate, :delegate_class, :view_class, :stylesheet_class, :class_title
|
29
|
+
|
30
|
+
def init
|
31
|
+
super
|
32
|
+
self.view_class = find_related_class('View')
|
33
|
+
self.delegate_class = find_related_class('Delegate')
|
34
|
+
self.stylesheet_class = find_related_class('Stylesheet')
|
35
|
+
self
|
36
|
+
end
|
37
|
+
|
38
|
+
def loadView
|
39
|
+
self.view = self.view_class.new
|
40
|
+
self.delegate = self.delegate_class.new
|
41
|
+
self.view.delegate = self.delegate if self.view.class.instance_methods.include?(:delegate)
|
42
|
+
self.view.dataSource = self.delegate if self.view.class.instance_methods.include?(:dataSource)
|
43
|
+
end
|
44
|
+
|
45
|
+
def viewDidAppear(animated)
|
46
|
+
self.setup if self.class.instance_methods.include?(:setup)
|
47
|
+
end
|
48
|
+
|
49
|
+
def title
|
50
|
+
super || class_title
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def find_related_class(type)
|
56
|
+
class_string = self.class.to_s.gsub('Controller', type)
|
57
|
+
if Object.const_defined? class_string
|
58
|
+
Object.const_get class_string
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
File without changes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'motion-momentum/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "motion-momentum"
|
8
|
+
spec.version = Momentum::VERSION
|
9
|
+
spec.authors = ["Jack Dean Watson-Hamblin"]
|
10
|
+
spec.email = ["info@fluffyjack.com"]
|
11
|
+
spec.summary = %q{Momentum is a RubyMotion framework for creating iOS and OS X applications the "Rails" way.}
|
12
|
+
spec.description = %q{Whether you're a Rails developer or not, RubyMotion is Ruby for iOS and OS X and so it should be treated that way. Momentum is a RubyMotion framework for creating iOS and OS X applications the "Rails" way, with helpful ways to clean up and organise your code, and some standardised convention-over-configuration stuff.}
|
13
|
+
spec.homepage = "https://github.com/FluffyJack/motion-momentum"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(spec)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", ">= 1.3.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "motion-redgreen"
|
24
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,92 @@
|
|
1
|
+
describe Momentum::ViewController do
|
2
|
+
|
3
|
+
context "normal controller" do
|
4
|
+
|
5
|
+
before { @vc = MockController.new }
|
6
|
+
|
7
|
+
it "should default to using MockView as it's view class" do
|
8
|
+
@vc.view_class.should == MockView
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should default to using MockDelegate as it's delegate class" do
|
12
|
+
@vc.delegate_class.should == MockDelegate
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should default to using MockStylesheet as it's stylesheet class" do
|
16
|
+
@vc.stylesheet_class.should == MockStylesheet
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should use the view class as it's view when the view is loaded" do
|
20
|
+
@vc.loadView
|
21
|
+
@vc.view.class.should == MockView
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should use the delegate class as it's delegate when the view is loaded" do
|
25
|
+
@vc.loadView
|
26
|
+
@vc.delegate.class.should == MockDelegate
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should use the delegate class as the view's delegate when the view is loaded" do
|
30
|
+
@vc.loadView
|
31
|
+
@vc.view.delegate.class.should == MockDelegate
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should use the delegate class as the view's dataSource when the view is loaded" do
|
35
|
+
@vc.loadView
|
36
|
+
@vc.view.dataSource.class.should == MockDelegate
|
37
|
+
end
|
38
|
+
|
39
|
+
it "does not set the delegate or data source on the view if it does not need one" do
|
40
|
+
@vc.view_class = NoDelegateOrDataSourceMockView
|
41
|
+
lambda { @vc.loadView }.should.not.raise(NoMethodError)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "calls setup if it's defined when the view appears" do
|
45
|
+
CallbackHelper.shared.data[:setup_called] = false
|
46
|
+
@vc.viewDidAppear(true)
|
47
|
+
CallbackHelper.shared.data[:setup_called].should == true
|
48
|
+
end
|
49
|
+
|
50
|
+
it "can set the title for the class" do
|
51
|
+
@vc.title.should == "Mock"
|
52
|
+
end
|
53
|
+
|
54
|
+
it "will still use the title instance variable though" do
|
55
|
+
@vc.viewDidAppear(true)
|
56
|
+
@vc.title.should == "Custom"
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
context "no setup controller" do
|
62
|
+
|
63
|
+
before { @vc = NoSetupMockController.new }
|
64
|
+
|
65
|
+
it "does not call setup if it's not defined when the view appears" do
|
66
|
+
lambda { @vc.viewDidAppear(true) }.should.not.raise(NoMethodError)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "will return nil with no class title or title instance variable" do
|
70
|
+
@vc.title.should == nil
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
context "custom related classes controller" do
|
76
|
+
|
77
|
+
before { @vc = CustomMockController.new }
|
78
|
+
|
79
|
+
it "uses the defined view" do
|
80
|
+
@vc.view_class.should == CustomMockScrollView
|
81
|
+
end
|
82
|
+
|
83
|
+
it "uses the defined delegate" do
|
84
|
+
@vc.delegate_class.should == CustomDataSource
|
85
|
+
end
|
86
|
+
|
87
|
+
it "uses the defined stylesheet" do
|
88
|
+
@vc.stylesheet_class.should == CustomStyles
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: motion-momentum
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jack Dean Watson-Hamblin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.3.5
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.3.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: motion-redgreen
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Whether you're a Rails developer or not, RubyMotion is Ruby for iOS and
|
56
|
+
OS X and so it should be treated that way. Momentum is a RubyMotion framework for
|
57
|
+
creating iOS and OS X applications the "Rails" way, with helpful ways to clean up
|
58
|
+
and organise your code, and some standardised convention-over-configuration stuff.
|
59
|
+
email:
|
60
|
+
- info@fluffyjack.com
|
61
|
+
executables: []
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- ".gitignore"
|
66
|
+
- ".travis.yml"
|
67
|
+
- Gemfile
|
68
|
+
- LICENSE.txt
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- app/ios/app_delegate.rb
|
72
|
+
- app/osx/app_delegate.rb
|
73
|
+
- app/osx/menu.rb
|
74
|
+
- lib/motion-momentum-ios/controller/view_controller.rb
|
75
|
+
- lib/motion-momentum-ios/controller/view_controller_module.rb
|
76
|
+
- lib/motion-momentum-osx/.gitkeep
|
77
|
+
- lib/motion-momentum.rb
|
78
|
+
- lib/motion-momentum/delegate/delegate.rb
|
79
|
+
- lib/motion-momentum/delegate/delegate_module.rb
|
80
|
+
- lib/motion-momentum/version.rb
|
81
|
+
- motion-momentum.gemspec
|
82
|
+
- resources/ios/.gitkeep
|
83
|
+
- resources/osx/.gitkeep
|
84
|
+
- spec/motion-momentum-ios/controller/view_controller_spec.rb
|
85
|
+
- spec/motion-momentum-ios/mocks/controllers/custom_mock_controller.rb
|
86
|
+
- spec/motion-momentum-ios/mocks/controllers/mock_controller.rb
|
87
|
+
- spec/motion-momentum-ios/mocks/controllers/no_setup_mock_controller.rb
|
88
|
+
- spec/motion-momentum-ios/mocks/delegates/custom_data_source.rb
|
89
|
+
- spec/motion-momentum-ios/mocks/delegates/mock_delegate.rb
|
90
|
+
- spec/motion-momentum-ios/mocks/stylesheets/custom_styles.rb
|
91
|
+
- spec/motion-momentum-ios/mocks/stylesheets/mock_stylesheet.rb
|
92
|
+
- spec/motion-momentum-ios/mocks/views/custom_mock_scroll_view.rb
|
93
|
+
- spec/motion-momentum-ios/mocks/views/mock_view.rb
|
94
|
+
- spec/motion-momentum-ios/mocks/views/no_delegate_or_data_source_mock_view.rb
|
95
|
+
- spec/motion-momentum-osx/fake_spec.rb
|
96
|
+
- spec/motion-momentum/delegate/delegate_spec.rb
|
97
|
+
- spec/motion-momentum/mocks/callback_helper.rb
|
98
|
+
- spec/motion-momentum/mocks/general_mock_delegate.rb
|
99
|
+
homepage: https://github.com/FluffyJack/motion-momentum
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata: {}
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 2.1.11
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: Momentum is a RubyMotion framework for creating iOS and OS X applications
|
123
|
+
the "Rails" way.
|
124
|
+
test_files:
|
125
|
+
- spec/motion-momentum-ios/controller/view_controller_spec.rb
|
126
|
+
- spec/motion-momentum-ios/mocks/controllers/custom_mock_controller.rb
|
127
|
+
- spec/motion-momentum-ios/mocks/controllers/mock_controller.rb
|
128
|
+
- spec/motion-momentum-ios/mocks/controllers/no_setup_mock_controller.rb
|
129
|
+
- spec/motion-momentum-ios/mocks/delegates/custom_data_source.rb
|
130
|
+
- spec/motion-momentum-ios/mocks/delegates/mock_delegate.rb
|
131
|
+
- spec/motion-momentum-ios/mocks/stylesheets/custom_styles.rb
|
132
|
+
- spec/motion-momentum-ios/mocks/stylesheets/mock_stylesheet.rb
|
133
|
+
- spec/motion-momentum-ios/mocks/views/custom_mock_scroll_view.rb
|
134
|
+
- spec/motion-momentum-ios/mocks/views/mock_view.rb
|
135
|
+
- spec/motion-momentum-ios/mocks/views/no_delegate_or_data_source_mock_view.rb
|
136
|
+
- spec/motion-momentum-osx/fake_spec.rb
|
137
|
+
- spec/motion-momentum/delegate/delegate_spec.rb
|
138
|
+
- spec/motion-momentum/mocks/callback_helper.rb
|
139
|
+
- spec/motion-momentum/mocks/general_mock_delegate.rb
|