git_fonky 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/git_fonky/command.rb +6 -11
- data/lib/git_fonky/repo_dir.rb +1 -1
- data/lib/git_fonky/reporter.rb +4 -0
- data/lib/git_fonky/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d9e659e91221b3600b3d9924a209748976b7880108f49d724d4ffaaf2189ff6
|
4
|
+
data.tar.gz: 947bf8009681841bd4fcdd46c962bcc2d824b39851161aefa3777e75f5b0cd0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83e34338ffc13a6af5f9fe7d6684066bc74796037353122c9ee5bdc73a86e424d9438325d1634a8d5ba35cebd2ef86d3e3ecce2fcc8762bed39624b7e7ae0381
|
7
|
+
data.tar.gz: 2601863350da5d6a26b5a263cf9e9b903f43ec5b85858737c760ab122479467b7f535e3531a49255b1aab2b53324a9207d80a0e6e022b6dcc6e4d059dd433f47
|
data/lib/git_fonky/command.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
module GitFonky
|
2
2
|
class Command
|
3
|
-
attr_reader :repo_dir
|
3
|
+
attr_reader :repo_dir, :reporter
|
4
4
|
|
5
|
-
def initialize(repo_dir)
|
5
|
+
def initialize(repo_dir:, reporter:)
|
6
6
|
@repo_dir = repo_dir
|
7
|
+
@reporter = reporter
|
7
8
|
end
|
8
9
|
|
9
10
|
def current_branch
|
@@ -11,24 +12,18 @@ module GitFonky
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def fetch_upstream
|
14
|
-
announce("fetching")
|
15
|
+
reporter.announce("fetching")
|
15
16
|
`git fetch upstream #{repo_dir.branch} 2>&1`
|
16
17
|
end
|
17
18
|
|
18
19
|
def pull_upstream
|
19
|
-
announce("pulling")
|
20
|
+
reporter.announce("pulling")
|
20
21
|
`git pull upstream #{repo_dir.branch} 2>&1`
|
21
22
|
end
|
22
23
|
|
23
24
|
def push_to_origin
|
24
|
-
announce("pushing", "to", "origin")
|
25
|
+
reporter.announce("pushing", "to", "origin")
|
25
26
|
`git push origin #{repo_dir.branch} 2>&1`
|
26
27
|
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def announce(action, direction = "from", remote = "upstream")
|
31
|
-
puts "-----> #{action} #{direction} #{remote} #{repo_dir.branch}"
|
32
|
-
end
|
33
28
|
end
|
34
29
|
end
|
data/lib/git_fonky/repo_dir.rb
CHANGED
@@ -6,9 +6,9 @@ module GitFonky
|
|
6
6
|
attr_reader :command, :dirname, :reporter
|
7
7
|
|
8
8
|
def initialize(dirname)
|
9
|
-
@command = Command.new(self)
|
10
9
|
@dirname = dirname
|
11
10
|
@reporter = Reporter.new(self)
|
11
|
+
@command = Command.new(repo_dir: self, reporter: reporter)
|
12
12
|
end
|
13
13
|
|
14
14
|
def branch
|
data/lib/git_fonky/reporter.rb
CHANGED
@@ -6,6 +6,10 @@ module GitFonky
|
|
6
6
|
@repo_dir = repo_dir
|
7
7
|
end
|
8
8
|
|
9
|
+
def announce(action, direction = "from", remote = "upstream")
|
10
|
+
puts "-----> #{action} #{direction} #{remote} #{repo_dir.branch}"
|
11
|
+
end
|
12
|
+
|
9
13
|
def announce_success
|
10
14
|
puts "-----> Successfully updated #{repo_dir.dirname} | #{repo_dir.branch} branch"
|
11
15
|
end
|
data/lib/git_fonky/version.rb
CHANGED