gitcredential 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDY2YmFhZDg0YWI3OGQ1MWI0ZTg1YmE1YTUxMDAwOWJjMDY5YmNiMA==
4
+ Y2EzOTc3OGI4MWU2NDA4MjY1MjQ3M2UyNjY2NDI3NTg2ZGYyZjcxMg==
5
5
  data.tar.gz: !binary |-
6
- ZDdhZmY5MjQ3NGE4OGU2NjliYmEyZDY3NjRlM2Q0OGY0MjliMDJkOA==
6
+ YjA3ZTk1N2EyZjgxY2JlMzZhYWJjZDk2Nzk0MDIzMGE1NDlkZDdhYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZmZkZWQ3Y2I5MjBiYTNkNDU5M2Y2MjY0ODQwMTE5OWYyODE3NmRjOTkwMzQ0
10
- YjBhOThiNTM5ZGMxNThmZjk2MDJhNTVkMTliZmY5ZDUzOTU2N2U0OTg0YzQ1
11
- ZGZlMjExNGZmMGEzMGI5MjU5YzRhZGIxM2MzZjM4YzY1Zjg0OWE=
9
+ NzZjODkyZGIwYWEzNmFlY2NjZjdmMTk0MzhmMWExMmFjMjk0ZmE4ZTJmNWMy
10
+ M2RmMDUzNTJhZjkxNzc5YjlmZGFlZGQ4YWRkMzk3Y2Y0ODZmODMzYWI3YWQx
11
+ NGQ2MmNmYTYzNjlkOWUyNjUwOGZmNjhmODkxODBjNjI3YTIzNDk=
12
12
  data.tar.gz: !binary |-
13
- MWFmNWJiYjQzYjM3ZWVlNWFjNDE0MDY5YTUxYjczZWZjMjBhMGM1NmIzNDk3
14
- NzIwNmZkNDk2ZjlkYmRlMWZjNTY4ZTk2YzAyODZjMjRiZjE4Yjc2YWRjNTFk
15
- NjQ3NzE1MDEzNGU3NTFkNmU0NDk4MjQ0YThiNjM0MzMwYjRiZjU=
13
+ YTc1ZmJmZTdlMGM0MWQ0ZjU4NDBkZTQyZWY2Y2Y2MjE0YjMwYzFjNjhkYjgx
14
+ MjUxNGNmMGQ2ZGJhNTU5NmUzNDg1OTAzMDk0MGI4NmUyNTU2MjVjNzY0YmVm
15
+ YjMwNjQ2ODllYjBmOTViNTNlNDQ4MDZmMjA1NGYwZmViYjIxMGQ=
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ .bundle
2
+ .DS_Store
3
+ vendor/bundle
4
+ default.pem
5
+ *.swo
6
+ resources_dump.json
7
+ hosts.txt
8
+ out
9
+ coverage
10
+ todo
11
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitcredential (0.0.2)
4
+ gitcredential (0.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.1.0
data/lib/gitcredential.rb CHANGED
@@ -18,6 +18,23 @@ class Gitcredential
18
18
  @backend = args[:backend] || Gitcredential.default_backend
19
19
 
20
20
  raise Exception "no such backend" unless @valid_backends.include?(@backend)
21
+
22
+ begin
23
+ `#{cmd} 2>/dev/null`
24
+ rescue Errno::ENOENT
25
+ ["/usr/local/lib/git-core", "/usr/local/libexec/git-core",
26
+ "/usr/lib/git-core", "/usr/libexec/git-core",
27
+ "/Library/Developer/CommandLineTools/usr/libexec/git-core"].each do |dir|
28
+ found=false
29
+ if File.exists? "#{dir}/#{cmd}"
30
+ ENV["PATH"] += ":#{dir}"
31
+ found=true
32
+ break
33
+ end
34
+ raise "can not find backend helper" unless found
35
+ end
36
+ end
37
+
21
38
  end
22
39
 
23
40
  def cmd
@@ -40,7 +57,7 @@ __EOS
40
57
 
41
58
  def get u
42
59
  out = nil
43
- IO.popen([cmd, 'get'], mode='r+') { |fd|
60
+ IO.popen("#{cmd} get", mode='r+') { |fd|
44
61
  fd.write(get_payload u)
45
62
  fd.close_write
46
63
  out = fd.read
@@ -51,7 +68,7 @@ __EOS
51
68
 
52
69
  def set u
53
70
  unset(u) unless get(u).nil?
54
- IO.popen([cmd, 'store'], mode='r+') { |fd|
71
+ IO.popen("#{cmd} store", mode='r+') { |fd|
55
72
  fd.write(set_payload u)
56
73
  fd.close_write
57
74
  }
@@ -62,7 +79,7 @@ __EOS
62
79
  def unset u
63
80
  return true if get(u).nil?
64
81
 
65
- IO.popen([cmd, 'erase'], mode='r+') { |fd|
82
+ IO.popen("#{cmd} erase", mode='r+') { |fd|
66
83
  fd.write(get_payload u)
67
84
  fd.close_write
68
85
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitcredential
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Maher
@@ -59,6 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - .gitignore
62
63
  - Gemfile
63
64
  - Gemfile.lock
64
65
  - README.md