mundler 0.6.0 → 0.6.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
  SHA256:
3
- metadata.gz: 71a4b590a91eeb9a5838d644baa01abc5e398f89b4714ed49f7b39428093d060
4
- data.tar.gz: 2301967224368ec42e971b8f00a23c2b90ad9f31619e0665a4f431a1d82f3a4d
3
+ metadata.gz: 116dbf6f2648c2b5d533e5a03fe121fc9978a8543c19245ecb4cc4867a8ae6b0
4
+ data.tar.gz: d413e06db8bc72d52036fc02795f90e7924e381fe0adf64d76819e05fd5ba8a7
5
5
  SHA512:
6
- metadata.gz: d8c927b5e931475c20891f251e4e4436526bc03e6f8d46166db46b03f460fb4cfbac95d2f8798b6478b8dadb257fce497bd37af568ae82aad129a169d1d40619
7
- data.tar.gz: b17b31322372c81490c7367f3e119bd828054ef68511c5275f62ccfc807c667a5738d2afdc20baeb803e59d751b6e9e99f7164105414bd394bb7c87a31c9cd51
6
+ metadata.gz: 1b325ac5b0576556356d973fbe5a34c5f9ea9e1a16bc9e5011fee9f83c6df7d0db2009ae190eaf190de407e12b65bbddb56de2be524b6d97820e1d537af10a23
7
+ data.tar.gz: 1d968eec2ce1176215d45e4690dc5b87dcf0e17ce9c7d78c64a94aff4111bd7f0e729bb146806c842572681c56b20fa6248430ea7788367981952c0934ca145c
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "fileutils"
4
+
5
+ paths = ENV["PATH"].split(":")
6
+ script_dir = File.expand_path(__dir__)
7
+ paths.delete_if { |p| p.strip == script_dir.strip }
8
+
9
+ if ARGV[0] == "clone"
10
+ repo = ARGV[-2]
11
+ target = ARGV[-1]
12
+ original_repo = repo
13
+ repo = repo.gsub(/.git$/, "")
14
+ repo_org = repo.split("/")[-2]
15
+ repo_name = repo.split("/")[-1]
16
+
17
+ mundler_root = File.join(ENV["HOME"], ".mundler")
18
+ cache_root = File.join(mundler_root, "cache")
19
+
20
+ unless File.directory?(File.join(cache_root, repo_org, repo_name))
21
+ FileUtils.mkdir_p(File.join(cache_root, repo_org))
22
+ FileUtils.cd(File.join(cache_root, repo_org)) do
23
+ system(
24
+ { "PATH" => paths.join(":") },
25
+ "git clone #{original_repo}"
26
+ )
27
+ end
28
+ status = $?.exitstatus
29
+ if status != 0
30
+ puts "Real git failed with status #{status}"
31
+ exit(status)
32
+ end
33
+ end
34
+
35
+ full_target = target.start_with?("/") ? target : File.expand_path(File.join(Dir.pwd, target))
36
+
37
+ if File.directory?(full_target) && Dir.glob(File.join(full_target, "**", "*")).count > 0
38
+ warn "fatal: destination path '#{target}' already exists and is not an empty directory."
39
+ exit 1
40
+ else
41
+ FileUtils.cp_r(
42
+ File.join(cache_root, repo_org, repo_name, "."),
43
+ File.join(full_target)
44
+ )
45
+ puts "Copied #{repo_name} from cache as #{target} (#{full_target})"
46
+ end
47
+ else
48
+ system(
49
+ { "PATH" => paths.join(":") },
50
+ "git #{ARGV.join(" ")}"
51
+ )
52
+ exit($?.exitstatus || 0)
53
+ end
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ def git
4
+ dir = __dir__
5
+ File.expand_path(File.join(dir, "cached_git"))
6
+ end
7
+
8
+ def main
9
+ system("#{git} #{ARGV.join(" ")}")
10
+ exit($?.exitstatus || 0)
11
+ end
12
+
13
+ if defined?(Bundler) && Bundler.respond_to?(:with_unbundled_env)
14
+ Bundler.with_unbundled_env { main }
15
+ elsif defined?(Bundler)
16
+ Bundler.with_clean_env { main }
17
+ else
18
+ main
19
+ end
data/lib/mundler/mruby.rb CHANGED
@@ -175,7 +175,7 @@ module Mundler
175
175
  end
176
176
 
177
177
  def cached_git_dir
178
- dir = File.expand_path(File.join(__dir__, "..", "..", "cached_git"))
178
+ dir = File.expand_path(File.join(__dir__, "cached_git"))
179
179
  raise "cached git not found" unless File.file?(File.join(dir, "git"))
180
180
  raise "cached git not found" unless File.file?(File.join(dir, "cached_git"))
181
181
  dir
@@ -1,3 +1,3 @@
1
1
  module Mundler
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Inkpen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-24 00:00:00.000000000 Z
11
+ date: 2021-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -63,6 +63,8 @@ files:
63
63
  - exe/mundle
64
64
  - lib/mundler.rb
65
65
  - lib/mundler/build_config.rb
66
+ - lib/mundler/cached_git/cached_git
67
+ - lib/mundler/cached_git/git
66
68
  - lib/mundler/cli.rb
67
69
  - lib/mundler/config.rb
68
70
  - lib/mundler/dsl.rb