web_git 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,39 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>GitClient</title>
5
- <%= csrf_meta_tags %>
6
-
7
- <%= stylesheet_link_tag 'web_git/application', media: 'all', 'data-turbolinks-track': 'reload' %>
8
-
9
- <%= javascript_include_tag 'web_git/application', 'data-turbolinks-track': 'reload' %>
10
- </head>
11
-
12
- <body>
13
- <div class="container">
14
- <% if notice.present? %>
15
- <div class="row">
16
- <div class="col">
17
- <div class="alert alert-dismissable alert-success">
18
- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
19
- <%= notice %>
20
- </div>
21
- </div>
22
- </div>
23
- <% end %>
24
-
25
- <% if alert.present? %>
26
- <div class="row">
27
- <div class="col">
28
- <div class="alert alert-dismissable alert-warning">
29
- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
30
- <%= alert %>
31
- </div>
32
- </div>
33
- </div>
34
- <% end %>
35
-
36
- <%= yield %>
37
- </div>
38
- </body>
39
- </html>
@@ -1,244 +0,0 @@
1
- <div class="row mb-4">
2
- <div class="col">
3
- <div class="card">
4
- <h1 class="card-header">
5
- <% if @diff_html.present? %>
6
- On branch <code><%= @current_branch %></code>
7
- <% else %>
8
- <code>git status</code>
9
- <% end %>
10
- </h1>
11
-
12
- <div class="card-body">
13
- <%# if false %>
14
- <% unless @status.include?("nothing to commit, working tree clean") %>
15
- <p class="h4 mb-3 text-center">
16
- You have changes
17
- </p>
18
-
19
- <% if @status.include?("Untracked files") %>
20
- <pre>
21
- <%= simple_format @status.
22
- gsub("(use \"git add <file>...\" to include in what will be committed)\n\n", "").
23
- gsub("(use \"git add\" to track)\n", "")%>
24
- </pre>
25
- <% end %>
26
-
27
- <% if @diff_html.present? %>
28
- <%= @diff_html.html_safe %>
29
- <% end %>
30
-
31
- <p class="h4 mb-3 text-center">
32
- What do you want to do?
33
- </p>
34
-
35
- <div class="row">
36
- <div class="col">
37
- <div class="card">
38
- <div class="card-header h6">
39
- Commit your changes to the current branch
40
- </div>
41
-
42
- <div class="card-body">
43
-
44
- <%= form_tag commits_url do %>
45
- <div class="form-group">
46
- <%= label_tag :title %>
47
- <%= text_field_tag :title, nil, placeholder: "Enter a title for your commit (required)...", class: "form-control", required: true, autofocus: true, input_html: {autocomplete: 'off'} %>
48
- </div>
49
- <div class="form-group">
50
- <%= label_tag :description %>
51
- <%= text_area_tag :description, nil, placeholder: "Enter a longer description of your changes (optional)...", class: "form-control" %>
52
- </div>
53
-
54
- <%= button_tag class: "btn btn-primary btn-block", data: { toggle: "tooltip", html: true }, title: "<code>git add -A; git commit</code>" do %>
55
- <%= octicon "git-commit", class: "mr-1" %>
56
-
57
- Commit to <%= @current_branch %>
58
- <% end %>
59
- <% end %>
60
- </div>
61
- </div>
62
- </div>
63
-
64
- <div class="col">
65
- <div class="row mb-2">
66
- <div class="col">
67
- <div class="card">
68
- <div class="card-header h6">
69
- Switch to a new branch
70
- </div>
71
-
72
- <div class="card-body">
73
- <%= form_tag branch_url, class: "full-width mb-2" do %>
74
- <div class="form-group">
75
- <%= label_tag :name, nil, class: "sr-only" %>
76
- <%= text_field_tag :name, nil, placeholder: "Enter a name for the branch to create...", class: "form-control" %>
77
- </div>
78
- <%= button_tag class: "btn btn-success btn-block", data: { toggle: "tooltip", html: true }, title: "<code>git checkout -b [NEW BRANCH NAME]</code>" do %>
79
-
80
- <%= octicon "git-branch", class: "mr-1" %>
81
-
82
- Create a new branch
83
- <% end %>
84
- <% end %>
85
- </div>
86
- </div>
87
- </div>
88
- </div>
89
-
90
- <div class="row">
91
- <div class="col">
92
- <div class="card">
93
- <div class="card-header h6">
94
- Discard your changes
95
- </div>
96
-
97
- <div class="card-body">
98
- <%= button_to commits_stash_url, class: "btn btn-danger btn-block", method: :post, data: { confirm: "Are you sure you want to discard these changes?", toggle: "tooltip", html: true }, title: "<code>git add -A; git stash</code>" do %>
99
- <%= octicon "trashcan", class: "mr-1" %>
100
-
101
- Discard all changes
102
- <% end %>
103
- </div>
104
- </div>
105
- </div>
106
- </div>
107
- </div>
108
- </div>
109
-
110
- <% else %>
111
-
112
- <div class="row">
113
- <div class="col">
114
- <pre>
115
- <%= simple_format @status %>
116
- </pre>
117
-
118
- <%= button_to commits_push_url, disabled: true, class: "btn btn-primary btn-block mb-4", data: { toggle: "tooltip", html: true }, title: "<code>git push</code>" do %>
119
- <%= octicon "repo-push", class: "mr-1" %>
120
-
121
- Push to GitHub
122
- <% end %>
123
-
124
- <% if @current_branch != "master" && @origin_url.present? %>
125
- <%= link_to "https://github.com/#{@user}/#{@repo}/compare/master...#{@user}:#{@current_branch}?expand=1", class: "btn btn-primary btn-block mb-4", target: "_blank" do %>
126
- <%= octicon "git-pull-request", class: "mr-1" %>
127
-
128
- Open a pull request into master
129
- <% end %>
130
- <% end %>
131
-
132
- <%= button_to commits_pull_url, disabled: true, class: "btn btn-primary btn-block mb-4", data: { toggle: "tooltip", html: true }, title: "<code>git pull</code>" do %>
133
- <%= octicon "repo-pull", class: "mr-1" %>
134
-
135
- Pull from GitHub
136
- <% end %>
137
-
138
- <p>
139
- The last thing you did was:
140
- </p>
141
-
142
- <blockquote class="blockquote">
143
- <%= @last_commit_message %>
144
- </blockquote>
145
-
146
- <%= link_to "#latest_diff_html", class: "btn btn-secondary btn-block mb-4", data: { toggle: "collapse" }, title: "git show" do %>
147
- <%= octicon "eye", class: "mr-1" %>
148
-
149
- Show last commit
150
- <% end %>
151
-
152
- <div id="latest_diff_html" class="collapse">
153
- <iframe srcdoc="<%= @last_diff_html %>" width="100%" height="400" class="mb-3">
154
- </iframe>
155
- </div>
156
- </div>
157
-
158
- <div class="col">
159
- <ul class="list-group">
160
- <li class="list-group-item list-group-item-success">
161
- New Branch
162
- </li>
163
-
164
- <li class="list-group-item">
165
- <%= form_tag branch_url, class: "full-width mb-2" do %>
166
- <div class="form-group">
167
- <%= label_tag :name, "Go ahead, experiment!" %>
168
- <%= text_field_tag :name, nil, placeholder: "Enter a name for the new branch...", class: "form-control" %>
169
- </div>
170
- <%= button_tag class: "btn btn-success btn-block", data: { toggle: "tooltip", html: true }, title: "<code>git checkout -b [BRANCH NAME]</code>" do %>
171
- <%= octicon "git-branch", class: "mr-1" %>
172
-
173
- Create branch
174
- <% end %>
175
- <% end %>
176
- </li>
177
-
178
- <li class="list-group-item list-group-item-info">
179
- Existing branches
180
- </li>
181
-
182
- <% @branches.each do |branch| %>
183
- <li class="list-group-item justify-content-between">
184
- <%= branch %>
185
-
186
- <div class="btn-group">
187
- <%= link_to octicon("git-compare"), branch_url(name: branch), class: "btn btn-primary btn-sm", title: "Switch to branch<br><code>git checkout #{branch}</code>", data: { toggle: "tooltip", html: true } %>
188
-
189
- <%= link_to octicon("trashcan"), branch_url(name: branch), method: :delete, class: "btn btn-warning btn-sm", data: { toggle: "tooltip", confirm: "Are you sure you want to delete #{branch}?" }, title: "Delete branch #{branch}" %>
190
- </div>
191
- </li>
192
- <% end %>
193
- </ul>
194
- </div>
195
- </div>
196
- <% end %>
197
- </div>
198
- </div>
199
- </div>
200
- </div>
201
-
202
- <div class="row mb-4">
203
- <div class="col">
204
- <div class="card">
205
- <h2 class="card-header">
206
- History
207
- </h2>
208
-
209
- <div class="card-body">
210
- <p class="lead">Do you want to jump back in time and go down a different path?</p>
211
- <%= form_tag branch_url do %>
212
- <div class="form-group">
213
- <%= label_tag :commit_hash, "Branch off of" %>
214
- <%= text_field_tag :commit_hash, nil, placeholder: "Enter the sequence of digits preceding the commit (it's \"hash\") that you want to branch off of...", class: "form-control" %>
215
- </div>
216
-
217
- <div class="form-group">
218
- <%= label_tag :name, "Branch name" %>
219
- <%= text_field_tag :name, nil, placeholder: "Enter a name for the new branch...", class: "form-control" %>
220
- </div>
221
-
222
- <% if @diff_html.present? %>
223
- <%= button_tag "Can't go back in time while you have pending changes. Commit or discard them first.", class: "btn btn-primary btn-block", disabled: true %>
224
- <% else %>
225
- <%= button_tag class: "btn btn-success btn-block", data: { toggle: "tooltip", html: true }, title: "<code>git checkout [OLD HASH]; git checkout -b [NEW BRANCH NAME]</code>" do %>
226
- <%= octicon "git-branch", class: "mr-1" %>
227
-
228
- Create a new branch off of previous commit
229
- <% end %>
230
- <% end %>
231
- <% end %>
232
-
233
- <pre>
234
- <%= simple_format @log %>
235
- </pre>
236
-
237
- <% if @log_html.present? %>
238
- <iframe srcdoc="<%= @log_html %>" width="100%" height="800" class="mb-3">
239
- </iframe>
240
- <% end %>
241
- </div>
242
- </div>
243
- </div>
244
- </div>
data/config/routes.rb DELETED
@@ -1,10 +0,0 @@
1
- WebGit::Engine.routes.draw do
2
- root to: 'commands#status'
3
- get "status" => "commands#status"
4
- resource :branch, only: [:create, :show, :destroy]
5
- resources :commits, only: :create
6
- post "commits/stash"
7
- get "commits/push"
8
- get "commits/pull"
9
- get "commits/add"
10
- end
@@ -1,9 +0,0 @@
1
- module WebGit
2
- class Engine < ::Rails::Engine
3
- isolate_namespace WebGit
4
-
5
- initializer 'web_git.routes' do |app|
6
- app.routes.append { mount WebGit::Engine, at: "/git" }
7
- end
8
- end
9
- end