atlassian-stash 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6f81d9c053732742249900feca5fddb74f3a461
4
- data.tar.gz: 27493f645b3d5bf6e773b6764fb0c9770c9c8339
3
+ metadata.gz: f108029674203b07feb43c788c21b500f2a681d6
4
+ data.tar.gz: 969ff0cb30cf6bb55fa6f137714aaf7b7ea8db50
5
5
  SHA512:
6
- metadata.gz: 295a94d7eccbf34b67c98fb480c5d2a6c865728e7318b8f369d05baee1084614c4fe7d3e15cdf418370d95d1834bfe23928852bd4bb1459ee4117cbb7327a61e
7
- data.tar.gz: 66bb5e44dd120ddaee257622a3f319aea8c75886ac306bd0ba60ae881ae007ed5bbba531c72390a2e4d9d06d0f1da7f944175d2b68069ebca4e120a5f2fc42ac
6
+ metadata.gz: 283e3979a42e790293548dc7a5e5f0164c16e185dd7361b2853e7dd1a5b6b2e2114484f0817ebb39db3a930f90c771553e73c71d4735b5674eaa336c831e3cd8
7
+ data.tar.gz: db3063ea5662fbd4d1a9ad9ae065130d9e65aff823bf66e58a4b6087d9f7239cceee67a7268f4a290cf8915dcf163337a6b1bf7681247f604d6c705d3a776e6c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
data/bin/stash CHANGED
@@ -14,21 +14,26 @@ program :description, "Provides convenient functions for interacting with Atlass
14
14
  include Atlassian::Stash
15
15
  include Atlassian::Stash::Git
16
16
 
17
- $configFile = File.join(ENV['HOME'], ".stashconfig.yml")
17
+ $configFileName = ".stashconfig.yml"
18
+ $configFile = File.join(ENV['HOME'], $configFileName)
18
19
 
19
20
  def load_config
20
21
  raise "No Stash configuration found; please run configure" unless File.exists? $configFile
21
22
  config = YAML.load_file($configFile)
22
23
  raise "Stash configuration file is incomplete, please re-run configure" unless config['username'] and config['stash_url']
23
- config.merge! repo_config
24
+ config.merge! repo_config if repo_config
24
25
  config
25
26
  end
26
27
 
27
28
  def repo_config
28
29
  return @repo_config if @repo_config
29
- ascender = Pathname.pwd.to_enum(:ascend)
30
- config_path = ascender.detect { |path| (path + '.stash').exist? }
31
- @repo_config = YAML.load_file(path + '.stash')
30
+
31
+ repo_root = get_repo_root_directory.strip
32
+ repo_directory = Pathname.new(repo_root)
33
+ stash_config = repo_directory + $configFileName
34
+ if (stash_config.exist? && stash_config.file?)
35
+ @repo_config = YAML.load_file(stash_config)
36
+ end
32
37
  @repo_config
33
38
  end
34
39
 
@@ -66,7 +71,7 @@ end
66
71
 
67
72
  command 'pull-request' do |c|
68
73
  def extract_reviewers(args = [])
69
- default_reviewers = Array(repo_config[:reviewers])
74
+ default_reviewers = repo_config.nil? ? [] : Array(repo_config[:reviewers])
70
75
  default_reviewers.concat args.collect { |user|
71
76
  user[1..-1] if user.start_with?("@")
72
77
  }.compact
@@ -90,7 +95,7 @@ command 'pull-request' do |c|
90
95
  source = args.shift
91
96
  if args.empty? or args.first.start_with?("@")
92
97
  target = source
93
- source = get_current_branch()
98
+ source = get_current_branch
94
99
  reviewers = extract_reviewers args
95
100
  else
96
101
  target = args.shift
@@ -31,6 +31,10 @@ module Atlassian
31
31
  def create_git_alias
32
32
  %x(git config --global alias.create-pull-request "\!sh -c 'stash pull-request \\$0'")
33
33
  end
34
+
35
+ def get_repo_root_directory
36
+ %x(git rev-parse --show-toplevel)
37
+ end
34
38
  end
35
39
  end
36
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atlassian-stash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seb Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-07 00:00:00.000000000 Z
11
+ date: 2014-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git