playgroundbook 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50c5634d2dc4a7cc4835cb8f22d8635e5d6af5b9
4
- data.tar.gz: a63778b8a2f1ff34a8574eb32b248e4cfc9e5c37
3
+ metadata.gz: b9284005e400363b56c6ad72c74da1d147b5f63b
4
+ data.tar.gz: e082821228fd38d19d3af795a62d5c80988ecc86
5
5
  SHA512:
6
- metadata.gz: 1ef0dd0789b88d8e532cfc15012b46e041ab8d9ade116e017dfe89661283498f88e8c32551526a95f5233173b37c6513d0cbcb853267e252a8b33c093ee5ace4
7
- data.tar.gz: 71b69a509bfc4d797cc8bec0411e8781fc88232b17f5f7846a342cc35d1f7a811596f073f33ec369a7077e771a3301bd544456c562032ee067618d6a3c3a33aa
6
+ metadata.gz: 351ca7d6d4c5af5c6246ccfeb76c7139adde5eeec7a5bcc666b8ed1d1ecf7afc1de90a05ccfca3eacc9d9297af53e7c26947acf9b4a0abfc4f6c0738e7b99b1e
7
+ data.tar.gz: 380e9c62a03fab27bfff3e64b8f9262f9ebc895b992306eaa49a85428197ec8989b54180aa85013e7ef8e87f901394ee816e3c4c8ee653cda3d3ab61903740ad
data/Changelog.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  - Nothing yet.
4
4
 
