adding rugged, starting changes controller

This commit is contained in:
Torsten 2022-12-03 19:26:53 +02:00
parent ecaf0eb587
commit d7f55540b3
9 changed files with 43 additions and 19 deletions

View File

@ -2,6 +2,7 @@ PATH
remote: . remote: .
specs: specs:
merged (0.1.0) merged (0.1.0)
git
haml-rails haml-rails
rails (>= 7.0.4) rails (>= 7.0.4)
@ -73,11 +74,16 @@ GEM
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
tzinfo (~> 2.0) tzinfo (~> 2.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
builder (3.2.4) builder (3.2.4)
concurrent-ruby (1.1.10) concurrent-ruby (1.1.10)
crass (1.0.6) crass (1.0.6)
diff-lcs (1.5.0) diff-lcs (1.5.0)
erubi (1.11.0) erubi (1.11.0)
git (1.12.0)
addressable (~> 2.8)
rchardet (~> 1.8)
globalid (1.0.0) globalid (1.0.0)
activesupport (>= 5.0) activesupport (>= 5.0)
haml (6.0.12) haml (6.0.12)
@ -111,6 +117,7 @@ GEM
nio4r (2.5.8) nio4r (2.5.8)
nokogiri (1.13.9-x86_64-linux) nokogiri (1.13.9-x86_64-linux)
racc (~> 1.4) racc (~> 1.4)
public_suffix (5.0.0)
racc (1.6.0) racc (1.6.0)
rack (2.2.4) rack (2.2.4)
rack-test (2.0.2) rack-test (2.0.2)
@ -142,6 +149,7 @@ GEM
thor (~> 1.0) thor (~> 1.0)
zeitwerk (~> 2.5) zeitwerk (~> 2.5)
rake (13.0.6) rake (13.0.6)
rchardet (1.8.0)
rspec-core (3.12.0) rspec-core (3.12.0)
rspec-support (~> 3.12.0) rspec-support (~> 3.12.0)
rspec-expectations (3.12.0) rspec-expectations (3.12.0)

View File

@ -0,0 +1,11 @@
require "rugged"
module Merged
class ChangesController < MergedController
def index
@git = Rugged::Repository.new(Rails.root)
end
end
end

View File

@ -0,0 +1,4 @@
module Merged
module ChangesHelper
end
end

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Merged</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag "merged/application", media: "all" %>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@ -2,7 +2,7 @@
%html %html
%head %head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/ %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title Gateway %title Merged CMS
%meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/ %meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/
= csrf_meta_tags = csrf_meta_tags
= csp_meta_tag = csp_meta_tag
@ -32,7 +32,7 @@
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => styles_index_path} %a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => styles_index_path}
Styles Styles
%li %li
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => "/changes"} %a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => changes_index_path}
Changes Changes
.flex.items-center.gap-4 .flex.items-center.gap-4
.sm:flex.sm:gap-4 .sm:flex.sm:gap-4

View File

@ -0,0 +1,13 @@
%p= @git.workdir
%p Lines Changed
-@git.diff_workdir("HEAD").each_line do |line|
%p= line.content
%h3 Patches
%h3 Patches
%h3 Patches
-@git.diff_workdir("HEAD").each_patch do |patch|
%p= patch.additions
-patch.each_hunk do |hunk|
%p=hunk.header
-hunk.each_line do |line|
%p= line.content

View File

@ -49,7 +49,7 @@
%h3.mt-4.text-lg.font-bold #{@section.cards.length} Cards %h3.mt-4.text-lg.font-bold #{@section.cards.length} Cards
-@section.cards.each do |card| -@section.cards.each do |card|
.mt-4.text-md.font-bold= card.header .mt-4.text-md.font-bold= card.header
.text-sm "#{card.text[0..70]} ....." .text-sm #{card.text[0..70]} .....
%p.p-3 %p.p-3
= yellow_button( "View and Edit Cards" , section_cards_url(@section.id)) = yellow_button( "View and Edit Cards" , section_cards_url(@section.id))
= green_button( "New Card" , new_section_card_url(@section.id) ) = green_button( "New Card" , new_section_card_url(@section.id) )

View File

@ -1,6 +1,8 @@
Merged::Engine.routes.draw do Merged::Engine.routes.draw do
get "/styles/index" , to: "styles#index" get 'changes/index'
get "styles/index"
resources :pages , except: [:show] , shallow: true do resources :pages , except: [:show] , shallow: true do
resources :sections do resources :sections do
get :select_image get :select_image

View File

@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
spec.add_dependency "rails", ">= 7.0.4" spec.add_dependency "rails", ">= 7.0.4"
spec.add_dependency "haml-rails" spec.add_dependency "haml-rails"
spec.add_dependency "rugged"
end end