gitty 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +4 -0
- data/lib/gitty.rb +1 -0
- data/lib/gitty/commands/show.rb +24 -0
- data/lib/gitty/hook.rb +1 -1
- data/lib/gitty/hook_command.rb +1 -0
- data/spec/gitty_spec.rb +2 -8
- metadata +2 -1
data/README.textile
CHANGED
@@ -14,6 +14,10 @@ Missing features:
|
|
14
14
|
* Only receive hooks from trusted publishers. (currently when gitty is activated on a repository, any hook published to origin is automatically installed)
|
15
15
|
* It's very young and might break
|
16
16
|
|
17
|
+
h2. Documentation
|
18
|
+
|
19
|
+
Read the cucumber features for an idea of how it works and what it does
|
20
|
+
|
17
21
|
h2. Issues
|
18
22
|
|
19
23
|
Report them here: http://github.com/timcharper/gitty/issues
|
data/lib/gitty.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
class Gitty::HookCommand::Show < Gitty::Runner
|
2
|
+
def initialize(args, stdout = STDOUT, stderr = STDERR)
|
3
|
+
super
|
4
|
+
@hookname = args.shift
|
5
|
+
end
|
6
|
+
|
7
|
+
def run
|
8
|
+
hook = Gitty::Hook.find(@hookname)
|
9
|
+
unless hook
|
10
|
+
stderr.puts "Hook '#{@hookname}' not found"
|
11
|
+
exit 1
|
12
|
+
end
|
13
|
+
stdout << "Hook '#{hook.name}' is " + (hook.installed? ? 'installed' : 'not installed' ) + "\n\n"
|
14
|
+
stdout << "DESCRIPTION:\n" + (hook.meta_data['description'] || "no description") + "\n\n"
|
15
|
+
stdout.puts "version: #{hook.meta_data['version']}" if hook.meta_data['version']
|
16
|
+
stdout.puts "targets: #{hook.meta_data['targets'].join(', ')}" if hook.meta_data['targets']
|
17
|
+
end
|
18
|
+
|
19
|
+
def option_parser
|
20
|
+
@option_parser ||= super.tap do |opts|
|
21
|
+
opts.banner = "Usage: git hook show hook-name"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/gitty/hook.rb
CHANGED
data/lib/gitty/hook_command.rb
CHANGED
data/spec/gitty_spec.rb
CHANGED
@@ -3,22 +3,16 @@ require 'spec_helper'
|
|
3
3
|
describe Gitty do
|
4
4
|
describe ".asset_file" do
|
5
5
|
it "searches first in the specified $GITTY_ASSETS environment variable" do
|
6
|
-
|
6
|
+
# this is bad form, but I can't think of a better way to test this. Likely a symptom of bad design.
|
7
|
+
Gitty.stub!(:asset_paths).and_return ["/tmp/assets", ASSETS_PATH]
|
7
8
|
File.stub!(:exist?).with("/tmp/assets/helpers/helpful").and_return(true)
|
8
9
|
File.stub!(:exist?).with(ASSETS_PATH + "helpers/helpful").and_return(true)
|
9
10
|
|
10
11
|
Gitty.find_asset("helpers/helpful").should == "/tmp/assets/helpers/helpful"
|
11
12
|
end
|
12
13
|
|
13
|
-
it "searches the core ASSETS_PATH if GITTY_ASSETS is not defined" do
|
14
|
-
ENV.stub!(:[]).with("GITTY_ASSETS").and_return(nil)
|
15
|
-
File.stub!(:exist?).with((ASSETS_PATH + "helpers/helpful").to_s).and_return(true)
|
16
|
-
Gitty.find_asset("helpers/helpful").should == (ASSETS_PATH + "helpers/helpful").to_s
|
17
|
-
end
|
18
|
-
|
19
14
|
it "returns nil if none the file is not found" do
|
20
15
|
Gitty.find_asset("willy/wonka").should be_nil
|
21
16
|
end
|
22
17
|
end
|
23
|
-
|
24
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Harper
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- lib/gitty/commands/list.rb
|
46
46
|
- lib/gitty/commands/publish.rb
|
47
47
|
- lib/gitty/commands/shell.rb
|
48
|
+
- lib/gitty/commands/show.rb
|
48
49
|
- lib/gitty/commands/uninstall.rb
|
49
50
|
- lib/gitty/helpers.rb
|
50
51
|
- lib/gitty/hook.rb
|