pullable 1.0.1 → 1.1.0
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 +4 -4
- data/.pullable.yml.example +2 -0
- data/.ruby-version +1 -1
- data/lib/pullable/directory.rb +2 -17
- data/lib/pullable/processor.rb +50 -0
- data/lib/pullable/version.rb +1 -1
- data/lib/pullable.rb +1 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cf7eb1ec2b03ee87fbf43db2856d60fcb247b28
|
4
|
+
data.tar.gz: b0519adbb9ed78955ef46ebdadf52a99b0a03a91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 727c6285d78c34db3998537947f36e675ff2af81f5d74837e441bccd2fe8911329e1dd2867bcc3df9ee7c617bdb517ae9391179bf1ce28ee5fe81837db9cd68b
|
7
|
+
data.tar.gz: 60bc1fb5276cd152858964259e6ab3d828aa2dda6acff14eac80bec698902359ed49df00cc33fce0a8f434e362f36e6fc88735e5ba94df25ef111df85746bad3
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.0.0-
|
1
|
+
ruby-2.0.0-p247
|
data/lib/pullable/directory.rb
CHANGED
@@ -27,9 +27,8 @@ module Pullable
|
|
27
27
|
unless SKIPPED_DIRECTORIES.include?(directory)
|
28
28
|
FileUtils.cd(directory)
|
29
29
|
|
30
|
-
if
|
31
|
-
|
32
|
-
update!
|
30
|
+
if Dir.exists?('.git')
|
31
|
+
Pullable::Processor.update!(method, directory)
|
33
32
|
end
|
34
33
|
|
35
34
|
FileUtils.cd(path)
|
@@ -42,19 +41,5 @@ module Pullable
|
|
42
41
|
new(path, method).process!
|
43
42
|
end
|
44
43
|
|
45
|
-
def update!
|
46
|
-
system "git fetch -p && #{command} > /dev/null"
|
47
|
-
end
|
48
|
-
|
49
|
-
def command
|
50
|
-
case @method
|
51
|
-
when 'merge'
|
52
|
-
'git merge --ff-only origin/master'
|
53
|
-
when 'pull'
|
54
|
-
'git pull origin master'
|
55
|
-
else
|
56
|
-
raise NotImplementedError
|
57
|
-
end
|
58
|
-
end
|
59
44
|
end
|
60
45
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
class Pullable::Processor
|
4
|
+
|
5
|
+
CONFIG_FILE = ".pullable.yml"
|
6
|
+
|
7
|
+
attr_reader :method, :directory, :options
|
8
|
+
|
9
|
+
def initialize(method, directory, options = {})
|
10
|
+
@method = method
|
11
|
+
@directory = directory
|
12
|
+
@options = options
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.update!(method, directory)
|
16
|
+
options = File.exists?(CONFIG_FILE) ? YAML.load(File.read(CONFIG_FILE)) : {}
|
17
|
+
processor = new(method, directory, options)
|
18
|
+
|
19
|
+
if processor.options['mirror']
|
20
|
+
processor.mirror!(options)
|
21
|
+
else
|
22
|
+
processor.update!(options)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def mirror!(options = {})
|
27
|
+
remote = options['mirror']['remote'] rescue 'upstream'
|
28
|
+
run "git pull #{remote} master && git push origin master"
|
29
|
+
end
|
30
|
+
|
31
|
+
def update!(options = {})
|
32
|
+
run "git fetch -p && #{command}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def run(command)
|
36
|
+
puts "Updating:\t#{directory}"
|
37
|
+
system "#{command} > /dev/null"
|
38
|
+
end
|
39
|
+
|
40
|
+
def command
|
41
|
+
case method
|
42
|
+
when 'merge'
|
43
|
+
'git merge --ff-only origin/master'
|
44
|
+
when 'pull'
|
45
|
+
'git pull origin master'
|
46
|
+
else
|
47
|
+
raise NotImplementedError
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/pullable/version.rb
CHANGED
data/lib/pullable.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pullable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Duncan Grazier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,6 +89,7 @@ extensions: []
|
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
91
|
- .gitignore
|
92
|
+
- .pullable.yml.example
|
92
93
|
- .rspec
|
93
94
|
- .ruby-gemset
|
94
95
|
- .ruby-version
|
@@ -100,6 +101,7 @@ files:
|
|
100
101
|
- bin/pullable
|
101
102
|
- lib/pullable.rb
|
102
103
|
- lib/pullable/directory.rb
|
104
|
+
- lib/pullable/processor.rb
|
103
105
|
- lib/pullable/version.rb
|
104
106
|
- pullable.gemspec
|
105
107
|
- spec/lib/pullable/directory_spec.rb
|
@@ -125,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
127
|
version: '0'
|
126
128
|
requirements: []
|
127
129
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.1.5
|
129
131
|
signing_key:
|
130
132
|
specification_version: 4
|
131
133
|
summary: A simple tool to update your local repositories
|