roda-project 0.1.3 → 0.1.4
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/lib/roda/project/context.rb +3 -1
- data/lib/roda/project/version.rb +1 -1
- data/lib/roda/project.rb +1 -1
- data/lib/roda/templates/base/minimal/app.rb +1 -1
- data/lib/roda/templates/base/minimal/config.ru +1 -1
- data/lib/roda/templates/base/scaffold/app/config/config.rb.erb +12 -2
- data/lib/roda/templates/front-end/app/views/html.rb +16 -0
- data/lib/roda/templates/front-end/app/views/layout.erb +3 -1
- data/lib/roda/templates/front-end/esbuild.js +24 -17
- data/lib/roda/templates/front-end/package.json +1 -0
- metadata +3 -3
- /data/lib/roda/templates/base/scaffold/public/{css → assets}/app.css +0 -0
- /data/lib/roda/templates/base/scaffold/public/{js → assets}/app.js +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 481798dedf638baf4a37f1a8f1c554086eaa1fe9ba9ad409b6301a6693d5ab32
|
|
4
|
+
data.tar.gz: fa9bb1b2f1f6d7d465ebda947b1e62a3d5c4a0cb9e3837db4abd59c2df3304b5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 63e2755468f18b312a2de6f09117564ea91d073bcb55422f1963737ed04268087cdb7555ae2fd60e6742f7e64ac465decfde11dac17886dd52c81a42baa5a979
|
|
7
|
+
data.tar.gz: e2755bb05abdd00d0fc285b2975aa07ace46b8d885a53af09f3b08be1bcd636e56877c44f7dd8daf99ce4dd2b0c3954405bf9de3f4728d1b02c03d3ae2ae0532
|
data/lib/roda/project/context.rb
CHANGED
|
@@ -45,6 +45,7 @@ module Roda
|
|
|
45
45
|
@database = val
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
# rubocop:disable Lint/InterpolationCheck
|
|
48
49
|
def database_type=(val)
|
|
49
50
|
if ![mysql_id, postgresql_id, sqlite_id].include?(val)
|
|
50
51
|
raise InvalidValue, "Invalid database option"
|
|
@@ -63,6 +64,7 @@ module Roda
|
|
|
63
64
|
@db_gem = "sqlite3"
|
|
64
65
|
end
|
|
65
66
|
end
|
|
67
|
+
# rubocop:enable Lint/InterpolationCheck
|
|
66
68
|
|
|
67
69
|
def project_name=(val)
|
|
68
70
|
if !(val =~ VALID_PROJECT_NAME_REGEX)
|
|
@@ -133,7 +135,7 @@ module Roda
|
|
|
133
135
|
end
|
|
134
136
|
|
|
135
137
|
def const_project_name
|
|
136
|
-
@const_project_name ||= project_name.split(
|
|
138
|
+
@const_project_name ||= project_name.split("_").map(&:capitalize).join
|
|
137
139
|
end
|
|
138
140
|
end
|
|
139
141
|
end
|
data/lib/roda/project/version.rb
CHANGED
data/lib/roda/project.rb
CHANGED
|
@@ -50,7 +50,7 @@ module Roda
|
|
|
50
50
|
['"Start where you are. Use what you have. Do what you can." - Arthur Ashe'],
|
|
51
51
|
['"A goal is a dream with a deadline." - Napoleon Hill'],
|
|
52
52
|
['"Things do not happen. Things are made to happen." - John F. Kennedy'],
|
|
53
|
-
['"Quality is not an act, it is a habit." - Aristotle']
|
|
53
|
+
['"Quality is not an act, it is a habit." - Aristotle']
|
|
54
54
|
]
|
|
55
55
|
end
|
|
56
56
|
end
|
|
@@ -9,15 +9,25 @@ module Config
|
|
|
9
9
|
i18n: {
|
|
10
10
|
translations: ["app/config/locales", "app/config/locales/foo"],
|
|
11
11
|
locale: ["en", "pt-br"]
|
|
12
|
-
}
|
|
12
|
+
}<% if context.database? %>,
|
|
13
13
|
db: {
|
|
14
14
|
url: not_production? ? <%= context.dev_db_url %> : ENV["DATABASE_URL"]
|
|
15
|
+
}<% end %><% if context.fullstack? %>,
|
|
16
|
+
assets: {
|
|
17
|
+
host: '/public/assets',
|
|
18
|
+
manifest:
|
|
15
19
|
}<% end %>
|
|
16
20
|
}
|
|
17
21
|
end
|
|
18
22
|
|
|
19
|
-
def not_production? = environment != "production"
|
|
23
|
+
def not_production? = environment != "production"<% if context.fullstack? %>
|
|
24
|
+
def manifest
|
|
25
|
+
manifest_path = File.expand_path("../../public/assets/manifest.json", __dir__)
|
|
26
|
+
return JSON.parse(File.read(manifest_path)) if File.exist?(manifest_path)
|
|
20
27
|
|
|
28
|
+
{}
|
|
29
|
+
end
|
|
30
|
+
<% end %>
|
|
21
31
|
def environment
|
|
22
32
|
ENV["RACK_ENV"] || "development"
|
|
23
33
|
end
|
|
@@ -10,6 +10,22 @@ module Views
|
|
|
10
10
|
@foo = Views::Foo::Html.new
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
def js_entrypoint_tag(entrypoint)
|
|
14
|
+
if Config.not_production?
|
|
15
|
+
"<script src=\"/public/assets/#{entrypoint}.js\" defer></script>"
|
|
16
|
+
else
|
|
17
|
+
"<script src=\"#{Config.get[:assets][:host]}/#{Config.get[:assets][:manifest]["#{entrypoint}.js"]}\" defer></script>"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def css_entrypoint_tag(entrypoint)
|
|
22
|
+
if Config.not_production?
|
|
23
|
+
"<link rel=\"stylesheet\" href=\"/public/assets/#{entrypoint}.css\" />"
|
|
24
|
+
else
|
|
25
|
+
"<link rel=\"stylesheet\" href=\"#{Config.get[:assets][:host]}/#{Config.get[:assets][:manifest]["#{entrypoint}.css"]}\" />"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
13
29
|
def navbar
|
|
14
30
|
html_slice do
|
|
15
31
|
div class: "navbar" do
|
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
const esbuild = require('esbuild');
|
|
2
|
-
|
|
2
|
+
const manifestPlugin = require('esbuild-plugin-manifest');
|
|
3
3
|
const isWatchMode = process.argv.includes('--watch');
|
|
4
|
+
const isProduction = process.env.RACK_ENV === 'production';
|
|
5
|
+
|
|
6
|
+
const cssEntryPoints = ['app']
|
|
7
|
+
const jsEntryPoints = ['app']
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
function config() {
|
|
10
|
+
const assetsEntryPoints =
|
|
11
|
+
cssEntryPoints.map((e) => `css/${e}.css`)
|
|
12
|
+
.concat(
|
|
13
|
+
jsEntryPoints.map((e) => `js/${e}.js`)
|
|
14
|
+
)
|
|
9
15
|
|
|
10
|
-
function configFor(name) {
|
|
11
16
|
return {
|
|
12
|
-
entryPoints:
|
|
17
|
+
entryPoints: assetsEntryPoints.map((name) => `app/assets/${name}`),
|
|
13
18
|
bundle: true,
|
|
14
|
-
minify:
|
|
15
|
-
|
|
19
|
+
minify: isProduction,
|
|
20
|
+
outdir: "public/assets",
|
|
21
|
+
entryNames: isProduction ? '[name]-[hash]' : '[name]',
|
|
22
|
+
plugins: isProduction ? [
|
|
23
|
+
manifestPlugin({ shortNames: true })
|
|
24
|
+
] : [],
|
|
16
25
|
}
|
|
17
26
|
}
|
|
18
27
|
|
|
19
28
|
async function build() {
|
|
20
29
|
try {
|
|
21
30
|
if (isWatchMode) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
26
|
-
console.log(`Watching for css and js changes in '${entrypoints.join(', ')}'...`);
|
|
31
|
+
const ctx = await esbuild.context(config());
|
|
32
|
+
await ctx.watch();
|
|
33
|
+
|
|
34
|
+
console.log(`Watching for css and js changes in '${assetsEntryPoints.join(', ')}'...`);
|
|
27
35
|
} else {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
36
|
+
await esbuild.build(config());
|
|
37
|
+
|
|
31
38
|
console.log(`Build complete.`);
|
|
32
39
|
}
|
|
33
40
|
} catch (error) {
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roda-project
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Henrique F. Teixeira
|
|
@@ -95,10 +95,10 @@ files:
|
|
|
95
95
|
- lib/roda/templates/base/scaffold/app/routes/foo.rb.erb
|
|
96
96
|
- lib/roda/templates/base/scaffold/boot.rb.erb
|
|
97
97
|
- lib/roda/templates/base/scaffold/config.ru.erb
|
|
98
|
-
- lib/roda/templates/base/scaffold/public/
|
|
98
|
+
- lib/roda/templates/base/scaffold/public/assets/app.css
|
|
99
|
+
- lib/roda/templates/base/scaffold/public/assets/app.js
|
|
99
100
|
- lib/roda/templates/base/scaffold/public/exception_page.css
|
|
100
101
|
- lib/roda/templates/base/scaffold/public/images/roda-project.png
|
|
101
|
-
- lib/roda/templates/base/scaffold/public/js/app.js
|
|
102
102
|
- lib/roda/templates/database/app/config/providers/db/conn.rb
|
|
103
103
|
- lib/roda/templates/database/db/seeds.rb
|
|
104
104
|
- lib/roda/templates/front-end/app/assets/css/app.css
|
|
File without changes
|
|
File without changes
|