jetski 0.3.7 → 0.3.8
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 +4 -4
- data/bin/jetski +2 -2
- data/bin/jetski_cli_helpers/generate.rb +2 -2
- data/bin/templates/base/app/views/layouts/{application.html → application.html.erb} +1 -1
- data/bin/templates/views/{example.html → example.html.erb} +1 -1
- data/lib/jetski/base_controller.rb +10 -3
- data/lib/jetski/version.rb +1 -1
- data/lib/jetski.rb +1 -0
- metadata +18 -4
- /data/bin/templates/base/app/views/pages/{home.html → home.html.erb} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4b9af95cf6ae12478fd887ccfa44148279a237b622b893013d0b93e221f3be73
|
|
4
|
+
data.tar.gz: 7f615515947fe954ca0069361cf5eaee12920552028d9e24a3275de2e18713f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 96d3e3bd8b93a7fa3f52195d0ea5bf6c34435f815e56f0da5e285285cba321de6b8645b3d923740aacd5e42e957158d37ba409bc6b3d9fc770da495d65e6e652
|
|
7
|
+
data.tar.gz: de08a81e274f83226cdfb0979656739f6886f04878d87ec5d24e7837d3ef78b6b534569b2dcbee0f826b10de9d994c031c91eb87f86d239128707fbf4d61602e
|
data/bin/jetski
CHANGED
|
@@ -15,8 +15,8 @@ class JetskiCLI < Thor
|
|
|
15
15
|
FileUtils.mkdir_p(name)
|
|
16
16
|
say "Creating #{name} app with Jetski!"
|
|
17
17
|
directory "base", "#{name}"
|
|
18
|
-
gsub_file "#{name}/app/views/layouts/application.html", /APP_NAME/, name.capitalize
|
|
19
|
-
gsub_file "#{name}/app/views/pages/home.html", /APP_NAME/, name.capitalize
|
|
18
|
+
gsub_file "#{name}/app/views/layouts/application.html.erb", /APP_NAME/, name.capitalize
|
|
19
|
+
gsub_file "#{name}/app/views/pages/home.html.erb", /APP_NAME/, name.capitalize
|
|
20
20
|
run "cd #{name} && bundle install"
|
|
21
21
|
say "🌊 Your app #{name} has been generated!"
|
|
22
22
|
end
|
|
@@ -13,10 +13,10 @@ module JetskiCLIHelpers
|
|
|
13
13
|
action_content += "\nACTION_NAME"
|
|
14
14
|
end
|
|
15
15
|
gsub_file(controller_file_path, /ACTION_NAME/, action_content.strip)
|
|
16
|
-
path_to_view = "app/views/#{name}/#{action_name}.html"
|
|
16
|
+
path_to_view = "app/views/#{name}/#{action_name}.html.erb"
|
|
17
17
|
|
|
18
18
|
empty_directory("app/views/#{name}")
|
|
19
|
-
copy_file("views/example.html", path_to_view)
|
|
19
|
+
copy_file("views/example.html.erb", path_to_view)
|
|
20
20
|
gsub_file(path_to_view, /CONTROLLER_NAME/, name)
|
|
21
21
|
gsub_file(path_to_view, /ACTION_NAME/, action_name)
|
|
22
22
|
gsub_file(path_to_view, /PATH_TO_VIEW/, path_to_view)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
<h1> CONTROLLER_NAME#ACTION_NAME </h1>
|
|
2
|
-
<p> edit the content of this page at app/views/PATH_TO_VIEW/ACTION_NAME.html </p>
|
|
2
|
+
<p> edit the content of this page at app/views/PATH_TO_VIEW/ACTION_NAME.html.erb </p>
|
|
@@ -52,12 +52,14 @@ module Jetski
|
|
|
52
52
|
|
|
53
53
|
private
|
|
54
54
|
def render_template_file
|
|
55
|
+
require 'erb'
|
|
55
56
|
views_folder = File.join(Jetski.app_root, 'app/views')
|
|
56
57
|
assets_folder = File.join(Jetski.app_root, 'app/assets/stylesheets')
|
|
57
|
-
layout_content = File.read(File.join(views_folder, "layouts/application.html"))
|
|
58
58
|
path_to_controller = controller_path[1..-1]
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
page_with_layout = process_erb(File.read(File.join(views_folder, "layouts/application.html.erb"))) do
|
|
60
|
+
process_erb(File.read(File.join(views_folder, path_to_controller, "#{action_name}.html.erb")))
|
|
61
|
+
end
|
|
62
|
+
|
|
61
63
|
action_css_file = File.join(assets_folder, "#{path_to_controller}.css")
|
|
62
64
|
css_content = if File.exist? action_css_file
|
|
63
65
|
"<link rel='stylesheet' href='/#{path_to_controller}.css'>"
|
|
@@ -68,5 +70,10 @@ module Jetski
|
|
|
68
70
|
res.content_type = "text/html"
|
|
69
71
|
res.body = page_with_css
|
|
70
72
|
end
|
|
73
|
+
|
|
74
|
+
def process_erb(content)
|
|
75
|
+
template = ERB.new(content)
|
|
76
|
+
template.result(binding)
|
|
77
|
+
end
|
|
71
78
|
end
|
|
72
79
|
end
|
data/lib/jetski/version.rb
CHANGED
data/lib/jetski.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jetski
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Indigo Tech Tutorials
|
|
@@ -51,6 +51,20 @@ dependencies:
|
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: 0.6.2
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: erb
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 5.1.2
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: 5.1.2
|
|
54
68
|
description: 'Would you rather ride on a train or a jetski? that is the question you
|
|
55
69
|
might use when comparing using our framework or the popular Ruby on Rails framework. '
|
|
56
70
|
email: indigo@tech.tut
|
|
@@ -67,10 +81,10 @@ files:
|
|
|
67
81
|
- bin/templates/base/app/assets/stylesheets/application.css
|
|
68
82
|
- bin/templates/base/app/assets/stylesheets/pages.css
|
|
69
83
|
- bin/templates/base/app/controllers/pages_controller.rb
|
|
70
|
-
- bin/templates/base/app/views/layouts/application.html
|
|
71
|
-
- bin/templates/base/app/views/pages/home.html
|
|
84
|
+
- bin/templates/base/app/views/layouts/application.html.erb
|
|
85
|
+
- bin/templates/base/app/views/pages/home.html.erb
|
|
72
86
|
- bin/templates/controllers/example_controller
|
|
73
|
-
- bin/templates/views/example.html
|
|
87
|
+
- bin/templates/views/example.html.erb
|
|
74
88
|
- lib/jetski.rb
|
|
75
89
|
- lib/jetski/base_controller.rb
|
|
76
90
|
- lib/jetski/router.rb
|
|
File without changes
|