static-site-builder 0.0.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.
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ begin
5
+ if ARGV[0] == "new" && ARGV[1]
6
+ # Remove "new" from ARGV so bin/generate gets just the app name
7
+ app_name = ARGV[1]
8
+ ARGV.clear
9
+ ARGV << app_name
10
+
11
+ # Load the generator directly instead of loading bin/generate
12
+ require "static_site_builder"
13
+ require "tty-prompt"
14
+
15
+ prompt = TTY::Prompt.new
16
+
17
+ template_engine = prompt.select(
18
+ "Template engine?",
19
+ StaticSiteBuilder::Generator::TEMPLATE_ENGINES.map(&:capitalize),
20
+ default: 1
21
+ ).downcase
22
+
23
+ js_bundler = prompt.select(
24
+ "JavaScript bundler?",
25
+ StaticSiteBuilder::Generator::JS_BUNDLERS.map(&:capitalize),
26
+ default: 1
27
+ ).downcase
28
+
29
+ css_framework = prompt.select(
30
+ "CSS framework?",
31
+ StaticSiteBuilder::Generator::CSS_FRAMEWORKS.map(&:capitalize),
32
+ default: 1
33
+ ).downcase
34
+
35
+ js_framework = prompt.select(
36
+ "JavaScript framework?",
37
+ StaticSiteBuilder::Generator::JS_FRAMEWORKS.map(&:capitalize),
38
+ default: 1
39
+ ).downcase
40
+
41
+ options = {
42
+ template_engine: template_engine,
43
+ js_bundler: js_bundler,
44
+ css_framework: css_framework,
45
+ js_framework: js_framework
46
+ }
47
+
48
+ generator = StaticSiteBuilder::Generator.new(app_name, options)
49
+ generator.generate
50
+ else
51
+ puts "Usage: static-site-builder new <app-name>"
52
+ puts " or: ruby bin/generate <app-name>"
53
+ exit 1
54
+ end
55
+ rescue Interrupt
56
+ puts "\n\nGeneration cancelled."
57
+ exit 1
58
+ end