amp-html 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +7 -0
  2. data/.github/issue_template.md +16 -0
  3. data/.github/pull_request_template.md +21 -0
  4. data/.gitignore +13 -0
  5. data/.travis.yml +4 -0
  6. data/CHANGELOG.md +302 -0
  7. data/CONTRIBUTING.md +1 -0
  8. data/DEPRECATIONS.md +9 -0
  9. data/Gemfile +12 -0
  10. data/Gemfile.lock +162 -0
  11. data/INSTALL.md +1 -0
  12. data/LICENSE +21 -0
  13. data/OWNERS.yaml +1 -0
  14. data/README.md +192 -0
  15. data/Rakefile +6 -0
  16. data/amp-html.gemspec +29 -0
  17. data/bin/amp-html +4 -0
  18. data/lib/amp_html.rb +27 -0
  19. data/lib/amp_html/cli.rb +113 -0
  20. data/lib/amp_html/components/docs/README.md +101 -0
  21. data/lib/amp_html/components/docs/ad.md +83 -0
  22. data/lib/amp_html/components/docs/analytics.md +131 -0
  23. data/lib/amp_html/components/docs/anim.md +66 -0
  24. data/lib/amp_html/components/docs/fonts.md +63 -0
  25. data/lib/amp_html/components/docs/forms.md +79 -0
  26. data/lib/amp_html/components/docs/iframe.md +62 -0
  27. data/lib/amp_html/components/docs/javascript.md +71 -0
  28. data/lib/amp_html/components/docs/lists.md +168 -0
  29. data/lib/amp_html/components/docs/media.md +52 -0
  30. data/lib/amp_html/components/docs/mustache.md +46 -0
  31. data/lib/amp_html/components/docs/notifications.md +0 -0
  32. data/lib/amp_html/components/docs/schema.md +80 -0
  33. data/lib/amp_html/components/docs/service_worker.md +60 -0
  34. data/lib/amp_html/components/docs/social.md +130 -0
  35. data/lib/amp_html/components/docs/stylesheets.md +50 -0
  36. data/lib/amp_html/components/help.rb +19 -0
  37. data/lib/amp_html/components/install.rb +34 -0
  38. data/lib/amp_html/components/templates/ERROR.md +5 -0
  39. data/lib/amp_html/components/templates/README.md +12 -0
  40. data/lib/amp_html/configuration.rb +170 -0
  41. data/lib/amp_html/configuration/docs/README.md +0 -0
  42. data/lib/amp_html/configuration/help.rb +11 -0
  43. data/lib/amp_html/helpers/docs/README.md +98 -0
  44. data/lib/amp_html/helpers/docs/amp.md +0 -0
  45. data/lib/amp_html/helpers/docs/amp_ad.md +86 -0
  46. data/lib/amp_html/helpers/docs/amp_analytics.md +76 -0
  47. data/lib/amp_html/helpers/docs/amp_anim.md +68 -0
  48. data/lib/amp_html/helpers/docs/amp_audio.md +54 -0
  49. data/lib/amp_html/helpers/docs/amp_auto_ads.md +43 -0
  50. data/lib/amp_html/helpers/docs/amp_close_user_notification_button.md +0 -0
  51. data/lib/amp_html/helpers/docs/amp_css.md +37 -0
  52. data/lib/amp_html/helpers/docs/amp_css_link.md +0 -0
  53. data/lib/amp_html/helpers/docs/amp_custom_ad.md +0 -0
  54. data/lib/amp_html/helpers/docs/amp_document_link.md +0 -0
  55. data/lib/amp_html/helpers/docs/amp_embed.md +86 -0
  56. data/lib/amp_html/helpers/docs/amp_facebook.md +70 -0
  57. data/lib/amp_html/helpers/docs/amp_fallback.md +47 -0
  58. data/lib/amp_html/helpers/docs/amp_font.md +0 -0
  59. data/lib/amp_html/helpers/docs/amp_font_link.md +0 -0
  60. data/lib/amp_html/helpers/docs/amp_form.md +0 -0
  61. data/lib/amp_html/helpers/docs/amp_form_response.md +0 -0
  62. data/lib/amp_html/helpers/docs/amp_gfycat.md +0 -0
  63. data/lib/amp_html/helpers/docs/amp_global_css.md +0 -0
  64. data/lib/amp_html/helpers/docs/amp_google_analytics.md +0 -0
  65. data/lib/amp_html/helpers/docs/amp_google_font.md +0 -0
  66. data/lib/amp_html/helpers/docs/amp_head.md +0 -0
  67. data/lib/amp_html/helpers/docs/amp_html_doctype.md +0 -0
  68. data/lib/amp_html/helpers/docs/amp_iframe.md +0 -0
  69. data/lib/amp_html/helpers/docs/amp_image.md +0 -0
  70. data/lib/amp_html/helpers/docs/amp_input.md +0 -0
  71. data/lib/amp_html/helpers/docs/amp_instagram.md +0 -0
  72. data/lib/amp_html/helpers/docs/amp_js.md +0 -0
  73. data/lib/amp_html/helpers/docs/amp_link.md +0 -0
  74. data/lib/amp_html/helpers/docs/amp_list.md +0 -0
  75. data/lib/amp_html/helpers/docs/amp_live_list.md +0 -0
  76. data/lib/amp_html/helpers/docs/amp_live_list_items.md +0 -0
  77. data/lib/amp_html/helpers/docs/amp_live_list_pagination.md +0 -0
  78. data/lib/amp_html/helpers/docs/amp_live_list_update.md +0 -0
  79. data/lib/amp_html/helpers/docs/amp_mustache.md +0 -0
  80. data/lib/amp_html/helpers/docs/amp_pin_it.md +0 -0
  81. data/lib/amp_html/helpers/docs/amp_pin_widget.md +0 -0
  82. data/lib/amp_html/helpers/docs/amp_pinterest_follow.md +0 -0
  83. data/lib/amp_html/helpers/docs/amp_pixel.md +0 -0
  84. data/lib/amp_html/helpers/docs/amp_placeholder.md +0 -0
  85. data/lib/amp_html/helpers/docs/amp_reddit.md +0 -0
  86. data/lib/amp_html/helpers/docs/amp_resources.md +0 -0
  87. data/lib/amp_html/helpers/docs/amp_selector.md +0 -0
  88. data/lib/amp_html/helpers/docs/amp_serviceworker.md +0 -0
  89. data/lib/amp_html/helpers/docs/amp_social_share.md +0 -0
  90. data/lib/amp_html/helpers/docs/amp_soundcloud.md +0 -0
  91. data/lib/amp_html/helpers/docs/amp_twitter.md +0 -0
  92. data/lib/amp_html/helpers/docs/amp_user_notification.md +0 -0
  93. data/lib/amp_html/helpers/docs/amp_video.md +0 -0
  94. data/lib/amp_html/helpers/docs/amp_video_ad.md +0 -0
  95. data/lib/amp_html/helpers/docs/amp_vine.md +0 -0
  96. data/lib/amp_html/helpers/docs/amp_youtube.md +0 -0
  97. data/lib/amp_html/helpers/docs/audio_tag.md +0 -0
  98. data/lib/amp_html/helpers/docs/canonical_document_link.md +0 -0
  99. data/lib/amp_html/helpers/docs/form_tag.md +0 -0
  100. data/lib/amp_html/helpers/docs/image_tag.md +0 -0
  101. data/lib/amp_html/helpers/docs/input_tag.md +0 -0
  102. data/lib/amp_html/helpers/docs/javascript_include_tag.md +0 -0
  103. data/lib/amp_html/helpers/docs/noscript_tag.md +0 -0
  104. data/lib/amp_html/helpers/docs/schema_tag.md +0 -0
  105. data/lib/amp_html/helpers/docs/stylesheet_link_tag.md +0 -0
  106. data/lib/amp_html/helpers/docs/video_tag.md +0 -0
  107. data/lib/amp_html/helpers/help.rb +23 -0
  108. data/lib/amp_html/root.rb +7 -0
  109. data/lib/amp_html/test.rb +169 -0
  110. data/lib/amp_html/test/help.rb +11 -0
  111. data/lib/amp_html/test/templates/README.md +43 -0
  112. data/lib/amp_html/test/templates/css/!important.md +1 -0
  113. data/lib/amp_html/test/templates/css/-amp-.md +1 -0
  114. data/lib/amp_html/test/templates/css/-moz-binding.md +1 -0
  115. data/lib/amp_html/test/templates/css/@import.md +1 -0
  116. data/lib/amp_html/test/templates/css/behavior.md +1 -0
  117. data/lib/amp_html/test/templates/css/filter.md +1 -0
  118. data/lib/amp_html/test/templates/css/i-amp-.md +1 -0
  119. data/lib/amp_html/test/templates/css/overflow.md +1 -0
  120. data/lib/amp_html/test/templates/html/applet.md +1 -0
  121. data/lib/amp_html/test/templates/html/audio.md +1 -0
  122. data/lib/amp_html/test/templates/html/base.md +1 -0
  123. data/lib/amp_html/test/templates/html/embed.md +1 -0
  124. data/lib/amp_html/test/templates/html/frame.md +1 -0
  125. data/lib/amp_html/test/templates/html/frameset.md +1 -0
  126. data/lib/amp_html/test/templates/html/http-equiv.md +1 -0
  127. data/lib/amp_html/test/templates/html/iframe.md +1 -0
  128. data/lib/amp_html/test/templates/html/img.md +1 -0
  129. data/lib/amp_html/test/templates/html/javascript_include_tag.md +1 -0
  130. data/lib/amp_html/test/templates/html/object.md +1 -0
  131. data/lib/amp_html/test/templates/html/onclick.md +1 -0
  132. data/lib/amp_html/test/templates/html/onmousehover.md +1 -0
  133. data/lib/amp_html/test/templates/html/param.md +1 -0
  134. data/lib/amp_html/test/templates/html/stylesheet_link_tag.md +1 -0
  135. data/lib/amp_html/test/templates/html/video.md +1 -0
  136. data/lib/amp_html/test/templates/markup/!doctype.md +1 -0
  137. data/lib/amp_html/test/templates/markup/amp_document_link.md +1 -0
  138. data/lib/amp_html/test/templates/markup/amp_head.md +1 -0
  139. data/lib/amp_html/test/templates/markup/amp_html_doctype.md +1 -0
  140. data/lib/amp_html/test/templates/markup/canonical_document_link.md +1 -0
  141. data/lib/amp_html/test/templates/markup/head_body.md +1 -0
  142. data/lib/amp_html/test/templates/markup/html.md +1 -0
  143. data/lib/amp_html/test/templates/markup/meta_viewport.md +1 -0
  144. data/lib/amp_html/validate.rb +46 -0
  145. data/lib/amp_html/validate/help.rb +11 -0
  146. data/lib/amp_html/validate/templates/README.md +32 -0
  147. data/lib/amp_html/version.rb +13 -0
  148. data/lib/generators/amphtml/assets_generator.rb +31 -0
  149. data/lib/generators/amphtml/bundle_generator.rb +50 -0
  150. data/lib/generators/amphtml/components_generator.rb +84 -0
  151. data/lib/generators/amphtml/helpers_generator.rb +32 -0
  152. data/lib/generators/amphtml/install_generator.rb +53 -0
  153. data/lib/generators/amphtml/views_generator.rb +62 -0
  154. data/lib/generators/templates/assets/README.md +0 -0
  155. data/lib/generators/templates/assets/stylesheets/application.scss +15 -0
  156. data/lib/generators/templates/components/README.md +0 -0
  157. data/lib/generators/templates/components/assets/javascripts/application.js +15 -0
  158. data/lib/generators/templates/components/helpers/ad_tag_helper.rb +83 -0
  159. data/lib/generators/templates/components/helpers/analytics_tag_helper.rb +30 -0
  160. data/lib/generators/templates/components/helpers/anim_tag_helper.rb +42 -0
  161. data/lib/generators/templates/components/helpers/iframe_tag_helper.rb +27 -0
  162. data/lib/generators/templates/components/helpers/javascript_tag_helper.rb +12 -0
  163. data/lib/generators/templates/components/helpers/lists_tag_helper.rb +82 -0
  164. data/lib/generators/templates/components/helpers/notification_tag_helper.rb +16 -0
  165. data/lib/generators/templates/components/helpers/serviceworker_tag_helper.rb +15 -0
  166. data/lib/generators/templates/components/helpers/social_tag_helper.rb +228 -0
  167. data/lib/generators/templates/components/public/remote.html +28 -0
  168. data/lib/generators/templates/components/views/_components.html.erb +141 -0
  169. data/lib/generators/templates/components/views/_google_analytics.html.erb +23 -0
  170. data/lib/generators/templates/helpers/README.md +1 -0
  171. data/lib/generators/templates/helpers/amp/fallback_tag_helper.rb +16 -0
  172. data/lib/generators/templates/helpers/amp/font_tag_helper.rb +37 -0
  173. data/lib/generators/templates/helpers/amp/link_tag_helper.rb +11 -0
  174. data/lib/generators/templates/helpers/amp/mustache_tag_helper.rb +13 -0
  175. data/lib/generators/templates/helpers/amp/noscript_tag_helper.rb +13 -0
  176. data/lib/generators/templates/helpers/amp/placeholder_tag_helper.rb +16 -0
  177. data/lib/generators/templates/helpers/amp/schema_tag_helper.rb +16 -0
  178. data/lib/generators/templates/helpers/amp/stylesheets_tag_helper.rb +21 -0
  179. data/lib/generators/templates/helpers/amp_tag_helper.rb.erb +65 -0
  180. data/lib/generators/templates/helpers/asset_tag_helper.rb.erb +119 -0
  181. data/lib/generators/templates/helpers/form_tag_helper.rb.erb +79 -0
  182. data/lib/generators/templates/install/README.md +1 -0
  183. data/lib/generators/templates/install/amphtml.rb.erb +19 -0
  184. data/lib/generators/templates/install/amphtml.yml.erb +189 -0
  185. data/lib/generators/templates/views/README.md +1 -0
  186. data/lib/generators/templates/views/application.html.erb +71 -0
  187. data/lib/generators/templates/views/application/_head.html.erb +47 -0
  188. data/lib/generators/templates/views/application/_resources.html.erb +16 -0
  189. data/lib/generators/templates/views/application/_schema.html.erb +6 -0
  190. data/lib/generators/templates/views/config/mime_types.rb +8 -0
  191. metadata +294 -0
