motion-dynamic-type 0.1.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: 8e9f3b9e364e8959b8abf8ff03e4ee4a3978bbf4
4
+ data.tar.gz: d2d86069715b6af66067dc2678b85830b0e680b4
5
+ SHA512:
6
+ metadata.gz: 679326b34d51fb4fe617da4d5f673631de0518d82da3c1a13b159957e4afbb34701943863d1fcc178b21998e4e52e23fdaf7d76fc371796d03200c7b04b22be4
7
+ data.tar.gz: c743165803e472298afdc6d3a63058be81d4bbb0f8e818f4d26ba9b73fdcd28cf089a98522a6fa6a47d8f478287c8155a35b4f817a192ac048b9f8ec7e32252b
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ build
19
+ .repl_history
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in motion-dynamic-type.gemspec
4
+ gemspec
@@ -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.
@@ -0,0 +1,29 @@
1
+ # Motion::Dynamic::Type
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'motion-dynamic-type'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install motion-dynamic-type
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( http://github.com/<my-github-username>/motion-dynamic-type/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,15 @@
1
+ $:.unshift("/Library/RubyMotion/lib")
2
+ require 'motion/project/template/ios'
3
+
4
+ require 'bundler'
5
+ Bundler.require(:development)
6
+
7
+ require 'motion-dynamic-type'
8
+
9
+ Motion::Project::App.setup do |app|
10
+ app.name = 'MotionDynamicTypeTest'
11
+ app.version = "0.0.1"
12
+ app.redgreen_style = :full
13
+ app.deployment_target = "7.0"
14
+ app.detect_dependencies = true
15
+ end
@@ -0,0 +1,5 @@
1
+ class AppDelegate
2
+ def application(application, didFinishLaunchingWithOptions:launchOptions)
3
+ true
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ Motion::Project::App.setup do |app|
2
+ Dir.glob(File.join(File.dirname(__FILE__), 'motion-dynamic-type/*.rb')).each do |file|
3
+ app.files.unshift(file)
4
+ end
5
+ end
@@ -0,0 +1,29 @@
1
+ module MotionDynamicType
2
+ class Font
3
+ class << self
4
+ def body
5
+ UIFont.preferredFontForTextStyle(UIFontTextStyleBody)
6
+ end
7
+
8
+ def headline
9
+ UIFont.preferredFontForTextStyle(UIFontTextStyleHeadline)
10
+ end
11
+
12
+ def subhead
13
+ UIFont.preferredFontForTextStyle(UIFontTextStyleSubheadline)
14
+ end
15
+
16
+ def caption_one
17
+ UIFont.preferredFontForTextStyle(UIFontTextStyleCaption1)
18
+ end
19
+
20
+ def caption_two
21
+ UIFont.preferredFontForTextStyle(UIFontTextStyleCaption2)
22
+ end
23
+
24
+ def footnote
25
+ UIFont.preferredFontForTextStyle(UIFontTextStyleFootnote)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,4 @@
1
+ module MotionDynamicType
2
+ VERSION = "0.1.0"
3
+ end
4
+ ::MDT = MotionDynamicType unless defined?(::MDT)
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'motion-dynamic-type/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "motion-dynamic-type"
8
+ spec.version = MotionDynamicType::VERSION
9
+ spec.authors = ["Jack Dean Watson-Hamblin"]
10
+ spec.email = ["info@fluffyjack.com"]
11
+ spec.summary = %q{Simplifying even further iOS 7's Dynamic Type}
12
+ spec.description = %q{A simple RubyMotion wrapper for iOS 7's Dynamic Type to make it easier to set the fonts, as well as getting the information you need and notifications for responding to the layout changes}
13
+ spec.homepage = "https://github.com/FluffyJack/motion-dynamic-type"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.test_files = spec.files.grep(%r{^(spec)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.5"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency("motion-redgreen")
23
+ end
@@ -0,0 +1,63 @@
1
+ describe MotionDynamicType::Font do
2
+
3
+ describe "#body" do
4
+
5
+ it "should have the same font descriptor as the body font descriptor when asked for the body font" do
6
+ mdt_font_descriptor = MotionDynamicType::Font.body.fontDescriptor
7
+ ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleBody)
8
+ mdt_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"].should == ui_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"]
9
+ end
10
+
11
+ end
12
+
13
+ describe "#headline" do
14
+
15
+ it "should have the same font descriptor as the headline font descriptor when asked for the headline font" do
16
+ mdt_font_descriptor = MotionDynamicType::Font.headline.fontDescriptor
17
+ ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleHeadline)
18
+ mdt_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"].should == ui_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"]
19
+ end
20
+
21
+ end
22
+
23
+ describe "#subhead" do
24
+
25
+ it "should have the same font descriptor as the subheadline font descriptor when asked for the subheadline font" do
26
+ mdt_font_descriptor = MotionDynamicType::Font.subhead.fontDescriptor
27
+ ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleSubheadline)
28
+ mdt_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"].should == ui_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"]
29
+ end
30
+
31
+ end
32
+
33
+ describe "#caption_one" do
34
+
35
+ it "should have the same font descriptor as the caption one font descriptor when asked for the caption one font" do
36
+ mdt_font_descriptor = MotionDynamicType::Font.caption_one.fontDescriptor
37
+ ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleCaption1)
38
+ mdt_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"].should == ui_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"]
39
+ end
40
+
41
+ end
42
+
43
+ describe "#caption_two" do
44
+
45
+ it "should have the same font descriptor as the caption two font descriptor when asked for the caption two font" do
46
+ mdt_font_descriptor = MotionDynamicType::Font.caption_two.fontDescriptor
47
+ ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleCaption2)
48
+ mdt_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"].should == ui_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"]
49
+ end
50
+
51
+ end
52
+
53
+ describe "#footnote" do
54
+
55
+ it "should have the same font descriptor as the footnote font descriptor when asked for the footnote font" do
56
+ mdt_font_descriptor = MotionDynamicType::Font.footnote.fontDescriptor
57
+ ui_font_descriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleFootnote)
58
+ mdt_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"].should == ui_font_descriptor.fontAttributes["NSCTFontUIUsageAttribute"]
59
+ end
60
+
61
+ end
62
+
63
+ end
@@ -0,0 +1,11 @@
1
+ describe "MotionDynamicType modules" do
2
+
3
+ it "should have an MotionDynamicType module" do
4
+ should.not.raise(NameError) { MotionDynamicType }
5
+ end
6
+
7
+ it "should have an MDT module" do
8
+ should.not.raise(NameError) { MDT }
9
+ end
10
+
11
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-dynamic-type
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-02-28 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.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.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: A simple RubyMotion wrapper for iOS 7's Dynamic Type to make it easier
56
+ to set the fonts, as well as getting the information you need and notifications
57
+ for responding to the layout changes
58
+ email:
59
+ - info@fluffyjack.com
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - app/app_delegate.rb
70
+ - lib/motion-dynamic-type.rb
71
+ - lib/motion-dynamic-type/font.rb
72
+ - lib/motion-dynamic-type/version.rb
73
+ - motion-dynamic-type.gemspec
74
+ - spec/font_spec.rb
75
+ - spec/main_spec.rb
76
+ homepage: https://github.com/FluffyJack/motion-dynamic-type
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.1.11
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Simplifying even further iOS 7's Dynamic Type
100
+ test_files:
101
+ - spec/font_spec.rb
102
+ - spec/main_spec.rb