git-multirepo 1.0.0.beta12 → 1.0.0.beta15

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: 8e012e689d7399508df4528f204ae16c4bf9229c
4
- data.tar.gz: 8d7e3be3d4584401559ab47683acb8158a388dfb
3
+ metadata.gz: 7e82b1d4dc7e0ce39b4b686b972ca4d71668129b
4
+ data.tar.gz: 0d7ea7821b543a7378d387105b694106683bcd45
5
5
  SHA512:
6
- metadata.gz: 2aacad378edef41a3bce28869b916ad88257973948ba65fc1801750af35a8c1128861bc0fafa022dc000b185bb308e4cc993fb5fb487634f6e685b4d555d3a07
7
- data.tar.gz: be89879c9d7dc518094b13f56af07584886b4ce7ec4f40ad4b4a51c8ddab70f31a5d15ccd2202150aa10ebd92051a8df19c54e1f733e597d8b4350820ab4ec90
6
+ metadata.gz: 8b96fd301dcf1160ce12f981a056f3a369972af9a1bf14741fc00bfed880f2ca2babbcc42a255bdfdb9416697b81cc069a5885fbbbf2870b8132ceae659c238a
7
+ data.tar.gz: e190376df8033efb5ebd67f302a0ea1243cbd30159c936969c25097db3406503411d5de24d90ffeac858791a5b16247103a45d45139942a2aedc479be2542064
@@ -2,6 +2,7 @@ require_relative "multirepo/commands/command"
2
2
  require_relative "multirepo/commands/add-command"
3
3
  require_relative "multirepo/commands/branch-command"
4
4
  require_relative "multirepo/commands/checkout-command"
5
+ require_relative "multirepo/commands/clone-command"
5
6
  require_relative "multirepo/commands/edit-command"
6
7
  require_relative "multirepo/commands/fetch-command"
7
8
  require_relative "multirepo/commands/init-command"
@@ -1,5 +1,5 @@
1
1
  module MultiRepo
2
2
  NAME = "git-multirepo"
3
- VERSION = "1.0.0.beta12"
3
+ VERSION = "1.0.0.beta15"
4
4
  DESCRIPTION = "Track multiple Git repositories side-by-side."
5
5
  end
@@ -21,7 +21,7 @@ module MultiRepo
21
21
  end
22
22
 
23
23
  def run
24
- super
24
+ validate_in_work_tree
25
25
  ensure_multirepo_initialized
26
26
  ensure_repo_exists
27
27
 
@@ -27,7 +27,7 @@ module MultiRepo
27
27
  end
28
28
 
29
29
  def run
30
- super
30
+ validate_in_work_tree
31
31
  ensure_multirepo_initialized
32
32
 
33
33
  Console.log_step("Branching and checking out #{@branch_name}...")
@@ -27,7 +27,7 @@ module MultiRepo
27
27
  end
28
28
 
29
29
  def run
30
- super
30
+ validate_in_work_tree
31
31
  ensure_multirepo_initialized
32
32
 
33
33
  main_repo = Repo.new(".")
@@ -0,0 +1,54 @@
1
+ require "multirepo/utility/console"
2
+ require "multirepo/utility/utils"
3
+ require "multirepo/git/repo"
4
+ require_relative "install-command"
5
+
6
+ module MultiRepo
7
+ class CloneCommand < Command
8
+ self.command = "clone"
9
+ self.summary = "Clones the specified repository in a subfolder, then installs it."
10
+
11
+ def self.options
12
+ [
13
+ ['[url]', 'The repository to clone.'],
14
+ ['[name]', 'The name of the containing folder that will be created.']
15
+ ].concat(super)
16
+ end
17
+
18
+ def initialize(argv)
19
+ @url = argv.shift_argument
20
+ @name = argv.shift_argument
21
+ super
22
+ end
23
+
24
+ def validate!
25
+ super
26
+ help! "You must specify a repository to clone" unless @url
27
+ help! "You must specify a containing folder name" unless @name
28
+ end
29
+
30
+ def run
31
+ Console.log_step("Cloning #{@url} ...")
32
+
33
+ raise MultiRepoException, "A directory named #{@name} already exists" if Dir.exists?(@name)
34
+
35
+ main_repo_path = "#{@name}/#{@name}"
36
+
37
+ FileUtils.mkpath(main_repo_path)
38
+
39
+ main_repo = Repo.new(main_repo_path)
40
+ main_repo.clone(@url)
41
+
42
+ original_path = Dir.pwd
43
+ Dir.chdir(main_repo_path)
44
+
45
+ InstallCommand.new(CLAide::ARGV.new([])).install_internal
46
+
47
+ Dir.chdir(original_path)
48
+
49
+ Console.log_step("Done!")
50
+ rescue MultiRepoException => e
51
+ Console.log_error(e.message)
52
+ end
53
+ end
54
+ end
@@ -16,10 +16,6 @@ module MultiRepo
16
16
  super
