mgit 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjNmMTI1NTJjZWIzMjNhNGUzODNhYTZjZThlZGU3N2M5NTI1NDQ1Mw==
5
- data.tar.gz: !binary |-
6
- MjMyZTNiYjBlMTgyMzg5ZWRmYzQ5YjQzYzAyY2VlZmYwZGRmODgxZA==
2
+ SHA1:
3
+ metadata.gz: b52e092a056bf8964c6d7661f186d151a1d66ec5
4
+ data.tar.gz: d910c22cd816ae0fbf2565fb755f92b337986b85
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- M2EyYjBkYzg5ZDdiZjIwZWJjZDIyYzNkMTM0MTJlNzNjMjgxYTA0ZTcxZWIw
10
- OTJhYWU2NDIzNjlmYzEzOGQ2NmY0M2UxN2Y3ZGMwZmEyMDViN2I4M2QxM2U1
11
- ZTYxZWJmZGFiOGMyMjI2ZWNmMTFiMWMwZGFkNWI1ZThlYjUzN2U=
12
- data.tar.gz: !binary |-
13
- Y2RjNTlmMGYzMmI2MGU3YzMzYmMwZGYxNTljYTMxNjNkNTc0OTdiY2U5YWU4
14
- NjJiZmMwMTc0ZDkxOWQzY2M0MGRkN2NiYmI5NmE2NDNiYTg2ZDdhN2VlN2Jh
15
- ZDYyOTNjMDcxNWZlNmRjYTlkMmExZDQxODgwZGZhODBiNWUwNTU=
6
+ metadata.gz: 741ea187d1be95382071a051f0cae9a541ffc82370764e41572b383255fd7d07e1e05951abcd370b17f02d79f9941345cdee3a637199f60e294ff9b0ceb0cbf7
7
+ data.tar.gz: e9835cc422832de5abb6ca17e7770bb7af423bb202882e6ca767d8b500232eac2b93bade7e8d9e4d7644b24fdd8da790419945defec9d2bf257184e42ed1af26
@@ -1,12 +1,14 @@
1
1
  module MGit
2
2
  class CLI
3
+ include Output
4
+
3
5
  def start
4
6
  raise NoCommandError if ARGV.size == 0
5
7
  command = Command.execute(ARGV.shift, ARGV)
6
8
  rescue UsageError => e
7
- $stderr.puts e
9
+ perror e.to_s
8
10
  rescue GitError => e
9
- $stderr.puts e
11
+ perror e.to_s
10
12
  end
11
13
  end
12
14
  end
@@ -2,9 +2,13 @@ module MGit
2
2
  class AddCommand < Command
3
3
  def execute(args)
4
4
  path = File.expand_path(args[0])
5
+ raise CommandUsageError.new('First argument must be a path to a directory.', self) unless File.directory?(path)
5
6
  raise CommandUsageError.new('First argument must be a path to a git repository.', self) unless is_git_dir?(path)
7
+ raise CommandUsageError.new('Sorry, mgit can not handle bare repositories.', self) if is_bare?(path)
6
8
 
7
- name = (args.size == 2) ? args[1] : (ask('Name of the repository? ') { |q| q.default = File.basename(path) })
9
+ # NOTE: The to_s to the HighLine::String is needed due to a bug in YAML/Psych in Ruby 2.0.0.
10
+ # https://github.com/JEG2/highline/issues/69
11
+ name = (args.size == 2) ? args[1] : (ask('Name of the repository? ') { |q| q.default = File.basename(path) }).to_s
8
12
  raise CommandUsageError.new("Repository named #{name} already exists with different path.", self) unless is_new_or_same?(name, path)
9
13
 
10
14
  Registry.add(name, path)
@@ -32,7 +36,11 @@ module MGit
32
36
  end
33
37
 
34
38
  def is_git_dir?(path)
35
- File.directory?(path) && (File.directory?(File.join(path, '.git')) || File.file?(File.join(path, 'HEAD')))
39
+ Dir.chdir(path) { `git status 2>&1` !~ /fatal: Not a git repository/ }
40
+ end
41
+
42
+ def is_bare?(path)
43
+ Dir.chdir(path) { `git status 2>&1` =~ /fatal: This operation must be run in a work tree/}
36
44
  end
