vitepress-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e3630ebac35f9a3cf3c2ebf4d5c027a7557385efd79a92337a8761bc1494a4bf
4
+ data.tar.gz: 53358818d780b7aa1131a42ca94fe5c3983405eee9467c2c0fa126cc999bf2c7
5
+ SHA512:
6
+ metadata.gz: 1cc7c0194939b5320f35b037602a0b56f259d0931f2031af775b903e0647941ed03a4c62847c39cd4a6c2a8af9c3c431ef27f6da419afc31674861b37df1866f
7
+ data.tar.gz: 861167cb94ba5e10704221df08a36feacf44d01881b26e031c615f67a09fbc2c678c19017a4026d4c501a5f09ce5e913cb084a524b1dfbb7556209bd0064a281
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vitepress
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace Vitepress
6
+
7
+ initializer :load_config_initializers do
8
+ config.paths["config/initializers"].existent.sort.each do |initializer|
9
+ load_config_initializer(initializer)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "high_voltage/page_finder"
4
+
5
+ class Vitepress::Rails::Finder < HighVoltage::PageFinder
6
+ def find
7
+ super.chomp(".html")
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vitepress
4
+ module Rails
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rails/version"
4
+ require "vitepress/rails/version"
5
+ require "vitepress/engine"
6
+
7
+ module Vitepress
8
+ require "vitepress/railtie" if defined?(Rails)
9
+
10
+ module Rails
11
+ class Error < StandardError; end
12
+ # Your code goes here...
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/railtie"
4
+
5
+ module Vitepress
6
+ class Railtie < ::Rails::Railtie
7
+ railtie_name :vitepress
8
+
9
+ rake_tasks do
10
+ path = File.expand_path(__dir__)
11
+ Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ if Rails.root.join(".gitignore").exist?
4
+ # High voltage genereated files
5
+ append_to_file(".gitignore", %(\n/app/views/pages/*\n!app/views/pages/.keep\n))
6
+ # Vitepress generated files
7
+ append_to_file(".gitignore", %(\n.vitepress/dist\n.vitepress/cache\n))
8
+ end
9
+
10
+ unless Rails.root.join("package.json").exist?
11
+ say "Add default package.json"
12
+ copy_file "#{__dir__}/package.json", "package.json"
13
+ end
14
+
15
+ say "Install vitepress"
16
+ run "yarn add -D vitepress"
17
+
18
+ say "Add build script"
19
+ dev_script = "vitepress dev docs"
20
+ build_script = "vitepress build docs"
21
+
22
+ case %x(npx -v).to_f
23
+ when 7.1...8.0
24
+ run %(npm set-script docs:dev "#{dev_script}")
25
+ run %(npm set-script docs:build "#{build_script}")
26
+ when (8.0..)
27
+ run %(npm pkg set scripts.docs:dev="#{dev_script}")
28
+ run %(npm pkg set scripts.docs:build="#{build_script}")
29
+ else
30
+ say %(Add "scripts": { "docs:dev": "#{dev_script}" } to your package.json), :green
31
+ say %(Add "scripts": { "docs:build": "#{build_script}" } to your package.json), :green
32
+ end
33
+
34
+ say "Default vitepress config"
35
+ copy_file "#{__dir__}/config.js", "docs/.vitepress/config.js"
36
+ copy_file "#{__dir__}/index.md", "docs/index.md"
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vitepress-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - PedroAugustoRamalhoDuarte
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-03-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: high_voltage
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ description:
42
+ email:
43
+ - pedroaugustorduarte@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/vitepress/engine.rb
49
+ - lib/vitepress/rails.rb
50
+ - lib/vitepress/rails/finder.rb
51
+ - lib/vitepress/rails/version.rb
52
+ - lib/vitepress/railtie.rb
53
+ - lib/vitepress/tasks/vitepress/init/install.rb
54
+ homepage: https://github.com/SwitchDreams/rest-api-generator
55
+ licenses:
56
+ - MIT
57
+ metadata:
58
+ allowed_push_host: https://rubygems.org/
59
+ homepage_uri: https://github.com/SwitchDreams/rest-api-generator
60
+ source_code_uri: https://github.com/SwitchDreams/vitepress-rails
61
+ changelog_uri: https://github.com/SwitchDreams/vitepress-rails
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 2.6.0
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubygems_version: 3.3.3
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Vitepress for rails
81
+ test_files: []