gitty 0.2.1 → 0.3.0

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.
@@ -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
@@ -14,6 +14,7 @@ require "ext.rb"
14
14
 
15
15
  module Gitty
16
16
  autoload :Helpers, (GITTY_PATH + "helpers.rb").to_s
17
+
17
18
  def self.asset_paths
18
19
  [ENV["GITTY_ASSETS"], ENV["HOME"] + "/.gitty", ASSETS_PATH].compact.map {|p| Pathname.new(p)}
19
20
  end
@@ -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
@@ -47,7 +47,7 @@ class Gitty::Hook
47
47
  candidates
48
48
  end
49
49
 
50
- def self.find(name, options)
50
+ def self.find(name, options = {})
51
51
  find_all(options.merge(:name => name)).first
52
52
  end
53
53
 
@@ -2,6 +2,7 @@ class Gitty::HookCommand < Gitty::Runner
2
2
  COMMANDS = %w[
3
3
  init
4
4
  list
5
+ show
5
6
  install
6
7
  uninstall
7
8
  publish
@@ -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
- ENV.stub!(:[]).with("GITTY_ASSETS").and_return("/tmp/assets")
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.2.1
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