@@ -0,0 +1 @@
1
+ **Thank you for installing amp-html!**
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Jonas Hübotter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ - jonhue
@@ -0,0 +1,192 @@
1
+ # [BETA] AMP-HTML - Reliable and high-:zap: apps with AMP & Rails
2
+
3
+ <img src="https://travis-ci.org/slooob/amp-html.svg?branch=master" /> [![Gem Version](https://badge.fury.io/rb/amp-html.svg)](https://badge.fury.io/rb/amp-html) [![Code Climate](https://codeclimate.com/github/jonhue/amp-html/badges/gpa.svg)](https://codeclimate.com/github/jonhue/amp-html)
4
+
5
+ AmpHtml is a universal solution to integrate the AMP Project (Accelerated Mobile Pages Project) into your Rails app with ease. It enables you to quickly spin-up, build and test your app with AMP, while fulfilling the app's unique requirements. It comes with a bunch of superpowers like user authentication, notifications, blogs, animations and support for assets in AMP.
6
+
7
+ Use the powerful features of AMP to make your Rails app consistently fast, beautiful and high-performing across devices and distribution platforms.
8
+
9
+ [**Follow the Getting Started Guide**](https://github.com/slooob/amp-html/wiki/Getting-started)
10
+
11
+ ---
12
+
13
+ ## Navigation
14
+
15
+ * [Information](#information)
16
+ * [Quick info (Latest release, Dependencies)](#quick-info)
17
+ * [The AMP-HTML wiki](#the-amp-html-wiki)
18
+ * [Bug reports](#bug-reports)
19
+ * [Example applications](#example-applications)
20
+ * [Contributing](#contributing)
21
+ * [Concept](#concept)
22
+ * [Features](#features)
23
+ * [Installation](#installation)
24
+ * [Generators](#generators)
25
+ * [Test and validate AMP](#test-and-validate-amp)
26
+ * [Usage](#usage)
27
+ * [Helpers](#helpers)
28
+ * [SplitView](#splitview)
29
+ * [Guides](#guides)
30
+ * [Components](#components)
31
+ * [Contributors](#contributors)
32
+ * [License](#license)
33
+
34
+ ---
35
+
36
+ ## Information
37
+
38
+ ### Quick info
39
+
40
+ #### Latest release: 0.7.7 (Pre-release)
41
+
42
+ [**Changelog**](https://github.com/slooob/amp-html/blob/master/CHANGELOG.md), [Grab it from Rubygems](https://rubygems.org/gems/amp-html)
43
+
44
+ #### Supported versions
45
+
46
+ Rails >= 4.0.0
47
+ Ruby >= 2.0
48
+
49
+ ### The AMP-HTML wiki
50
+
51
+ The AMP-HTML Wiki has lots of additional information about AMP-HTML including many "how-to" articles and answers to the most frequently asked questions. Please browse the Wiki after finishing this README:
52
+
53
+ [https://github.com/slooob/amp-html/wiki](https://github.com/slooob/amp-html/wiki)
54
+
55
+ ### Bug reports
56
+
57
+ If you discover a problem with AMP-HTML, we would like to know about it. However, we ask that you please review these guidelines before submitting a bug report:
58
+
59
+ [https://github.com/slooob/amp-html/wiki/Bug-reports](https://github.com/slooob/amp-html/wiki/Bug-reports)
60
+
61
+ If you have discovered a security related bug, please do *NOT* use the GitHub issue tracker. Send an email to [jonas@slooob.com](mailto:jonas@slooob.com).
62
+
63
+ ### Example applications
64
+
65
+ There are a few example applications available on GitHub that demonstrate various features of AMP-HTML. You can view them here:
66
+
67
+ [https://github.com/slooob/amp-html/wiki/Example-Applications](https://github.com/slooob/amp-html/wiki/Example-Applications)
68
+
69
+ ### Contributing
70
+
71
+ We hope that you will consider contributing to AMP-HTML. Please read this short overview for some information about how to get started:
72
+
73
+ [Contributing](https://github.com/slooob/amp-html/blob/master/CONTRIBUTING.md), [Code of Conduct](https://github.com/slooob/amp-html/blob/master/CODE_OF_CONDUCT.md)
74
+
75
+ ## Concept
76
+
77
+ ## Features
78
+
79
+ ## Installation
80
+
81
+ You can also follow the [**Getting Started Guide**](https://github.com/slooob/amp-html/wiki/Getting-started).
82
+
83
+ AMP-HTML works with Rails 4.0 onwards. You can add it to your `Gemfile` with:
84
+
85
+ ```ruby
86
+ gem 'amp-html'
87
+ ```
88
+
89
+ And then execute:
90
+
91
+ $ bundle
92
+
93
+ Or install it yourself as:
94
+
95
+ $ gem install amp-html
96
+
97
+ If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
98
+
99
+ ```ruby
100
+ gem 'amp-html', github: 'https://github.com/slooob/amp-html.git'
101
+ ```
102
+
103
+ ### Generators
104
+
105
+ AmpHtml comes with three different generators. If you want to bundle them execute:
106
+
107
+ $ rails g amp-html:bundle
108
+
109
+ That will generate all the files you need to create a universal AMP app (recommended).
110
+
111
+ If you want to use [SplitView](https://github.com/slooob/amp-html/wiki/Docs:-SplitView) to create views with and without AMP simultaneously, execute instead:
112
+
113
+ $ rails g amp-html:bundle --split
114
+
115
+ To add components ([List of components](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/README.md)) to the generator simply include the component as an option:
116
+
117
+ $ rails g amp-html:bundle --analytics --notifications
118
+
119
+ You can also run the three generators independently:
120
+
121
+ $ rails g amp-html:install
122
+ $ rails g amp-html:helpers
123
+ $ rails g amp-html:views
124
+
125
+ *Each* of them supports the `--split || -s` option to use **both** regular views and AMP views.
126
+ To add components, you need to pass them as option to each generator.
127
+
128
+ ### Test and validate AMP
129
+
130
+ AmpHtml allows you to test and validate your views out of the box:
131
+
132
+ $ amp-html test all
133
+
134
+ Pass `--split` as an option if you are using SplitView:
135
+
136
+ $ amp-html test all --split
137
+
138
+ `test all` runs multiple tests to check if your code is valid. You can also run each test specifically.
139
+
140
+ To get a list of all tests and learn how to run them, go to [how to test and validate](https://github.com/slooob/amp-html/wiki/Guides:-Test-and-validate)
141
+
142
+ To all tests (even `test all`) you can pass the option `--fix || -f` and AmpHtml will suggest changes you could make. You can accept or reject them.
143
+ If you want to automatically fix the code, pass `--autofix || -af` as option. Be careful, you will not be asked to approve changes to the documents!
144
+
145
+ AMP has a validator built in. To validate:
146
+
147
+ $ amp-html validate root # validates "http://localhost:3000"
148
+ $ amp-html validate https://slooob.com # validates "https://slooob.com"
149
+
150
+ **Note:** `root` is only available as a parameter in development environment..
151
+
152
+ ## Usage
153
+
154
+ ### Helpers
155
+
156
+ ### SplitView
157
+
158
+ ## Guides
159
+
160
+ ## Components
161
+
162
+ ---
163
+
164
+ ## Contributors
165
+
166
+ Give the people some :heart: who are working on this project. Check them all at:
167
+
168
+ [https://github.com/slooob/amp-html/graphs/contributors](https://github.com/slooob/amp-html/graphs/contributors)
169
+
170
+ ## License
171
+
172
+ MIT License
173
+
174
+ Copyright (c) 2017 Jonas Hübotter
175
+
176
+ Permission is hereby granted, free of charge, to any person obtaining a copy
177
+ of this software and associated documentation files (the "Software"), to deal
178
+ in the Software without restriction, including without limitation the rights
179
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
180
+ copies of the Software, and to permit persons to whom the Software is
181
+ furnished to do so, subject to the following conditions:
182
+
183
+ The above copyright notice and this permission notice shall be included in all
184
+ copies or substantial portions of the Software.
185
+
186
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
187
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
188
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
189
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
190
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
191
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
192
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path(File.join('..', 'lib', 'amp_html', 'version'), __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'amp-html'
6
+ gem.version = AmpHtml::VERSION
7
+ gem.platform = Gem::Platform::RUBY
8
+ gem.summary = 'Reliable and high-performant apps with AMP & Rails.'
9
+ gem.description = "[BETA] AmpHtml is a universal solution to integrate the AMP Project (Accelerated Mobile Pages Project) into your Rails app with ease. It enables you to quickly spin-up, build and test your app with AMP, while fulfilling the app's unique requirements. It comes with a bunch of superpowers like user authentication, notifications, blogs, animations and support for assets in AMP. Make your app consistently fast, beautiful and high-performing across devices and distribution platforms."
10
+ gem.authors = ['Jonas Hübotter']
11
+ gem.email = 'developer@slooob.com'
12
+ gem.homepage = 'https://github.com/slooob/amp-html' # https://railsamp.com
13
+ gem.license = 'MIT'
14
+
15
+ gem.files = `git ls-files`.split("\n")
16
+ gem.require_paths = ['lib']
17
+ gem.bindir = 'bin'
18
+ gem.executables = ['amp-html']
19
+
20
+ gem.post_install_message = IO.read('INSTALL.md')
21
+
22
+ gem.required_ruby_version = '>= 2.0'
23
+
24
+
25
+ gem.add_dependency 'rails', '>= 4.0.0'
26
+ gem.add_dependency 'thor', '~> 0.19.4'
27
+ gem.add_dependency 'launchy', '~> 2.4'
28
+ gem.add_dependency 'highline', '~> 1.7'
29
+ end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'amp-html'
4
+ AmpHtml::Cli.start
@@ -0,0 +1,27 @@
1
+ begin
2
+ require 'rails'
3
+ rescue Exception
4
+ warn 'Ensure you are in a Ruby on Rails environment'
5
+ end
6
+
7
+ module AmpHtml
8
+
9
+ require 'amp_html/root'
10
+ require 'amp_html/version'
11
+
12
+ require 'amp_html/cli'
13
+
14
+ require 'amp_html/configuration'
15
+ require 'amp_html/configuration/help'
16
+
17
+ require 'amp_html/test'
18
+ require 'amp_html/validate'
19
+
20
+ require 'amp_html/components/install'
21
+
22
+ require 'amp_html/helpers/help'
23
+ require 'amp_html/components/help'
24
+ require 'amp_html/test/help'
25
+ require 'amp_html/validate/help'
26
+
27
+ end
@@ -0,0 +1,113 @@
1
+ require 'thor'
2
+
3
+ class AmpHtml::Cli < Thor
4
+
5
+ check_unknown_options!
6
+
7
+ desc 'version', 'Display currently used version'
8
+ map %w[--version] => :version
9
+
10
+ def version
11
+ puts ::AmpHtml::Version.current
12
+ end
13
+
14
+
15
+ desc 'helpers', 'Learn more about AMP-HTML view helpers'
16
+ map %w[--helpers] => :helpers
17
+
18
+ def helpers
19
+ puts ::AmpHtml::Helpers::Help.all
20
+ end
21
+
22
+
23
+ desc 'helper NAME', 'Get infomration about a specific AMP-HTML helper'
24
+ map %w[--helper] => :helper
25
+
26
+ def helper name
27
+ puts ::AmpHtml::Helpers::Help.helper name
28
+ end
29
+
30
+
31
+ desc 'configuration', 'Learn how to configure AMP-HTML'
32
+ map %w[--configuration] => :configuration
33
+
34
+ def configuration
35
+ puts ::AmpHtml::Configuration::Help.all
36
+ end
37
+
38
+
39
+ desc 'components', 'Learn more about AMP-HTML installable components'
40
+ map %w[--components] => :components
41
+
42
+ def components
43
+ puts ::AmpHtml::Components::Help.all
44
+ end
45
+
46
+
47
+ desc 'component NAME', 'Get infomration about a specific AMP-HTML installable component'
48
+ map %w[--component] => :component
49
+
50
+ def component name
51
+ puts ::AmpHtml::Components::Help.component name
52
+ end
53
+
54
+
55
+ desc 'bundle', 'Install all AMP-HTML components specified in the config/AmpHtml.yml file'
56
+ map %w[-b --bundle] => :bundle
57
+
58
+ def bundle
59
+ puts ::AmpHtml::Components::Install.bundle
60
+ end
61
+
62
+ desc 'install COMPONENT', 'Install a specific AMP-HTML component'
63
+ map %w[-b --bundle] => :install
64
+
65
+ def install component
66
+ puts ::AmpHtml::Components::Install.install component
67
+ end
68
+
69
+
70
+ desc 'validate URL', 'Validate a specific AMP-HTML view'
71
+ map %w[--validate] => :validate
72
+
73
+ option :server_running, desc: 'Passes information that the server is running (optional)', type: :boolean, default: false, aliases: '-r'
74
+ option :help, desc: 'Additional help information', type: :boolean, default: false, aliases: '-h'
75
+
76
+ def validate url
77
+ unless options[:help]
78
+ if options[:server_running]
79
+ puts ::AmpHtml::Validate.validate url, true
80
+ else
81
+ puts ::AmpHtml::Validate.validate url, false
82
+ end
83
+ else
84
+ puts ::AmpHtml::Validate::Help.all
85
+ end
86
+ end
87
+
88
+
89
+ desc 'test NAME', 'Test AMP-HTML components. Run test all to bundle tests.'
90
+ map %w[-t --test] => :test
91
+
92
+ option :split, desc: 'Use this option if you are using SplitView', type: :boolean, default: false, aliases: '-s'
93
+ # option :fix, desc: 'Suggest ways to fix errors along the way', type: :boolean, default: false, aliases: '-f'
94
+ # option :autofix, desc: 'Attempt to automatically fix errors (not recommended)', type: :boolean, default: false, aliases: '-af'
95
+ option :help, desc: 'Additional help information', type: :boolean, default: false, aliases: '-h'
96
+
97
+ def test name
98
+ unless options[:help]
99
+ if name == 'all'
100
+ puts ::AmpHtml::Test.all
101
+ elsif name == 'markup'
102
+ puts ::AmpHtml::Test.markup
103
+ elsif name == 'html'
104
+ puts ::AmpHtml::Test.html
105
+ elsif name == 'css'
106
+ puts ::AmpHtml::Test.css
107
+ end
108
+ else
109
+ puts ::AmpHtml::Test::Help.all
110
+ end
111
+ end
112
+
113
+ end
@@ -0,0 +1,101 @@
1
+
2
+ # AMP-HTML Components
3
+
4
+
5
+ ## All Components
6
+
7
+ All currently supported components for AMP-HTML. New are added continuously.
8
+
9
+ ### Built-in
10
+
11
+ * [Media BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/media.md)
12
+ * [Forms BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/forms.md)
13
+ * [Schema.org](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/schema.md)
14
+ * [Fonts BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/fonts.md)
15
+ * [Stylesheets](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/stylesheets.md)
16
+ * [Mustache.js](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/mustache.md)
17
+
18
+ ### Installable
19
+
20
+ * [Advertisements BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/ad.md)
21
+ * [Analytics BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/analytics.md)
22
+ * [Animated Images BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/anim.md)
23
+ * [Iframe BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/iframe.md)
24
+ * [Notifications BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/notifications.md)
25
+ * [Social BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/social.md)
26
+ * [Javascript BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/javascript.md)
27
+ * [Service Worker BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/service_worker.md)
28
+ * [Lists BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/lists.md)
29
+
30
+
31
+ ## Installing Components
32
+
33
+ AMP-HTML makes it easy to add new feature-sets with components without bloating your app right from the beginning.
34
+
35
+ You can install any component by running:
36
+
37
+ amp-html install NAME
38
+
39
+ So running `amp-html install analytics` will install the AMP-HTML Analytics component.
40
+
41
+ You can view all currently installed components in your AMP-HTML configuration file (`config/amp-html.yml`).
42
+
43
+ After editing the list of components in your configuration run:
44
+
45
+ amp-html bundle
46
+
47
+ to install all added and uninstall all removed components.
48
+
49
+ **Now you are ready to use your added components.**
50
+ To learn more about the features of a specific component, take a look at their dedicated references.
51
+
52
+ To update your configuration file after new components got added to AMP-HTML run:
53
+
54
+ rails g amp-html:install
55
+
56
+
57
+ ## About Components
58
+
59
+ AMP-HTML components are an easy way to use AMP and Rails to build slim, performant and powerful applications. They allow to add the exact superpower or feature your app needs. You stay in control of what features your app uses and which not.
60
+
61
+ ### What features are components?
62
+
63
+ The vanilla version of AMP-HTML comes just with everything you need to get you and your app started with AMP. To really profit from all the features that AMP-HTML provides, you need to install components. Some components like "Iframe" or "Animated Images" are considerably smaller than others like "Authentication" and "Notifications". You decide which components your app needs.
64
+
65
+ ### DeepIntegration Components
66
+
67
+ DeepIntegration components are usually larger, more complex components, that integrate more deeply into your app. They often provide options to get configured in your AMP-HTML configuration file (`config/amp-html.yml`) and / or they require to be setup in your view. You can learn more about whether a certain component has DeepIntegration or not by looking at their dedicated references.
68
+
69
+ ### Availability of Components
70
+
71
+ The availability of components summarizes whether a component is included in the vanilla version of AMP-HTML or if it needs to be installed in order to get used.
72
+
73
+ ---
74
+
75
+ ## New Components
76
+
77
+ Take a look at the newest additions of components to AMP-HTML.
78
+
79
+ * [Lists BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/lists.md)
80
+ * [Mustache.js](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/mustache.md)
81
+ * [Service Worker BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/service_worker.md)
82
+ * [Forms BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/forms.md)
83
+ * [Javascript BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/javascript.md)
84
+
85
+
86
+ ## Components in BETA
87
+
88
+ Take a look at the newest additions of components to AMP-HTML.
89
+
90
+ * [Forms BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/forms.md)
91
+ * [Media BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/media.md)
92
+ * [Fonts BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/fonts.md)
93
+ * [Advertisements BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/ad.md)
94
+ * [Analytics BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/analytics.md)
95
+ * [Animated Images BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/anim.md)
96
+ * [Iframe BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/iframe.md)
97
+ * [Notifications BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/notifications.md)
98
+ * [Social BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/social.md)
99
+ * [Javascript BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/javascript.md)
100
+ * [Service Worker BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/service_worker.md)
101
+ * [Lists BETA](https://github.com/slooob/amp-html/blob/master/lib/amp-html/components/docs/lists.md)