17
17
  end
18
18
 
19
- def run
20
- validate_in_work_tree
21
- end
22
-
23
19
  def validate_in_work_tree
24
20
  raise MultiRepoException, "Not a git repository" unless Git.is_inside_git_repo(".")
25
21
  end
@@ -6,7 +6,7 @@ module MultiRepo
6
6
  self.summary = "Opens the .multirepo file in the default text editor."
7
7
 
8
8
  def run
9
- super
9
+ validate_in_work_tree
10
10
  ensure_multirepo_initialized
11
11
 
12
12
  if OS.posix?
@@ -6,7 +6,7 @@ module MultiRepo
6
6
  self.summary = "Performs a git fetch on all dependencies."
7
7
 
8
8
  def run
9
- super
9
+ validate_in_work_tree
10
10
  ensure_multirepo_initialized
11
11
 
12
12
  Console.log_step("Fetching dependencies...")
@@ -10,7 +10,7 @@ module MultiRepo
10
10
  self.summary = "Initialize the current repository as a multirepo project."
11
11
 
12
12
  def run
13
- super
13
+ validate_in_work_tree
14
14
  Console.log_step("Initializing new multirepo config...")
15
15
 
16
16
  if ConfigFile.exists?
@@ -8,22 +8,26 @@ module MultiRepo
8
8
  self.summary = "Clones and checks out dependencies as defined in the .multirepo file, and installs git-multirepo's local pre-commit hook."
9
9
 
10
10
  def run
11
- super
11
+ validate_in_work_tree
12
12
  ensure_multirepo_initialized
13
13
 
14
14
  Console.log_step("Cloning dependencies and installing hook...")
15
15
 
16
+ install_internal
17
+
18
+ Console.log_step("Done!")
19
+ rescue MultiRepoException => e
20
+ Console.log_error(e.message)
21
+ end
22
+
23
+ def install_internal
16
24
  config_entries = ConfigFile.load
17
25
 
18
- Console.log_info("There are #{config_entries.count} dependencies to install");
26
+ Console.log_substep("Installing #{config_entries.count} dependencies...");
19
27
 
20
28
  config_entries.each { |e| install(e) }
21
29
 
22
30
  self.install_pre_commit_hook
23
-
24
- Console.log_step("Done!")
25
- rescue MultiRepoException => e
26
- Console.log_error(e.message)
27
31
  end
28
32
 
29
33
  def install(entry)
@@ -9,7 +9,7 @@ module MultiRepo
9
9
  self.summary = "Opens all dependencies in the current OS's file explorer."
10
10
 
11
11
  def run
12
- super
12
+ validate_in_work_tree
13
13
  ensure_multirepo_initialized
14
14
 
15
15
  ConfigFile.load.each do |entry|
@@ -6,7 +6,7 @@ module MultiRepo
6
6
  self.summary = "Removes all traces of multirepo in the current multirepo repository."
7
7
 
8
8
  def run
9
- super
9
+ validate_in_work_tree
10
10
  ensure_multirepo_initialized
11
11
 
12
12
  File.delete(".multirepo")
@@ -19,7 +19,7 @@ module MultiRepo
19
19
  end
20
20
 
21
21
  def run
22
- super
22
+ validate_in_work_tree
23
23
  ensure_multirepo_initialized
24
24
 
25
25
  Console.log_step("Updating...")
@@ -17,7 +17,7 @@ module MultiRepo
17
17
  lines = []
18
18
  Open3.popen2e(cmd) do |stdin, stdout_and_stderr, thread|
19
19
  stdout_and_stderr.each do |line|
20
- Console.log_info(line) if verbosity == Verbosity::ALWAYS_OUTPUT || Config.instance.verbose
20
+ Console.log_info(line.rstrip) if verbosity == Verbosity::ALWAYS_OUTPUT || Config.instance.verbose
21
21
  lines << line
22
22
  end
23
23
  @last_command_succeeded = thread.value.success?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-multirepo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta12
4
+ version: 1.0.0.beta15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michaël Fortin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,6 +126,7 @@ files:
126
126
  - lib/multirepo/commands/add-command.rb
127
127
  - lib/multirepo/commands/branch-command.rb
128
128
  - lib/multirepo/commands/checkout-command.rb
129
+ - lib/multirepo/commands/clone-command.rb
129
130
  - lib/multirepo/commands/command.rb
130
131
  - lib/multirepo/commands/edit-command.rb
131
132
  - lib/multirepo/commands/fetch-command.rb