htm 0.0.15 → 0.0.17
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/.envrc +1 -0
- data/CHANGELOG.md +67 -0
- data/README.md +97 -1592
- data/bin/htm_mcp +31 -0
- data/config/database.yml +7 -4
- data/docs/getting-started/installation.md +31 -11
- data/docs/guides/mcp-server.md +456 -21
- data/docs/multi_framework_support.md +2 -2
- data/examples/mcp_client.rb +2 -2
- data/examples/rails_app/.gitignore +2 -0
- data/examples/rails_app/Gemfile +22 -0
- data/examples/rails_app/Gemfile.lock +438 -0
- data/examples/rails_app/Procfile.dev +1 -0
- data/examples/rails_app/README.md +98 -0
- data/examples/rails_app/Rakefile +5 -0
- data/examples/rails_app/app/assets/stylesheets/application.css +83 -0
- data/examples/rails_app/app/assets/stylesheets/inter-font.css +6 -0
- data/examples/rails_app/app/controllers/application_controller.rb +19 -0
- data/examples/rails_app/app/controllers/dashboard_controller.rb +27 -0
- data/examples/rails_app/app/controllers/files_controller.rb +205 -0
- data/examples/rails_app/app/controllers/memories_controller.rb +102 -0
- data/examples/rails_app/app/controllers/robots_controller.rb +44 -0
- data/examples/rails_app/app/controllers/search_controller.rb +46 -0
- data/examples/rails_app/app/controllers/tags_controller.rb +30 -0
- data/examples/rails_app/app/javascript/application.js +4 -0
- data/examples/rails_app/app/javascript/controllers/application.js +9 -0
- data/examples/rails_app/app/javascript/controllers/index.js +6 -0
- data/examples/rails_app/app/views/dashboard/index.html.erb +123 -0
- data/examples/rails_app/app/views/files/index.html.erb +108 -0
- data/examples/rails_app/app/views/files/new.html.erb +321 -0
- data/examples/rails_app/app/views/files/show.html.erb +130 -0
- data/examples/rails_app/app/views/layouts/application.html.erb +124 -0
- data/examples/rails_app/app/views/memories/_memory_card.html.erb +51 -0
- data/examples/rails_app/app/views/memories/deleted.html.erb +62 -0
- data/examples/rails_app/app/views/memories/edit.html.erb +35 -0
- data/examples/rails_app/app/views/memories/index.html.erb +81 -0
- data/examples/rails_app/app/views/memories/new.html.erb +71 -0
- data/examples/rails_app/app/views/memories/show.html.erb +126 -0
- data/examples/rails_app/app/views/robots/index.html.erb +106 -0
- data/examples/rails_app/app/views/robots/new.html.erb +36 -0
- data/examples/rails_app/app/views/robots/show.html.erb +79 -0
- data/examples/rails_app/app/views/search/index.html.erb +184 -0
- data/examples/rails_app/app/views/shared/_navbar.html.erb +52 -0
- data/examples/rails_app/app/views/shared/_stat_card.html.erb +52 -0
- data/examples/rails_app/app/views/tags/index.html.erb +131 -0
- data/examples/rails_app/app/views/tags/show.html.erb +67 -0
- data/examples/rails_app/bin/dev +8 -0
- data/examples/rails_app/bin/rails +4 -0
- data/examples/rails_app/bin/rake +4 -0
- data/examples/rails_app/config/application.rb +33 -0
- data/examples/rails_app/config/boot.rb +5 -0
- data/examples/rails_app/config/database.yml +15 -0
- data/examples/rails_app/config/environment.rb +5 -0
- data/examples/rails_app/config/importmap.rb +7 -0
- data/examples/rails_app/config/routes.rb +38 -0
- data/examples/rails_app/config/tailwind.config.js +35 -0
- data/examples/rails_app/config.ru +5 -0
- data/examples/rails_app/log/.keep +0 -0
- data/examples/rails_app/tmp/local_secret.txt +1 -0
- data/lib/htm/active_record_config.rb +2 -5
- data/lib/htm/configuration.rb +35 -2
- data/lib/htm/database.rb +3 -6
- data/lib/htm/mcp/cli.rb +333 -0
- data/lib/htm/mcp/group_tools.rb +476 -0
- data/lib/htm/mcp/resources.rb +89 -0
- data/lib/htm/mcp/server.rb +98 -0
- data/lib/htm/mcp/tools.rb +488 -0
- data/lib/htm/models/file_source.rb +5 -3
- data/lib/htm/railtie.rb +0 -4
- data/lib/htm/tasks.rb +7 -4
- data/lib/htm/version.rb +1 -1
- data/lib/tasks/htm.rake +6 -9
- metadata +59 -4
- data/bin/htm_mcp.rb +0 -621
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<div class="space-y-6">
|
|
2
|
+
<!-- Header -->
|
|
3
|
+
<div class="flex items-center justify-between">
|
|
4
|
+
<div>
|
|
5
|
+
<h1 class="text-2xl font-bold text-white">Tags</h1>
|
|
6
|
+
<p class="mt-1 text-sm text-gray-400">Hierarchical tag organization</p>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="flex items-center gap-2 rounded-lg bg-gray-800 border border-gray-700 p-1">
|
|
9
|
+
<%= link_to tags_path(view: 'list'), class: "rounded px-3 py-1.5 text-sm font-medium #{@view_type == 'list' ? 'bg-indigo-600 text-white' : 'text-gray-400 hover:text-white'}" do %>
|
|
10
|
+
List
|
|
11
|
+
<% end %>
|
|
12
|
+
<%= link_to tags_path(view: 'tree'), class: "rounded px-3 py-1.5 text-sm font-medium #{@view_type == 'tree' ? 'bg-indigo-600 text-white' : 'text-gray-400 hover:text-white'}" do %>
|
|
13
|
+
Tree
|
|
14
|
+
<% end %>
|
|
15
|
+
<%= link_to tags_path(view: 'mermaid'), class: "rounded px-3 py-1.5 text-sm font-medium #{@view_type == 'mermaid' ? 'bg-indigo-600 text-white' : 'text-gray-400 hover:text-white'}" do %>
|
|
16
|
+
Diagram
|
|
17
|
+
<% end %>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<% case @view_type %>
|
|
22
|
+
<% when 'tree' %>
|
|
23
|
+
<!-- Tree View -->
|
|
24
|
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
|
25
|
+
<!-- Text Tree -->
|
|
26
|
+
<div class="rounded-lg bg-gray-800 border border-gray-700 p-6">
|
|
27
|
+
<h2 class="text-lg font-medium text-white mb-4">Text Tree</h2>
|
|
28
|
+
<% if @tree_string.present? %>
|
|
29
|
+
<pre class="text-sm text-gray-300 font-mono overflow-x-auto"><%= @tree_string %></pre>
|
|
30
|
+
<% else %>
|
|
31
|
+
<p class="text-sm text-gray-500">No tags to display.</p>
|
|
32
|
+
<% end %>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<!-- SVG Visualization -->
|
|
36
|
+
<div class="rounded-lg bg-gray-800 border border-gray-700 p-6">
|
|
37
|
+
<h2 class="text-lg font-medium text-white mb-4">Visual Hierarchy</h2>
|
|
38
|
+
<% if @tree_svg.present? %>
|
|
39
|
+
<div class="overflow-x-auto">
|
|
40
|
+
<%= raw @tree_svg %>
|
|
41
|
+
</div>
|
|
42
|
+
<% else %>
|
|
43
|
+
<p class="text-sm text-gray-500">No tags to display.</p>
|
|
44
|
+
<% end %>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<% when 'mermaid' %>
|
|
49
|
+
<!-- Mermaid Diagram -->
|
|
50
|
+
<div class="rounded-lg bg-gray-800 border border-gray-700 p-6">
|
|
51
|
+
<h2 class="text-lg font-medium text-white mb-4">Mermaid Diagram</h2>
|
|
52
|
+
<% if @tree_mermaid.present? %>
|
|
53
|
+
<div class="rounded-md bg-gray-900 p-4 overflow-x-auto">
|
|
54
|
+
<pre class="text-sm text-gray-300 font-mono"><%= @tree_mermaid %></pre>
|
|
55
|
+
</div>
|
|
56
|
+
<p class="mt-4 text-xs text-gray-500">Copy this code to render in any Mermaid-compatible viewer.</p>
|
|
57
|
+
<% else %>
|
|
58
|
+
<p class="text-sm text-gray-500">No tags to display.</p>
|
|
59
|
+
<% end %>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<% else %>
|
|
63
|
+
<!-- List View -->
|
|
64
|
+
<div class="rounded-lg bg-gray-800 border border-gray-700 p-4">
|
|
65
|
+
<%= form_with url: tags_path, method: :get, class: 'flex gap-4' do %>
|
|
66
|
+
<div class="flex-1">
|
|
67
|
+
<%= text_field_tag :prefix, params[:prefix], placeholder: 'Filter by prefix (e.g., database)', class: 'w-full rounded-md bg-gray-700 border-gray-600 text-white placeholder-gray-400 text-sm focus:ring-indigo-500 focus:border-indigo-500' %>
|
|
68
|
+
</div>
|
|
69
|
+
<%= submit_tag 'Filter', class: 'rounded-md bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500 cursor-pointer' %>
|
|
70
|
+
<% if params[:prefix].present? %>
|
|
71
|
+
<%= link_to 'Clear', tags_path, class: 'rounded-md bg-gray-700 px-4 py-2 text-sm font-medium text-white hover:bg-gray-600' %>
|
|
72
|
+
<% end %>
|
|
73
|
+
<% end %>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<% if @tags.any? %>
|
|
77
|
+
<div class="rounded-lg bg-gray-800 border border-gray-700 overflow-hidden">
|
|
78
|
+
<table class="min-w-full divide-y divide-gray-700">
|
|
79
|
+
<thead class="bg-gray-800/50">
|
|
80
|
+
<tr>
|
|
81
|
+
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Tag</th>
|
|
82
|
+
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Hierarchy</th>
|
|
83
|
+
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Memories</th>
|
|
84
|
+
<th scope="col" class="relative px-6 py-3"><span class="sr-only">Actions</span></th>
|
|
85
|
+
</tr>
|
|
86
|
+
</thead>
|
|
87
|
+
<tbody class="divide-y divide-gray-700">
|
|
88
|
+
<% @tags.each do |tag| %>
|
|
89
|
+
<tr class="hover:bg-gray-700/50 transition-colors">
|
|
90
|
+
<td class="px-6 py-4 whitespace-nowrap">
|
|
91
|
+
<%= link_to tag_path(tag), class: 'inline-flex items-center rounded-full bg-indigo-900/50 border border-indigo-500/30 px-3 py-1 text-sm text-indigo-300 hover:bg-indigo-800/50 transition-colors' do %>
|
|
92
|
+
<%= tag.name %>
|
|
93
|
+
<% end %>
|
|
94
|
+
</td>
|
|
95
|
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-400">
|
|
96
|
+
<% parts = tag.name.split(':') %>
|
|
97
|
+
<% parts.each_with_index do |part, i| %>
|
|
98
|
+
<% if i > 0 %><span class="text-gray-600 mx-1">/</span><% end %>
|
|
99
|
+
<span class="<%= i == parts.length - 1 ? 'text-white' : 'text-gray-500' %>"><%= part %></span>
|
|
100
|
+
<% end %>
|
|
101
|
+
</td>
|
|
102
|
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-400">
|
|
103
|
+
<%= tag.node_count %>
|
|
104
|
+
</td>
|
|
105
|
+
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
|
106
|
+
<%= link_to 'View', tag_path(tag), class: 'text-indigo-400 hover:text-indigo-300' %>
|
|
107
|
+
<span class="mx-2 text-gray-600">|</span>
|
|
108
|
+
<%= link_to 'Filter Memories', memories_path(tag: tag.name), class: 'text-indigo-400 hover:text-indigo-300' %>
|
|
109
|
+
</td>
|
|
110
|
+
</tr>
|
|
111
|
+
<% end %>
|
|
112
|
+
</tbody>
|
|
113
|
+
</table>
|
|
114
|
+
</div>
|
|
115
|
+
<% else %>
|
|
116
|
+
<div class="rounded-lg bg-gray-800 border border-gray-700 p-8 text-center">
|
|
117
|
+
<svg class="mx-auto h-12 w-12 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
118
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" />
|
|
119
|
+
</svg>
|
|
120
|
+
<h3 class="mt-4 text-lg font-medium text-white">No tags found</h3>
|
|
121
|
+
<p class="mt-2 text-sm text-gray-400">
|
|
122
|
+
<% if params[:prefix].present? %>
|
|
123
|
+
No tags match that prefix. <%= link_to 'Clear filter', tags_path, class: 'text-indigo-400 hover:text-indigo-300' %>.
|
|
124
|
+
<% else %>
|
|
125
|
+
Tags are automatically generated when you add memories.
|
|
126
|
+
<% end %>
|
|
127
|
+
</p>
|
|
128
|
+
</div>
|
|
129
|
+
<% end %>
|
|
130
|
+
<% end %>
|
|
131
|
+
</div>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<div class="space-y-6">
|
|
2
|
+
<!-- Back link -->
|
|
3
|
+
<div>
|
|
4
|
+
<%= link_to tags_path, class: 'inline-flex items-center gap-1 text-sm text-gray-400 hover:text-white transition-colors' do %>
|
|
5
|
+
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
6
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
|
|
7
|
+
</svg>
|
|
8
|
+
Back to Tags
|
|
9
|
+
<% end %>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<!-- Tag Header -->
|
|
13
|
+
<div class="rounded-lg bg-gray-800 border border-gray-700 p-6">
|
|
14
|
+
<div class="flex items-start justify-between">
|
|
15
|
+
<div>
|
|
16
|
+
<div class="flex items-center gap-3">
|
|
17
|
+
<div class="rounded-full bg-indigo-900/50 border border-indigo-500/30 p-2">
|
|
18
|
+
<svg class="h-5 w-5 text-indigo-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
19
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" />
|
|
20
|
+
</svg>
|
|
21
|
+
</div>
|
|
22
|
+
<h1 class="text-2xl font-bold text-white"><%= @tag.name %></h1>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<!-- Hierarchy breadcrumb -->
|
|
26
|
+
<div class="mt-3 flex items-center gap-1 text-sm">
|
|
27
|
+
<% parts = @tag.name.split(':') %>
|
|
28
|
+
<% parts.each_with_index do |part, i| %>
|
|
29
|
+
<% if i > 0 %>
|
|
30
|
+
<svg class="h-4 w-4 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
31
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
|
32
|
+
</svg>
|
|
33
|
+
<% end %>
|
|
34
|
+
<% prefix = parts[0..i].join(':') %>
|
|
35
|
+
<% matching_tag = HTM::Models::Tag.find_by(name: prefix) %>
|
|
36
|
+
<% if matching_tag %>
|
|
37
|
+
<%= link_to part, tag_path(matching_tag), class: "#{i == parts.length - 1 ? 'text-indigo-400' : 'text-gray-400 hover:text-white'}" %>
|
|
38
|
+
<% else %>
|
|
39
|
+
<span class="text-gray-500"><%= part %></span>
|
|
40
|
+
<% end %>
|
|
41
|
+
<% end %>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div class="text-right">
|
|
46
|
+
<p class="text-2xl font-bold text-white"><%= @memories.count %></p>
|
|
47
|
+
<p class="text-sm text-gray-400">memories</p>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<!-- Memories with this tag -->
|
|
53
|
+
<div>
|
|
54
|
+
<h2 class="text-lg font-medium text-white mb-4">Memories with this tag</h2>
|
|
55
|
+
<% if @memories.any? %>
|
|
56
|
+
<div class="space-y-4">
|
|
57
|
+
<% @memories.each do |memory| %>
|
|
58
|
+
<%= render 'memories/memory_card', memory: memory %>
|
|
59
|
+
<% end %>
|
|
60
|
+
</div>
|
|
61
|
+
<% else %>
|
|
62
|
+
<div class="rounded-lg bg-gray-800 border border-gray-700 p-8 text-center">
|
|
63
|
+
<p class="text-sm text-gray-500">No memories with this tag.</p>
|
|
64
|
+
</div>
|
|
65
|
+
<% end %>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'boot'
|
|
4
|
+
|
|
5
|
+
require 'rails'
|
|
6
|
+
require 'active_model/railtie'
|
|
7
|
+
require 'active_job/railtie'
|
|
8
|
+
require 'active_record/railtie'
|
|
9
|
+
require 'action_controller/railtie'
|
|
10
|
+
require 'action_view/railtie'
|
|
11
|
+
|
|
12
|
+
# Require HTM - this will auto-load the Railtie
|
|
13
|
+
require 'htm'
|
|
14
|
+
|
|
15
|
+
module HtmRailsExample
|
|
16
|
+
class Application < Rails::Application
|
|
17
|
+
config.load_defaults 7.1
|
|
18
|
+
|
|
19
|
+
# Full-stack Rails app (not API-only)
|
|
20
|
+
config.api_only = false
|
|
21
|
+
|
|
22
|
+
# Use inline jobs for simplicity in demo
|
|
23
|
+
config.active_job.queue_adapter = :inline
|
|
24
|
+
|
|
25
|
+
# Generators config
|
|
26
|
+
config.generators do |g|
|
|
27
|
+
g.test_framework nil
|
|
28
|
+
g.stylesheets false
|
|
29
|
+
g.javascripts false
|
|
30
|
+
g.helper false
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Rails app database (not used - HTM uses its own database)
|
|
2
|
+
# This is required for Rails to boot but can be sqlite/memory
|
|
3
|
+
|
|
4
|
+
default: &default
|
|
5
|
+
adapter: postgresql
|
|
6
|
+
encoding: unicode
|
|
7
|
+
pool: 5
|
|
8
|
+
|
|
9
|
+
development:
|
|
10
|
+
<<: *default
|
|
11
|
+
database: htm_rails_example_dev
|
|
12
|
+
|
|
13
|
+
test:
|
|
14
|
+
<<: *default
|
|
15
|
+
database: htm_rails_example_test
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
pin "application"
|
|
4
|
+
pin "@hotwired/turbo-rails", to: "turbo.min.js"
|
|
5
|
+
pin "@hotwired/stimulus", to: "stimulus.min.js"
|
|
6
|
+
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
|
|
7
|
+
pin_all_from "app/javascript/controllers", under: "controllers"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Rails.application.routes.draw do
|
|
4
|
+
root 'dashboard#index'
|
|
5
|
+
|
|
6
|
+
resources :memories do
|
|
7
|
+
collection do
|
|
8
|
+
get :deleted
|
|
9
|
+
end
|
|
10
|
+
member do
|
|
11
|
+
post :restore
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
resources :tags, only: [:index, :show]
|
|
16
|
+
|
|
17
|
+
resources :robots, only: [:index, :show, :new, :create] do
|
|
18
|
+
member do
|
|
19
|
+
post :switch
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
resource :search, only: [:index], controller: 'search' do
|
|
24
|
+
get '/', action: :index
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
resources :files, only: [:index, :show, :new, :create, :destroy] do
|
|
28
|
+
collection do
|
|
29
|
+
post :load_directory
|
|
30
|
+
post :upload
|
|
31
|
+
post :upload_directory
|
|
32
|
+
post :sync_all
|
|
33
|
+
end
|
|
34
|
+
member do
|
|
35
|
+
post :sync
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const defaultTheme = require('tailwindcss/defaultTheme')
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
darkMode: 'class',
|
|
5
|
+
content: [
|
|
6
|
+
'./app/views/**/*.html.erb',
|
|
7
|
+
'./app/helpers/**/*.rb',
|
|
8
|
+
'./app/javascript/**/*.js',
|
|
9
|
+
'./app/assets/stylesheets/**/*.css',
|
|
10
|
+
],
|
|
11
|
+
theme: {
|
|
12
|
+
extend: {
|
|
13
|
+
fontFamily: {
|
|
14
|
+
sans: ['Inter', ...defaultTheme.fontFamily.sans],
|
|
15
|
+
mono: ['JetBrains Mono', ...defaultTheme.fontFamily.mono],
|
|
16
|
+
},
|
|
17
|
+
colors: {
|
|
18
|
+
htm: {
|
|
19
|
+
50: '#f0f9ff',
|
|
20
|
+
100: '#e0f2fe',
|
|
21
|
+
200: '#bae6fd',
|
|
22
|
+
300: '#7dd3fc',
|
|
23
|
+
400: '#38bdf8',
|
|
24
|
+
500: '#0ea5e9',
|
|
25
|
+
600: '#0284c7',
|
|
26
|
+
700: '#0369a1',
|
|
27
|
+
800: '#075985',
|
|
28
|
+
900: '#0c4a6e',
|
|
29
|
+
950: '#082f49',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
plugins: [],
|
|
35
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8ec864777deb2e477c24acfa26c5a4721c6d36f04e80b9ecb00d22002a591a12d213fd8e4d2107471e65de7f546f2a1e27317d1ea2c0130dc19e39f36af610a9
|
|
@@ -37,14 +37,11 @@ class HTM
|
|
|
37
37
|
erb_content = ERB.new(File.read(config_path)).result
|
|
38
38
|
db_config = YAML.safe_load(erb_content, aliases: true)
|
|
39
39
|
|
|
40
|
-
# Determine environment
|
|
41
|
-
env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
|
42
|
-
|
|
43
40
|
# Get configuration for current environment
|
|
44
|
-
config = db_config[env]
|
|
41
|
+
config = db_config[HTM.env]
|
|
45
42
|
|
|
46
43
|
unless config
|
|
47
|
-
raise "No database configuration found for environment: #{env}"
|
|
44
|
+
raise "No database configuration found for environment: #{HTM.env}"
|
|
48
45
|
end
|
|
49
46
|
|
|
50
47
|
# Convert string keys to symbols for ActiveRecord
|
data/lib/htm/configuration.rb
CHANGED
|
@@ -329,8 +329,7 @@ class HTM
|
|
|
329
329
|
end
|
|
330
330
|
|
|
331
331
|
# Detect test environment - use inline for synchronous execution
|
|
332
|
-
|
|
333
|
-
return :inline if test_env
|
|
332
|
+
return :inline if HTM.test?
|
|
334
333
|
|
|
335
334
|
# Detect Rails - prefer ActiveJob
|
|
336
335
|
if defined?(ActiveJob)
|
|
@@ -682,6 +681,40 @@ class HTM
|
|
|
682
681
|
class << self
|
|
683
682
|
attr_writer :configuration
|
|
684
683
|
|
|
684
|
+
# Get current environment
|
|
685
|
+
#
|
|
686
|
+
# Priority: HTM_ENV > RAILS_ENV > RACK_ENV > 'development'
|
|
687
|
+
#
|
|
688
|
+
# @return [String] Current environment name
|
|
689
|
+
#
|
|
690
|
+
def env
|
|
691
|
+
ENV['HTM_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
|
692
|
+
end
|
|
693
|
+
|
|
694
|
+
# Check if running in test environment
|
|
695
|
+
#
|
|
696
|
+
# @return [Boolean]
|
|
697
|
+
#
|
|
698
|
+
def test?
|
|
699
|
+
env == 'test'
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
# Check if running in development environment
|
|
703
|
+
#
|
|
704
|
+
# @return [Boolean]
|
|
705
|
+
#
|
|
706
|
+
def development?
|
|
707
|
+
env == 'development'
|
|
708
|
+
end
|
|
709
|
+
|
|
710
|
+
# Check if running in production environment
|
|
711
|
+
#
|
|
712
|
+
# @return [Boolean]
|
|
713
|
+
#
|
|
714
|
+
def production?
|
|
715
|
+
env == 'production'
|
|
716
|
+
end
|
|
717
|
+
|
|
685
718
|
# Get current configuration
|
|
686
719
|
#
|
|
687
720
|
# @return [HTM::Configuration]
|
data/lib/htm/database.rb
CHANGED
|
@@ -114,8 +114,7 @@ class HTM
|
|
|
114
114
|
config = db_url ? parse_connection_url(db_url) : default_config
|
|
115
115
|
raise "Database configuration not found" unless config
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
puts "Environment: #{env}"
|
|
117
|
+
puts "Environment: #{HTM.env}"
|
|
119
118
|
puts "Database: #{config[:dbname]}"
|
|
120
119
|
|
|
121
120
|
conn = PG.connect(config)
|
|
@@ -369,16 +368,14 @@ class HTM
|
|
|
369
368
|
config = db_url ? parse_connection_url(db_url) : default_config
|
|
370
369
|
raise "Database configuration not found" unless config
|
|
371
370
|
|
|
372
|
-
env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
|
373
|
-
|
|
374
371
|
conn = PG.connect(config)
|
|
375
372
|
|
|
376
|
-
puts "\nHTM Database Information (#{env})"
|
|
373
|
+
puts "\nHTM Database Information (#{HTM.env})"
|
|
377
374
|
puts "=" * 80
|
|
378
375
|
|
|
379
376
|
# Connection info
|
|
380
377
|
puts "\nConnection:"
|
|
381
|
-
puts " Environment: #{env}"
|
|
378
|
+
puts " Environment: #{HTM.env}"
|
|
382
379
|
puts " Host: #{config[:host]}"
|
|
383
380
|
puts " Port: #{config[:port]}"
|
|
384
381
|
puts " Database: #{config[:dbname]}"
|