playgroundbook 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +50 -0
- data/.rspec +2 -0
- data/.rubocop.yml +112 -0
- data/.ruby-version +1 -0
- data/Changelog.md +37 -0
- data/CodeOfConduct.md +50 -0
- data/Community.md +52 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +102 -0
- data/Guardfile +14 -0
- data/README.md +7 -1
- data/Rakefile +8 -0
- data/lib/playgroundbook.rb +1 -0
- data/lib/renderer/playgroundbook_renderer.rb +11 -0
- data/lib/version.rb +1 -1
- data/playgroundbook.gemspec +21 -0
- data/spec/fixtures/Starter.playgroundbook/Contents/Chapters/Chapter1.playgroundchapter/Manifest.plist +15 -0
- data/spec/fixtures/Starter.playgroundbook/Contents/Chapters/Chapter1.playgroundchapter/Pages/Page1.playgroundpage/Contents.swift +8 -0
- data/spec/fixtures/Starter.playgroundbook/Contents/Chapters/Chapter1.playgroundchapter/Pages/Page1.playgroundpage/Manifest.plist +12 -0
- data/spec/fixtures/Starter.playgroundbook/Contents/Chapters/Chapter1.playgroundchapter/Pages/Page2.playgroundpage/Contents.swift +8 -0
- data/spec/fixtures/Starter.playgroundbook/Contents/Chapters/Chapter1.playgroundchapter/Pages/Page2.playgroundpage/Manifest.plist +12 -0
- data/spec/fixtures/Starter.playgroundbook/Contents/Manifest.plist +20 -0
- data/spec/fixtures/assets/file.jpeg +0 -0
- data/spec/fixtures/book.yml +6 -0
- data/spec/fixtures/test_chapter.playground/Contents.swift +17 -0
- data/spec/fixtures/test_chapter.playground/contents.xcplayground +4 -0
- data/spec/fixtures/wrapper/destination/swift_at_artsy_1.swift +200 -0
- data/spec/fixtures/wrapper/source/Swift-at-Artsy.playground/Contents.swift +199 -0
- data/spec/fixtures/wrapper/source/Swift-at-Artsy.playground/contents.xcplayground +4 -0
- data/spec/fixtures/wrapper/source/swift_at_artsy_1.md +183 -0
- data/spec/linter/chapter_linter_spec.rb +30 -0
- data/spec/linter/chapter_manifest_linter_spec.rb +40 -0
- data/spec/linter/contents_linter_spec.rb +18 -0
- data/spec/linter/cutscene_page_linter_spec.rb +14 -0
- data/spec/linter/cutscene_page_manifest_linter_spec.rb +63 -0
- data/spec/linter/manfiest_linter_spec.rb +71 -0
- data/spec/linter/page_linter_spec.rb +19 -0
- data/spec/linter/page_manifest_linter_spec.rb +43 -0
- data/spec/linter/playgroundbook_lint_spec.rb +38 -0
- data/spec/linter/root_manifest_linter_spec.rb +35 -0
- data/spec/renderer/chapter_collator_spec.rb +70 -0
- data/spec/renderer/contents_manfiest_generator_spec.rb +41 -0
- data/spec/renderer/glossary_generator_spec.rb +54 -0
- data/spec/renderer/page_processor_spec.rb +86 -0
- data/spec/renderer/page_writer_spec.rb +70 -0
- data/spec/renderer/playgroundbook_renderer_spec.rb +122 -0
- data/spec/spec_helper.rb +85 -0
- data/spec/wrapper/markdown_wrapper_spec.rb +90 -0
- metadata +46 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6d1f0ed65671bb4c70bf6cbd734b9648b1733ea
|
4
|
+
data.tar.gz: a40d6882aa7217a9ae7e13c882b1e4607cef78d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0a69b41dec9497235562749b007e2321099585d0e5c7f9521da897a1348076891469e3cdecbb9fd61dcdd0b54ad0fd99827f13d5b95d7b611466c01bfe1904f
|
7
|
+
data.tar.gz: d97dc8dc75a1a64bf5f30a1d44e9ecc8b3ba7aee914877b0bfb6b937418308e85b783f07dc754e14206d54902f8776ee9de5eefbac80cf529b6a52f6f3475f8d
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
Metrics/LineLength:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
Style/StringLiterals:
|
5
|
+
EnforcedStyle: double_quotes
|
6
|
+
Enabled: true
|
7
|
+
|
8
|
+
# kind_of? is a good way to check a type
|
9
|
+
Style/ClassCheck:
|
10
|
+
EnforcedStyle: kind_of?
|
11
|
+
|
12
|
+
# It's better to be more explicit about the type
|
13
|
+
Style/BracesAroundHashParameters:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
# specs sometimes have useless assignments, which is fine
|
17
|
+
Lint/UselessAssignment:
|
18
|
+
Exclude:
|
19
|
+
- '**/spec/**/*'
|
20
|
+
|
21
|
+
# We could potentially enable the 2 below:
|
22
|
+
Style/IndentHash:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/AlignHash:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
# HoundCI doesn't like this rule
|
29
|
+
Style/DotPosition:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
# We allow !! as it's an easy way to convert ot boolean
|
33
|
+
Style/DoubleNegation:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
# Cop supports --auto-correct.
|
37
|
+
Lint/UnusedBlockArgument:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
# We want to allow class Fastlane::Class
|
41
|
+
Style/ClassAndModuleChildren:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Metrics/AbcSize:
|
45
|
+
Max: 60
|
46
|
+
|
47
|
+
# The %w might be confusing for new users
|
48
|
+
Style/WordArray:
|
49
|
+
MinSize: 19
|
50
|
+
|
51
|
+
# raise and fail are both okay
|
52
|
+
Style/SignalException:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
# Better too much 'return' than one missing
|
56
|
+
Style/RedundantReturn:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
# Having if in the same line might not always be good
|
60
|
+
Style/IfUnlessModifier:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
# and and or is okay
|
64
|
+
Style/AndOr:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
# Configuration parameters: CountComments.
|
68
|
+
Metrics/ClassLength:
|
69
|
+
Max: 320
|
70
|
+
|
71
|
+
Metrics/CyclomaticComplexity:
|
72
|
+
Max: 17
|
73
|
+
|
74
|
+
# Configuration parameters: AllowURI, URISchemes.
|
75
|
+
Metrics/LineLength:
|
76
|
+
Max: 370
|
77
|
+
|
78
|
+
# Configuration parameters: CountKeywordArgs.
|
79
|
+
Metrics/ParameterLists:
|
80
|
+
Max: 10
|
81
|
+
|
82
|
+
Metrics/PerceivedComplexity:
|
83
|
+
Max: 18
|
84
|
+
|
85
|
+
# Sometimes it's easier to read without guards
|
86
|
+
Style/GuardClause:
|
87
|
+
Enabled: false
|
88
|
+
|
89
|
+
# something = if something_else
|
90
|
+
# that's confusing
|
91
|
+
Style/ConditionalAssignment:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
# Better to have too much self than missing a self
|
95
|
+
Style/RedundantSelf:
|
96
|
+
Enabled: false
|
97
|
+
|
98
|
+
Metrics/MethodLength:
|
99
|
+
Max: 60
|
100
|
+
|
101
|
+
# We're not there yet
|
102
|
+
Style/Documentation:
|
103
|
+
Enabled: false
|
104
|
+
|
105
|
+
# Adds complexity
|
106
|
+
Style/IfInsideElse:
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
# danger specific
|
110
|
+
|
111
|
+
Style/BlockComments:
|
112
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.1.1
|
data/Changelog.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Current Master
|
2
|
+
|
3
|
+
# 0.6.0
|
4
|
+
|
5
|
+
- Adds basic support for Swift Package Manager dependencies. See [#50](https://github.com/playgroundbooks/playgroundbook/pull/50).
|
6
|
+
|
7
|
+
# 0.5.0
|
8
|
+
|
9
|
+
- Embeds images inside the local Playground when converting from markdown. See [#30](https://github.com/ashfurrow/playgroundbook/pull/30).
|
10
|
+
|
11
|
+
# 0.4.0
|
12
|
+
|
13
|
+
- Support converting a random Markdown file into a playground. See [#29](https://github.com/ashfurrow/playgroundbook/pull/29).
|
14
|
+
|
15
|
+
|
16
|
+
# 0.3.0
|
17
|
+
|
18
|
+
- Glossary support. See [#18](https://github.com/ashfurrow/playgroundbook/issues/18).
|
19
|
+
- Removes newlines surrounding markdown blocks. See [#20](https://github.com/ashfurrow/playgroundbook/issues/20).
|
20
|
+
|
21
|
+
# 0.2.1
|
22
|
+
|
23
|
+
- Support for cover images. See [#16](https://github.com/ashfurrow/playgroundbook/issues/16).
|
24
|
+
|
25
|
+
# 0.2.0
|
26
|
+
|
27
|
+
- Book rendering.
|
28
|
+
- Book linting moved to subcommand.
|
29
|
+
|
30
|
+
# 0.1.0
|
31
|
+
|
32
|
+
- Adds support for linting manifest file optional values. See [#3](https://github.com/ashfurrow/playground-book-lint/issues/3). - @rpowelll
|
33
|
+
- Adds support for playground cutscene linting. See [#9](https://github.com/ashfurrow/playground-book-lint/issues/9). - @rpowelll
|
34
|
+
|
35
|
+
# 0.0.1
|
36
|
+
|
37
|
+
- Initial release.
|
data/CodeOfConduct.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at [ash@ashfurrow.com](mailto:ash@ashfurrow.com) or [orta.therox@gmail.com](mailto:orta.therox@gmail.com). All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
|
45
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
46
|
+
version 1.3.0, available at
|
47
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
48
|
+
|
49
|
+
[homepage]: http://contributor-covenant.org
|
50
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Community.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Community Continuity Guidelines v2.0.0
|
2
|
+
|
3
|
+
As the creators, and maintainers of this project, we want to ensure that the project lives and continues to grow. Not blocked by any singular person's computer time. One of the simplest ways of doing this is by encouraging a larger set of shallow contributors. Through this, we hope to mitigate the problems of a project that needs updates but there's no-one who has the power to do so.
|
4
|
+
|
5
|
+
#### Ownership
|
6
|
+
|
7
|
+
If you get a merged Pull Request, regardless of content (typos, code, doc fixes), then you're eligible for push access to this organization. This is checked for on pull request merges and an invite to the organization is sent via GitHub.
|
8
|
+
|
9
|
+
Offhand, it's easy to imagine that this would make code quality suffer, but in reality it offers fresh perspectives to the codebase and encourages ownership from people who are depending on the project. If you are building a project that relies on this codebase, then you probably have the skills to improve it and offer valuable feedback.
|
10
|
+
|
11
|
+
Everyone comes in with their own perspective on what a project could/should look like, and encouraging discussion can help expose good ideas sooner.
|
12
|
+
|
13
|
+
#### Why do we give out push access?
|
14
|
+
|
15
|
+
It can be overwhelming to offered the chance to wipe the source code for a project. Don't worry, we don't let you push to master. All code is peer-reviewed, and we have the convention that someone other than the submitter should merge non-trivial pull requests.
|
16
|
+
|
17
|
+
As an organization contributor, you can merge other people's pull requests, or other contributors can merge yours. You won't be assigned a pull request, but you're welcome to jump in and take a code review on topics that interest you.
|
18
|
+
|
19
|
+
This project is not continuously deployed, there is space for debate after review too. Offering everyone the chance to revert, or make an amending pull request. If it feels right, merge.
|
20
|
+
|
21
|
+
#### How can we help you get comfortable contributing?
|
22
|
+
|
23
|
+
It's normal for a first pull request to be a potential fix for a problem, and moving on from there to helping the project's direction can be difficult. We try to help contributors cross that barrier by offering good first step issues. These issues can be fixed without feeling like you're stepping on toes. Ideally, these are non-critical issues that are well defined. They will be purposely avoided by mature contributors to the project. To make space for others.
|
24
|
+
|
25
|
+
We aim to keep all project discussion inside GitHub issues. This is to make sure valuable discussion is accessible via search. If you have questions about how to use the library, or how the project is running - GitHub issues are the goto tool for this project.
|
26
|
+
|
27
|
+
#### Our expectations on you as a contributor
|
28
|
+
|
29
|
+
To quote [@alloy](https://github.com/alloy) from [this issue](https://github.com/Moya/Moya/issues/135):
|
30
|
+
|
31
|
+
> Don't ever feel bad for not contributing to open source.
|
32
|
+
|
33
|
+
We want contributors to provide ideas, keep the ship shipping and to take some of the load from others. It is non-obligatory; we’re here to get things done in an enjoyable way. :trophy:
|
34
|
+
|
35
|
+
The fact that you'll have push access will allow you to:
|
36
|
+
|
37
|
+
- Avoid having to fork the project if you want to submit other pull requests as you'll be able to create branches directly on the project.
|
38
|
+
- Help triage issues, merge pull requests.
|
39
|
+
- Pick up the project if other maintainers move their focus elsewhere.
|
40
|
+
|
41
|
+
It's up to you to use those superpowers or not though 😉
|
42
|
+
|
43
|
+
If someone submits a pull request that's not perfect, and you are reviewing, it's better to think about the PR's motivation rather than the specific implementation. Having braces on the wrong line should not be a blocker. Though we do want to keep test coverage high, we will work with you to figure that out together.
|
44
|
+
|
45
|
+
#### What about if you have problems that cannot be discussed in a public issue?
|
46
|
+
|
47
|
+
Both [Ash Furrow](https://github.com/ashfurrow) and [Orta Therox](https://github.com/orta) have contactable emails on their GitHub profiles, and are happy to talk about any problems.
|
48
|
+
|
49
|
+
#### Where can I get more info about this document?
|
50
|
+
|
51
|
+
The original source of this document can be found at https://github.com/moya/contributors.
|
52
|
+
|
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gem "rake"
|
4
|
+
gem "guard-rspec"
|
5
|
+
gem "mocha"
|
6
|
+
gem "bacon"
|
7
|
+
gem "mocha-on-bacon"
|
8
|
+
gem "prettybacon"
|
9
|
+
gem "fakefs"
|
10
|
+
gem "rubocop", "~> 0.41.2", require: false
|
11
|
+
|
12
|
+
require "pp" # https://github.com/defunkt/fakefs/issues/99
|
13
|
+
gemspec
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
playgroundbook (0.4.0)
|
5
|
+
colored (~> 1.2)
|
6
|
+
cork (~> 0.1)
|
7
|
+
plist (~> 3.2)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
ast (2.3.0)
|
13
|
+
bacon (1.2.0)
|
14
|
+
coderay (1.1.1)
|
15
|
+
colored (1.2)
|
16
|
+
cork (0.2.0)
|
17
|
+
colored (~> 1.2)
|
18
|
+
diff-lcs (1.2.5)
|
19
|
+
fakefs (0.9.0)
|
20
|
+
ffi (1.9.10)
|
21
|
+
formatador (0.2.5)
|
22
|
+
guard (2.14.0)
|
23
|
+
formatador (>= 0.2.4)
|
24
|
+
listen (>= 2.7, < 4.0)
|
25
|
+
lumberjack (~> 1.0)
|
26
|
+
nenv (~> 0.1)
|
27
|
+
notiffany (~> 0.0)
|
28
|
+
pry (>= 0.9.12)
|
29
|
+
shellany (~> 0.0)
|
30
|
+
thor (>= 0.18.1)
|
31
|
+
guard-compat (1.2.1)
|
32
|
+
guard-rspec (4.7.2)
|
33
|
+
guard (~> 2.1)
|
34
|
+
guard-compat (~> 1.1)
|
35
|
+
rspec (>= 2.99.0, < 4.0)
|
36
|
+
listen (3.0.7)
|
37
|
+
rb-fsevent (>= 0.9.3)
|
38
|
+
rb-inotify (>= 0.9.7)
|
39
|
+
lumberjack (1.0.10)
|
40
|
+
metaclass (0.0.4)
|
41
|
+
method_source (0.8.2)
|
42
|
+
mocha (1.1.0)
|
43
|
+
metaclass (~> 0.0.1)
|
44
|
+
mocha-on-bacon (0.2.2)
|
45
|
+
mocha (>= 0.13.0)
|
46
|
+
nenv (0.3.0)
|
47
|
+
notiffany (0.1.0)
|
48
|
+
nenv (~> 0.1)
|
49
|
+
shellany (~> 0.0)
|
50
|
+
parser (2.3.1.2)
|
51
|
+
ast (~> 2.2)
|
52
|
+
plist (3.2.0)
|
53
|
+
powerpack (0.1.1)
|
54
|
+
prettybacon (0.0.2)
|
55
|
+
bacon (~> 1.2)
|
56
|
+
pry (0.10.3)
|
57
|
+
coderay (~> 1.1.0)
|
58
|
+
method_source (~> 0.8.1)
|
59
|
+
slop (~> 3.4)
|
60
|
+
rainbow (2.1.0)
|
61
|
+
rake (11.2.2)
|
62
|
+
rb-fsevent (0.9.7)
|
63
|
+
rb-inotify (0.9.7)
|
64
|
+
ffi (>= 0.5.0)
|
65
|
+
rspec (3.5.0)
|
66
|
+
rspec-core (~> 3.5.0)
|
67
|
+
rspec-expectations (~> 3.5.0)
|
68
|
+
rspec-mocks (~> 3.5.0)
|
69
|
+
rspec-core (3.5.1)
|
70
|
+
rspec-support (~> 3.5.0)
|
71
|
+
rspec-expectations (3.5.0)
|
72
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
73
|
+
rspec-support (~> 3.5.0)
|
74
|
+
rspec-mocks (3.5.0)
|
75
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
76
|
+
rspec-support (~> 3.5.0)
|
77
|
+
rspec-support (3.5.0)
|
78
|
+
rubocop (0.41.2)
|
79
|
+
parser (>= 2.3.1.1, < 3.0)
|
80
|
+
powerpack (~> 0.1)
|
81
|
+
rainbow (>= 1.99.1, < 3.0)
|
82
|
+
ruby-progressbar (~> 1.7)
|
83
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
84
|
+
ruby-progressbar (1.8.1)
|
85
|
+
shellany (0.0.1)
|
86
|
+
slop (3.6.0)
|
87
|
+
thor (0.19.1)
|
88
|
+
unicode-display_width (1.1.0)
|
89
|
+
|
90
|
+
PLATFORMS
|
91
|
+
ruby
|
92
|
+
|
93
|
+
DEPENDENCIES
|
94
|
+
bacon
|
95
|
+
fakefs
|
96
|
+
guard-rspec
|
97
|
+
mocha
|
98
|
+
mocha-on-bacon
|
99
|
+
playgroundbook!
|
100
|
+
prettybacon
|
101
|
+
rake
|
102
|
+
rubocop (~> 0.41.2)
|
data/Guardfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
2
|
+
require "guard/rspec/dsl"
|
3
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
4
|
+
|
5
|
+
# RSpec files
|
6
|
+
rspec = dsl.rspec
|
7
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
8
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
9
|
+
watch(rspec.spec_files)
|
10
|
+
|
11
|
+
# Ruby files
|
12
|
+
ruby = dsl.ruby
|
13
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
14
|
+
end
|
data/README.md
CHANGED
@@ -81,7 +81,7 @@ Pages are divided by lines beginning with a quadruple slash, followed by that pa
|
|
81
81
|
|
82
82
|
### Limitations of Book Rendering
|
83
83
|
|
84
|
-
|
84
|
+
The 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:
|
85
85
|
|
86
86
|
```swift
|
87
87
|
public let layout = UICollectionViewFlowLayout()
|
@@ -102,6 +102,12 @@ It's awkward; if you have suggestions, open an issue :+1:
|
|
102
102
|
|
103
103
|
Sharing resources is only available book-wide and not specific to chapters. Sharing code outside the preamble isn't supported yet.
|
104
104
|
|
105
|
+
#### Using Swift Package Manager Dependencies
|
106
|
+
|
107
|
+
If you place a `Package.swift` file next to your playgroundbook manifest used for rendering a book and run `swift package fetch` to fetch the corresponding sources into `Packages/`, these will be copied into the playground book's top-level `Sources` when building and available in the finished book.
|
108
|
+
These source files will also be copied into the original playground for each chapter to make these available for use in Xcode.
|
109
|
+
Please note that this will work best with SPM packages containing pure Swift.
|
110
|
+
|
105
111
|
Playground books support a rich set of awesome features to make learning how to code really easy, and this tool uses almost none of them. It sacrifices this experience for the sake of being able to easily write the books on your Mac.
|
106
112
|
|
107
113
|
### Creating a Playground from markdown
|
data/Rakefile
ADDED
data/lib/playgroundbook.rb
CHANGED
@@ -51,11 +51,22 @@ module Playgroundbook
|
|
51
51
|
end
|
52
52
|
parsed_chapters = book_chapter_contents.map { |c| page_parser.parse_chapter_pages(c) }
|
53
53
|
|
54
|
+
book["chapters"].map do |chapter|
|
55
|
+
Dir.glob("Packages/**/Sources/*.swift").each do |file|
|
56
|
+
playground_sources_path = "#{chapter['name']}.playground/Sources"
|
57
|
+
Dir.mkdir(playground_sources_path) unless Dir.exist?(playground_sources_path)
|
58
|
+
FileUtils.cp(file, playground_sources_path)
|
59
|
+
end
|
60
|
+
end
|
54
61
|
Dir.mkdir(book_dir_name) unless Dir.exist?(book_dir_name)
|
55
62
|
Dir.chdir(book_dir_name) do
|
56
63
|
Dir.mkdir(ContentsDirectoryName) unless Dir.exist?(ContentsDirectoryName)
|
57
64
|
Dir.chdir(ContentsDirectoryName) do
|
58
65
|
Dir.mkdir(ResourcesDirectoryName) unless Dir.exist?(ResourcesDirectoryName) # Always create a Resources dir, even if empty.
|
66
|
+
Dir.mkdir(SourcesDirectoryName) unless Dir.exist?(SourcesDirectoryName)
|
67
|
+
Dir.glob("../../Packages/**/Sources/*.swift").each do |file|
|
68
|
+
FileUtils.cp(file, SourcesDirectoryName)
|
69
|
+
end
|
59
70
|
resources_dir = book["resources"]
|
60
71
|
unless resources_dir.nil? || resources_dir.empty?
|
61
72
|
@ui.puts "Copying resource directory (#{resources_dir.green}) contents."
|
data/lib/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "playgroundbook"
|
8
|
+
s.version = Playgroundbook::VERSION
|
9
|
+
s.licenses = ["MIT"]
|
10
|
+
s.summary = "Lints/renders Swift Playground books."
|
11
|
+
s.description = "Tooks for Swift Playground books on iOS, a renderer and a linter."
|
12
|
+
s.authors = ["Ash Furrow"]
|
13
|
+
s.homepage = "https://github.com/ashfurrow/playground-book-lint"
|
14
|
+
s.email = "ash@ashfurrow.com"
|
15
|
+
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.executables = ["playgroundbook"]
|
18
|
+
s.add_runtime_dependency "plist", "~> 3.2"
|
19
|
+
s.add_runtime_dependency "colored", "~> 1.2"
|
20
|
+
s.add_runtime_dependency "cork", "~> 0.1"
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>Version</key>
|
6
|
+
<string>1.0</string>
|
7
|
+
<key>Name</key>
|
8
|
+
<string>Sample Chapter</string>
|
9
|
+
<key>Pages</key>
|
10
|
+
<array>
|
11
|
+
<string>Page1.playgroundpage</string>
|
12
|
+
<string>Page2.playgroundpage</string>
|
13
|
+
</array>
|
14
|
+
</dict>
|
15
|
+
</plist>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>Version</key>
|
6
|
+
<string>1.0</string>
|
7
|
+
<key>Name</key>
|
8
|
+
<string>Example Page</string>
|
9
|
+
<key>LiveViewMode</key>
|
10
|
+
<string>HiddenByDefault</string>
|
11
|
+
</dict>
|
12
|
+
</plist>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>Version</key>
|
6
|
+
<string>1.0</string>
|
7
|
+
<key>Name</key>
|
8
|
+
<string>Second Example Page</string>
|
9
|
+
<key>LiveViewMode</key>
|
10
|
+
<string>HiddenByDefault</string>
|
11
|
+
</dict>
|
12
|
+
</plist>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>Version</key>
|
6
|
+
<string>1.0</string>
|
7
|
+
<key>ContentVersion</key>
|
8
|
+
<string>1.0</string>
|
9
|
+
<key>Name</key>
|
10
|
+
<string>Starter</string>
|
11
|
+
<key>ContentIdentifier</key>
|
12
|
+
<string>com.example.apple-samplecode.Starter</string>
|
13
|
+
<key>DeploymentTarget</key>
|
14
|
+
<string>ios10.0</string>
|
15
|
+
<key>Chapters</key>
|
16
|
+
<array>
|
17
|
+
<string>Chapter1.playgroundchapter</string>
|
18
|
+
</array>
|
19
|
+
</dict>
|
20
|
+
</plist>
|
Binary file
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import UIKit
|
2
|
+
|
3
|
+
public var str = "Hello, playground"
|
4
|
+
|
5
|
+
public func sharedFunc() {
|
6
|
+
print("This should be accessible to all pages.")
|
7
|
+
}
|
8
|
+
|
9
|
+
//// Page 1
|
10
|
+
|
11
|
+
str = "Yo, it's page 1."
|
12
|
+
sharedFunc()
|
13
|
+
|
14
|
+
//// Page 2
|
15
|
+
|
16
|
+
sharedFunc()
|
17
|
+
str = "Page 2 awww yeah."
|