37
45
  end
38
46
  end
File without changes
@@ -34,7 +34,7 @@ module MGit
34
34
  end
35
35
 
36
36
  def description
37
- 'merge all upstream tracking branches that can be fast-forwardeded'
37
+ 'merge all upstream tracking branches that can be fast-forwarded'
38
38
  end
39
39
 
40
40
  register_command :ffmerge
@@ -5,7 +5,7 @@ module MGit
5
5
 
6
6
  Registry.chdir_each do |repo|
7
7
  pinfo "Executing command in repository #{repo.name}..."
8
- if !system(command) && !ask("Executing command '#{command}' in repository '#{repo.name}' failed. Would you like to continue anyway?".red)
8
+ if !system(command) && !agree("Executing command '#{command}' in repository '#{repo.name}' failed. Would you like to continue anyway?".red)
9
9
  break
10
10
  end
11
11
  end
@@ -0,0 +1,5 @@
1
+ module MGit
2
+ class Subcommand < Command
3
+
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module MGit
2
- VERSION = '0.2.6'
2
+ VERSION = '0.2.7'
3
3
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - FlavourSys Technology GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-18 00:00:00.000000000 Z
11
+ date: 2013-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: highline
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: xdg
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: M[eta]Git let's you manage multiple git repositories simultaneously
@@ -73,26 +73,28 @@ executables:
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - lib/mgit/exceptions.rb
76
+ - lib/mgit.rb
77
77
  - lib/mgit/output.rb
78
- - lib/mgit/cli.rb
79
- - lib/mgit/command.rb
80
- - lib/mgit/commands/clone.rb
81
- - lib/mgit/commands/add.rb
78
+ - lib/mgit/repository.rb
79
+ - lib/mgit/version.rb
80
+ - lib/mgit/subcommand.rb
81
+ - lib/mgit/registry.rb
82
+ - lib/mgit/exceptions.rb
82
83
  - lib/mgit/commands/list.rb
84
+ - lib/mgit/commands/grep.rb
85
+ - lib/mgit/commands/config.rb
86
+ - lib/mgit/commands/version.rb
87
+ - lib/mgit/commands/fetch.rb
88
+ - lib/mgit/commands/status.rb
89
+ - lib/mgit/commands/remove.rb
83
90
  - lib/mgit/commands/help.rb
84
91
  - lib/mgit/commands/foreach.rb
85
- - lib/mgit/commands/remove.rb
86
- - lib/mgit/commands/fetch.rb
92
+ - lib/mgit/commands/add.rb
87
93
  - lib/mgit/commands/log.rb
88
- - lib/mgit/commands/grep.rb
89
94
  - lib/mgit/commands/ffmerge.rb
90
- - lib/mgit/commands/version.rb
91
- - lib/mgit/commands/status.rb
92
- - lib/mgit/repository.rb
93
- - lib/mgit/registry.rb
94
- - lib/mgit/version.rb
95
- - lib/mgit.rb
95
+ - lib/mgit/commands/clone.rb
96
+ - lib/mgit/command.rb
97
+ - lib/mgit/cli.rb
96
98
  - bin/mgit
97
99
  homepage: http://github.com/flavoursys/mgit
98
100
  licenses:
@@ -104,17 +106,17 @@ require_paths:
104
106
  - lib
105
107
  required_ruby_version: !ruby/object:Gem::Requirement
106
108
  requirements:
107
- - - ! '>='
109
+ - - '>='
108
110
  - !ruby/object:Gem::Version
109
111
  version: '0'
110
112
  required_rubygems_version: !ruby/object:Gem::Requirement
111
113
  requirements:
112
- - - ! '>='
114
+ - - '>='
113
115
  - !ruby/object:Gem::Version
114
116
  version: '0'
115
117
  requirements: []
116
118
  rubyforge_project:
117
- rubygems_version: 2.1.10
119
+ rubygems_version: 2.0.3
118
120
  signing_key:
119
121
  specification_version: 4
120
122
  summary: MGit meta repository tool