indoctrinator 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd52b2c58a9a43ddf0091d4bc98b375944aff0e3
4
- data.tar.gz: 88df0624688707df03d47a4e42581511675e6bbe
3
+ metadata.gz: b4ab1b1d3a40ecdb8cc54232407175592b030be1
4
+ data.tar.gz: c11a5a7f80c416e911874625e9a12d782afe796f
5
5
  SHA512:
6
- metadata.gz: 61e5c3f6b995a2380abc58c2a1f47eba62473b0507e7911a04922cbb7d64493332ef8077af15e9d102ed8d3935c3bb1a7e25e79b14b67556d4de3d10d4f189d3
7
- data.tar.gz: 8f40540d094b3a30c20459f692b433703571a9fdd76fbf8b02376e731166de7b3d7861e11ce5822dd87710633aa4db187b11b9f5202bc7024f9e27daf35fdd20
6
+ metadata.gz: 10f94eac332dd3f97ef989dc25fef7a187a6f53720867d31a210e35e59464ac1e21b3de349d0361df9a4b66ab96ca46cb7ef95a5a02e91625ff88a1f2e452157
7
+ data.tar.gz: 2f6eed3a488a85c03a47f854ce837c49fde1b0e106895532c559c1659911bfa846c199c2c4df11958aa9886382a75c5de348b2966016eafe90c56d28ab726d73
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
- # indoctrinator
1
+ # Indoctrinator
2
2
 
3
- TODO: Write a gem description
3
+ Indoctrinator is a RubyMotion gem that provides a Path style tutorial view for iOS applications. Utilizing the [ICETutorial](https://github.com/icepat/ICETutorial) pod, indoctrinator makes it easy to add a tutorial slideshow to your app.
4
4
 
5
5
  ## Installation
6
6
 
7
+ ### Bundler
8
+
7
9
  Add this line to your application's Gemfile:
8
10
 
9
11
  gem 'indoctrinator'
@@ -12,13 +14,30 @@ And then execute:
12
14
 
13
15
  $ bundle
14
16
 
15
- Or install it yourself as:
17
+ ### Rakefile
18
+
19
+ Currently there is a bug with [motion-cocoapods](https://github.com/HipByte/motion-cocoapods/issues/38) that doesn't allow us to automatically include an ObjC library automatically. Because of this, you will need to edit your Rakefile as follows:
16
20
 
17
- $ gem install indoctrinator
21
+ ```ruby
22
+ app.pods do
23
+ pod 'PKRevealController'
24
+ end
25
+ ```
18
26
 
19
27
  ## Usage
20
28
 
21
- TODO: Write usage instructions here
29
+ ```ruby
30
+ # A simple tutorial consisting of three pages
31
+ tut1 = Indoctrinator::Page.new(image: "tutorial1")
32
+ tut2 = Indoctrinator::Page.new(image: "tutorial2")
33
+ tut3 = Indoctrinator::Page.new(image: "tutorial3")
34
+ Indoctrinator::Tutorial.new([tut1, tut2, tut3])
35
+
36
+ # Tutorials may also have a title
37
+ Indoctrinator::Tutorial.new([tut1, tut2, tut3], title: "My Tutorial")
38
+
39
+ # More to come...
40
+ ```
22
41
 
23
42
  ## Contributing
24
43
 
@@ -1,4 +1,4 @@
1
- class Indoctrinator
1
+ $stderr.puts "Please add the CocoaPod ICETutorial" unless defined?(ICETutorialController)
2
2
 
3
+ module Indoctinator
3
4
  end
4
-
@@ -0,0 +1,7 @@
1
+ module Indoctrinator
2
+ class Page < ICETutorialPage
3
+ def self.new(args={})
4
+ self.alloc.initWithSubTitle(args[:subtitle], description: args[:description], pictureName: args[:image])
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,75 @@
1
+ module Indoctrinator
2
+ class Tutorial < ICETutorialController
3
+
4
+ def self.new(pages, args={})
5
+ tutorial = self.alloc.initWithNibName("ICETutorialController_iPhone", bundle: nil)
6
+ tutorial.pages = pages
7
+ tutorial.title = args[:title]
8
+ tutorial.remove_buttons
9
+ tutorial.button1 = args[:button1]
10
+ tutorial.button2 = args[:button2]
11
+ tutorial
12
+ end
13
+
14
+ def viewDidAppear(animated)
15
+ super
16
+ self.center_pager
17
+ end
18
+
19
+ def pages=(pages)
20
+ @pages = pages
21
+ self.setPages(Array(pages))
22
+ end
23
+
24
+ def pages
25
+ @pages
26
+ end
27
+
28
+ def title=(label)
29
+ return self.remove(:title) unless label
30
+ if label.is_a?(String)
31
+ self.title.text = label if self.title
32
+ else
33
+ self.remove(:title)
34
+ self.view.addSubview label
35
+ end
36
+ end
37
+
38
+ def title
39
+ @title ||= self.view.subviews.find{ |v| v.is_a?(UILabel) }
40
+ end
41
+
42
+ def remove_buttons
43
+ self.view.subviews.select{ |v| v.is_a?(UIButton) }.each(&:removeFromSuperview)
44
+ end
45
+
46
+ def button1=(button)
47
+ @button1 = button
48
+ self.view.addSubview @button1
49
+ end
50
+
51
+ def button1
52
+ @button1
53
+ end
54
+
55
+ def button2=(button)
56
+ @button2 = button
57
+ self.view.addSubview @button2
58
+ end
59
+
60
+ def button2
61
+ @button2
62
+ end
63
+
64
+ def center_pager
65
+ screen_size = UIScreen.mainScreen.bounds.size
66
+ pc = self.view.subviews.find{ |v| v.is_a?(UIPageControl) }
67
+ pc.frame = [[0, screen_size.height - 100],[screen_size.width, 36]]
68
+ end
69
+
70
+ def remove(v)
71
+ self.send(v).removeFromSuperview if self.send(v) && self.send(v).respond_to?(:removeFromSuperview)
72
+ self.instance_variable_set "@#{v}", nil
73
+ end
74
+ end
75
+ end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: indoctrinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Linton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-27 00:00:00.000000000 Z
11
+ date: 2013-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: motion-cocoapods
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -24,7 +38,7 @@ dependencies:
24
38
  - - '>='
25
39
  - !ruby/object:Gem::Version
26
40
  version: '0'
27
- description: Provides a Path style tutorial for RubyMotion apps.
41
+ description: Provides a Path style tutorial view for RubyMotion apps.
28
42
  email:
29
43
  - ryanlntn@gmail.com
30
44
  executables: []
@@ -34,6 +48,8 @@ files:
34
48
  - README.md
35
49
  - lib/indoctrinator.rb
36
50
  - lib/project/indoctrinator.rb
51
+ - lib/project/page.rb
52
+ - lib/project/tutorial.rb
37
53
  homepage: https://github.com/ryanlntn/indoctrinator
38
54
  licenses:
39
55
  - MIT
@@ -54,8 +70,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
70
  version: '0'
55
71
  requirements: []
56
72
  rubyforge_project:
57
- rubygems_version: 2.0.3
73
+ rubygems_version: 2.0.6
58
74
  signing_key:
59
75
  specification_version: 4
60
- summary: Provides a Path style tutorial for RubyMotion apps.
76
+ summary: Provides a Path style tutorial view for RubyMotion apps.
61
77
  test_files: []