5
+ # 0.2.1
6
+
7
+ - Support for cover images. See [#16](https://github.com/ashfurrow/playgroundbook/issues/16).
8
+
5
9
  # 0.2.0
6
10
 
7
11
  - Book rendering.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- playground-book-lint (0.2.0)
4
+ playgroundbook (0.2.1)
5
5
  colored (~> 1.2)
6
6
  cork (~> 0.1)
7
7
  plist (~> 3.2)
@@ -95,7 +95,7 @@ DEPENDENCIES
95
95
  guard-rspec
96
96
  mocha
97
97
  mocha-on-bacon
98
- playground-book-lint!
98
+ playgroundbook!
99
99
  prettybacon
100
100
  rubocop (~> 0.41.2)
101
101
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![CircleCI](https://circleci.com/gh/ashfurrow/playground-book-lint.svg?style=svg)](https://circleci.com/gh/ashfurrow/playground-book-lint)
1
+ [![CircleCI](https://circleci.com/gh/ashfurrow/playgroundbook.svg?style=svg)](https://circleci.com/gh/ashfurrow/playgroundbook)
2
2
 
3
3
  # playgroundbook
4
4
 
@@ -30,6 +30,7 @@ The yml file should be in the following format:
30
30
  name: Testing book
31
31
  identifier: com.ashfurrow.example
32
32
  resources: assets # Optional
33
+ cover: cover.jpeg # Optional
33
34
  deployment_target: ios10.0 # Optional
34
35
  imports: # Optional, defaults to UIKit
35
36
  - UIKit
@@ -40,12 +41,16 @@ chapters:
40
41
  - etc...
41
42
  ```
42
43
 
43
- Each chapter needs to have a corresponding playground; so `Chapter 1` requires there be a `Chapter 1.playground` playground. The playgrounds can reference (not copy) resources from an optionally specified directory. `import` frameworks are specified in the yaml file and are added to every page of the book. Each chapter needs to be in the following format:
44
+ Each chapter needs to have a corresponding playground; so `Chapter 1` requires there be a `Chapter 1.playground` playground. The playgrounds can reference (not copy) resources from an optionally specified directory. `import` frameworks are specified in the yaml file and are added to every page of the book. You can specify a cover image file name that's stored in the `resources` directory (it should be 400x300 pixels).
45
+
46
+ Each chapter needs to be in the following format:
44
47
 
45
48
  ```swift
46
49
  // This is the preamble that is shared among all the pages within this chapter.
47
50
 
48
- func sharedFunc() {
51
+ public var str = "Hi!"
52
+
53
+ public func sharedFunc() {
49
54
  print("This should be accessible to all pages.")
50
55
  }
51
56
 
@@ -64,7 +69,7 @@ Pages are divided by lines beginning with a quadruple slash, followed by that pa
64
69
 
65
70
  ### Limitations of Book Rendering
66
71
 
67
- Preamble (anything about the first `////` page) is put in its own file. That means declarations there need to be `public` to be visible within individual pages (even though when you're writing, everything is in one file). Additionally, the preamble is at the top-level and can't contain experessions. This would cause a compiler error in the Swift Playrounds iPad app:
72
+ Preamble (anything about the first `////` page) is put in its own file. That means declarations there need to be `public` to be visible within individual pages (even though when you're writing, everything is in one file). Additionally, the preamble is at the top-level and can't contain expressions. This would cause a compiler error in the Swift Playrounds iPad app:
68
73
 
69
74
  ```swift
70
75
  public let layout = UICollectionViewFlowLayout()
@@ -14,9 +14,9 @@ module Playgroundbook
14
14
  def collate!(chapter_name, chapter_file_contents, imports)
15
15
  @ui.puts "Processing #{chapter_name.green}."
16
16
 
17
- chater_directory_name = "#{chapter_name}.playgroundchapter"
18
- Dir.mkdir(chater_directory_name) unless Dir.exist?(chater_directory_name)
19
- Dir.chdir(chater_directory_name) do
17
+ chapter_directory_name = "#{chapter_name}.playgroundchapter"
18
+ Dir.mkdir(chapter_directory_name) unless Dir.exist?(chapter_directory_name)
19
+ Dir.chdir(chapter_directory_name) do
20
20
  pages = parse_pages(chapter_file_contents)
21
21
 
22
22
  Dir.mkdir(PagesDirectoryName) unless Dir.exist?(PagesDirectoryName)
@@ -20,7 +20,7 @@ module Playgroundbook
20
20
 
21
21
  def manifest_contents(book_metadata)
22
22
  chapters = book_metadata['chapters'].map{ |c| "#{c}.playgroundchapter" }
23
- {
23
+ manifest_contents = {
24
24
  'Name' => book_metadata['name'],
25
25
  'ContentIdentifier' => book_metadata['identifier'],
26
26
  'DeploymentTarget' => book_metadata['deployment_target'] || 'ios10.0',
@@ -28,6 +28,8 @@ module Playgroundbook
28
28
  'Version' => '1.0',
29
29
  'ContentVersion' => '1.0',
30
30
  }
31
+ manifest_contents['ImageReference'] = book_metadata['cover'] unless book_metadata['cover'].nil?
32
+ manifest_contents
31
33
  end
32
34
  end
33
35
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Playgroundbook
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
@@ -1,5 +1,6 @@
1
1
  name: Testing book
2
2
  identifier: com.ashfurrow.example
3
3
  resources: assets
4
+ cover: file.jpeg
4
5
  chapters:
5
6
  - test_chapter
@@ -32,6 +32,10 @@ module Playgroundbook
32
32
  it 'has chapters specified' do
33
33
  expect(get_manifest['Chapters']).to eq(['test_chapter.playgroundchapter'])
34
34
  end
35
+
36
+ it 'has a ImageReference' do
37
+ expect(get_manifest['ImageReference']).to eq('file.jpeg')
38
+ end
35
39
  end
36
40
  end
37
41
  end
data/spec/spec_helper.rb CHANGED
@@ -45,6 +45,7 @@ def test_book_metadata
45
45
  'chapters' => ['test_chapter'],
46
46
  'identifier' => 'com.ashfurrow.testing',
47
47
  'resources' => 'assets',
48
+ 'cover' => 'file.jpeg',
48
49
  }
49
50
  end
50
51
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playgroundbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ash Furrow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-27 00:00:00.000000000 Z
11
+ date: 2016-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plist