This repository has been archived by the owner on Oct 27, 2019. It is now read-only.
forked from timcharper/git-tmbundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a "Git Config" command - currently supports Email and Name
- Loading branch information
1 parent
88ed4ae
commit d28efbe
Showing
6 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>beforeRunningCommand</key> | ||
<string>nop</string> | ||
<key>command</key> | ||
<string>#!/usr/bin/env ruby | ||
require ENV['TM_BUNDLE_SUPPORT'] + '/environment.rb' | ||
dispatch :controller => "config", :action => "index"</string> | ||
<key>input</key> | ||
<string>none</string> | ||
<key>name</key> | ||
<string>Config…</string> | ||
<key>output</key> | ||
<string>showAsHTML</string> | ||
<key>uuid</key> | ||
<string>794C7EF9-B0A5-4B27-90BD-000837237B85</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class ConfigController < ApplicationController | ||
include ConfigHelper | ||
def index | ||
render "index" | ||
end | ||
|
||
def set | ||
value = params[:value] | ||
git.config[(params[:scope] || "local"), params[:key]] = params[:value] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module ConfigHelper | ||
def config_line | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<h1>Config</h1> | ||
<form> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Global Config</th> | ||
<!-- <th>Local Config Config</th>--> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td> | ||
Name: <%= content_tag :input, :type => "text", :value => git.config[:global, "user.name"], :onchange => "dispatch({controller: 'config', action: 'set', scope: 'global', key: 'user.name', value: $F(this)})" %><br/> | ||
Email: <%= content_tag :input, :type => "text", :value => git.config[:global, "user.email"], :onchange => "dispatch({controller: 'config', action: 'set', scope: 'global', key: 'user.email', value: $F(this)})" %><br/> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require File.dirname(__FILE__) + '/../spec_helper' | ||
|
||
describe ConfigController do | ||
include SpecHelpers | ||
include Parsers | ||
|
||
before(:each) do | ||
@controller = ConfigController.singleton_new | ||
@git = Git.singleton_new | ||
end | ||
|
||
describe "when setting values" do | ||
it "should default to local" do | ||
@git.config.should_receive(:[]=).with("local", "user.name", "My Name") | ||
capture_output { dispatch(:controller => "config", :action => "set", :key => "user.name", :value => "My Name" )} | ||
end | ||
|
||
it "should allow setting of global variables" do | ||
@git.config.should_receive(:[]=).with("global", "user.name", "My Name") | ||
capture_output { dispatch(:controller => "config", :action => "set", :scope => "global", :key => "user.name", :value => "My Name" )} | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters