tmp-repo 1.0.0 → 1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 750d50105e4fe0fd086ed4c10c8bf3f4648b17c6
4
- data.tar.gz: ebacae5e6fd5562a16c78ee84f1f262d45546620
5
- SHA512:
6
- metadata.gz: d57090af6e6155920bea50f1d8fd2513bcae60ec2030c9eb5bead81e0c2f9ff740e5165c27b244edf097a130ddf8ca1bd178f0c68e37dfbd93138a72a82ef943
7
- data.tar.gz: ab3f893e67603d9a024f8bf18c44a042e82b2bd56a68771684daa7c793efb50233c7ed527524ac53906796c91d08b097e2c1b84ef818fd001f36e355bac60833
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e066d1d7a1f044005bf19bc3ddfd9dc7447ed053
4
+ data.tar.gz: 0c81d28c00cda365465cf1b58456afe60c016ddf
5
+ SHA512:
6
+ metadata.gz: 571bdc29b37e937ff1789c9f3a384aee3137a4ee0aa469fc682f7f677d919eab8beb3e4e9ddd5a9ee626f8e207c5fa8aa840f38478a4d0a3a89b158be6dac95e
7
+ data.tar.gz: aff97032c388b37e86b05e1c99cbf351fb5986f83ab456174c6b23431cd6d3d0fb55e5fde97b238770c9a54c092cd19fa7e1049b1342341a3d7860a6c870465b
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
1
  == 1.0.0
2
2
 
3
3
  * Birthday!
4
+
5
+ == 1.0.1
6
+
7
+ * More easily overridable reference to git executable.
8
+ * Added ability to pass in desired working directory instead of always generating a new random one.
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  class TmpRepo
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
data/lib/tmp-repo.rb CHANGED
@@ -6,13 +6,19 @@ require 'fileutils'
6
6
  require 'securerandom'
7
7
 
8
8
  class TmpRepo
9
+ DEFAULT_GIT_EXECUTABLE = 'git'
10
+
9
11
  class GitError < StandardError; end
10
12
 
11
13
  attr_reader :working_dir
12
14
 
13
- def initialize
15
+ def self.random_dir
16
+ File.join(Dir.tmpdir, SecureRandom.hex(16))
17
+ end
18
+
19
+ def initialize(dir = nil)
14
20
  @working_dir = Pathname(
15
- File.join(Dir.tmpdir, SecureRandom.hex(16))
21
+ dir || self.class.random_dir
16
22
  )
17
23
 
18
24
  FileUtils.mkdir_p(working_dir)
@@ -62,7 +68,7 @@ class TmpRepo
62
68
 
63
69
  def git(command)
64
70
  in_repo do
65
- output = `git #{command}`
71
+ output = `#{git_executable} #{command}`
66
72
 
67
73
  if $?.exitstatus != 0
68
74
  raise GitError, output
@@ -80,6 +86,10 @@ class TmpRepo
80
86
 
81
87
  private
82
88
 
89
+ def git_executable
90
+ DEFAULT_GIT_EXECUTABLE
91
+ end
92
+
83
93
  def parse_status(status_text)
84
94
  lines = status_text.split("\n")
85
95
  status_hash = create_status_hash
metadata CHANGED
@@ -1,27 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: tmp-repo
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2014-08-21 00:00:00 Z
11
+ date: 2014-08-31 00:00:00.000000000 Z
13
12
  dependencies: []
14
-
15
- description: Creates and manages a git repository in the operating system's temporary directory. Useful for running git operations in tests.
16
- email:
13
+ description: Creates and manages a git repository in the operating system's temporary
14
+ directory. Useful for running git operations in tests.
15
+ email:
17
16
  - camertron@gmail.com
18
17
  executables: []
19
-
20
18
  extensions: []
21
-
22
19
  extra_rdoc_files: []
23
-
24
- files:
20
+ files:
25
21
  - Gemfile
26
22
  - History.txt
27
23
  - README.md
@@ -33,29 +29,26 @@ files:
33
29
  - tmp-repo.gemspec
34
30
  homepage: http://github.com/camertron
35
31
  licenses: []
36
-
37
32
  metadata: {}
38
-
39
33
  post_install_message:
40
34
  rdoc_options: []
41
-
42
- require_paths:
35
+ require_paths:
43
36
  - lib
44
- required_ruby_version: !ruby/object:Gem::Requirement
45
- requirements:
46
- - &id001
47
- - ">="
48
- - !ruby/object:Gem::Version
49
- version: "0"
50
- required_rubygems_version: !ruby/object:Gem::Requirement
51
- requirements:
52
- - *id001
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
53
47
  requirements: []
54
-
55
48
  rubyforge_project:
56
49
  rubygems_version: 2.2.2
57
50
  signing_key:
58
51
  specification_version: 4
59
- summary: Creates and manages a git repository in the operating system's temporary directory. Useful for running git operations in tests.
52
+ summary: Creates and manages a git repository in the operating system's temporary
53
+ directory. Useful for running git operations in tests.
60
54
  test_files: []
61
-