gitdocs 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,4 +2,23 @@
2
2
 
3
3
  require 'gitdocs'
4
4
 
5
- Gitdocs.new(File.expand_path(Dir.pwd, File.dirname(__FILE__))).run
5
+ dirs = ARGV
6
+ dirs << File.expand_path(Dir.pwd, File.dirname(__FILE__)) if dirs.empty?
7
+
8
+ pids = dirs.map do |dir|
9
+ fork do
10
+ Dir.chdir(dir) do
11
+ Gitdocs.new(Dir.pwd).run
12
+ end
13
+ end
14
+ end
15
+
16
+ pids.each do |pid|
17
+ Process.waitpid(pid)
18
+ end
19
+
20
+ at_exit do
21
+ pids.each do |pid|
22
+ Process.kill("INT", pid) rescue nil
23
+ end
24
+ end
@@ -19,7 +19,7 @@ class Gitdocs
19
19
  Thread.new do
20
20
  loop do
21
21
  mutex.synchronize do
22
- out, status = sh_with_code("git pull")
22
+ out, status = sh_with_code("git fetch --all && git merge origin/master")
23
23
  if status.success?
24
24
  changes = get_latest_changes
25
25
  unless changes.empty?
@@ -47,8 +47,9 @@ class Gitdocs
47
47
  end
48
48
 
49
49
  def push_changes
50
- out, code = sh_with_code("git ls-files -o --exclude-per-directory=.gitignore | git update-index --add --stdin")
51
- if system("git commit -a -m'Auto-commit from gitdocs'")
50
+ out, status = sh_with_code("git ls-files -o --exclude-per-directory=.gitignore | git update-index --add --stdin")
51
+ unless sh("git status -s").strip.empty?
52
+ sh "git commit -a -m'Auto-commit from gitdocs'" # TODO make this message nicer
52
53
  out, code = sh_with_code("git push")
53
54
  changes = get_latest_changes
54
55
  info("Pushed #{changes.size} change#{changes.size == 1 ? '' : 's'}", "`#{@root}' has been pushed")
@@ -1,3 +1,3 @@
1
1
  class Gitdocs
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitdocs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb-fsevent
16
- requirement: &70241725236540 !ruby/object:Gem::Requirement
16
+ requirement: &70199644891480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.4.3.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70241725236540
24
+ version_requirements: *70199644891480
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: growl
27
- requirement: &70241725235860 !ruby/object:Gem::Requirement
27
+ requirement: &70199644890720 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70241725235860
35
+ version_requirements: *70199644890720
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yajl-ruby
38
- requirement: &70241725235280 !ruby/object:Gem::Requirement
38
+ requirement: &70199644890140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70241725235280
46
+ version_requirements: *70199644890140
47
47
  description: Docs + git = gitdocs.
48
48
  email:
49
49
  - joshbuddy@gmail.com