gitit 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/gitit/command_branches.rb +4 -5
- data/lib/gitit/command_config.rb +18 -1
- data/spec/gitit_branches_spec.rb +32 -13
- data/spec/gitit_config_spec.rb +11 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d6eccd073e28fa27af29c78a39eea588380603d
|
4
|
+
data.tar.gz: bdb4ea6a45379dd2bfd0f8e59fd6b01efa869284
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6145b556fde747538ae62b5491884790e22706a11149fb8812bb3bbcda4ad6f72d4c7fb1a2d743c351cba67c4188bb36026c5042ab7540d4bda2b4341deab7f
|
7
|
+
data.tar.gz: 8ffc989495d607f3c6e0f2fb0ed7bde73181822d50486c658d2d24ea322e9c108a9f9f999b471c9ce50f580f95055f78ace9f2358264970f3bf2a9066b4ca5e3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.0
|
@@ -32,17 +32,16 @@ module Gitit
|
|
32
32
|
# -------------------------------------------------------------------------
|
33
33
|
# -------------------------------------------------------------------------
|
34
34
|
def createLocalBranch(name)
|
35
|
-
|
36
|
-
executeCommand("branch #{name}")
|
35
|
+
executeCommand("branch --quiet #{name}")
|
37
36
|
return true if $?.exitstatus == 0
|
38
37
|
return false
|
39
38
|
end
|
40
39
|
|
41
40
|
# -------------------------------------------------------------------------
|
42
41
|
# -------------------------------------------------------------------------
|
43
|
-
def pushLocalBranchToRemote(name, remote)
|
44
|
-
|
45
|
-
executeCommand("push #{remote} #{name}")
|
42
|
+
def pushLocalBranchToRemote(name, remote, force)
|
43
|
+
executeCommand("push --quiet -f #{remote} #{name}") if force
|
44
|
+
executeCommand("push --quiet #{remote} #{name}") unless force
|
46
45
|
return true if $?.exitstatus == 0
|
47
46
|
return false
|
48
47
|
end
|
data/lib/gitit/command_config.rb
CHANGED
@@ -15,7 +15,7 @@ module Gitit
|
|
15
15
|
|
16
16
|
# -------------------------------------------------------------------------
|
17
17
|
# -------------------------------------------------------------------------
|
18
|
-
def getValue(key
|
18
|
+
def getValue(key)
|
19
19
|
value = executeCommand("config --null --get #{key}")
|
20
20
|
raise "failure running command" if $?.exitstatus != 0
|
21
21
|
value = value.slice!(0, value.length-1)
|
@@ -30,6 +30,23 @@ module Gitit
|
|
30
30
|
raise "failure running command" if $?.exitstatus != 0
|
31
31
|
end
|
32
32
|
|
33
|
+
# -------------------------------------------------------------------------
|
34
|
+
# -------------------------------------------------------------------------
|
35
|
+
def getGlobalValue(key)
|
36
|
+
value = executeCommand("config --global --null --get #{key}")
|
37
|
+
raise "failure running command" if $?.exitstatus != 0
|
38
|
+
value = value.slice!(0, value.length-1)
|
39
|
+
return value
|
40
|
+
end
|
41
|
+
|
42
|
+
# -------------------------------------------------------------------------
|
43
|
+
# -------------------------------------------------------------------------
|
44
|
+
def setGlobalValue(key, value)
|
45
|
+
val = value
|
46
|
+
executeCommand("config --global \"#{key}\" \"#{val}\"")
|
47
|
+
raise "failure running command" if $?.exitstatus != 0
|
48
|
+
end
|
49
|
+
|
33
50
|
end
|
34
51
|
|
35
52
|
|
data/spec/gitit_branches_spec.rb
CHANGED
@@ -43,19 +43,6 @@ module Gitit
|
|
43
43
|
@repoBranches.existsRemotely?("asdasdsad", "origin").should eq false
|
44
44
|
end
|
45
45
|
|
46
|
-
it "will create a local branch successfully" do
|
47
|
-
@repoBranches.createLocalBranch("mybranch").should eq true
|
48
|
-
@repoBranches.existsLocally?("mybranch").should eq true
|
49
|
-
@repoBranches.existsRemotely?("mybranch", "origin").should eq false
|
50
|
-
end
|
51
|
-
|
52
|
-
it "will push a local branch to the remote" do
|
53
|
-
@repoBranches.createLocalBranch("mybranch").should eq true
|
54
|
-
@repoBranches.existsRemotely?("mybranch", "origin").should eq false
|
55
|
-
@repoBranches.pushLocalBranchToRemote("mybranch", "origin").should eq true
|
56
|
-
@repoBranches.existsRemotely?("mybranch", "origin").should eq true
|
57
|
-
end
|
58
|
-
|
59
46
|
after(:each) do
|
60
47
|
FileUtils.rm_rf TEST_REPO_PATH
|
61
48
|
FileUtils.rm_rf TEST_REPO_PATH_BARE
|
@@ -83,6 +70,38 @@ module Gitit
|
|
83
70
|
|
84
71
|
end
|
85
72
|
|
73
|
+
it "will fail to create a local branch" do
|
74
|
+
@repoBranches.createLocalBranch("mybranch").should eq true
|
75
|
+
@repoBranches.createLocalBranch("mybranch").should eq false
|
76
|
+
end
|
77
|
+
|
78
|
+
it "will create a local branch successfully" do
|
79
|
+
@repoBranches.createLocalBranch("mybranch").should eq true
|
80
|
+
@repoBranches.existsLocally?("mybranch").should eq true
|
81
|
+
@repoBranches.existsRemotely?("mybranch", "origin").should eq false
|
82
|
+
end
|
83
|
+
|
84
|
+
it "will fail to push a local branch to an invalid remote" do
|
85
|
+
@repoBranches.createLocalBranch("mybranch").should eq true
|
86
|
+
@repoBranches.existsRemotely?("mybranch", "origin").should eq false
|
87
|
+
@repoBranches.pushLocalBranchToRemote("mybranch", "badorigin", false).should eq false
|
88
|
+
@repoBranches.existsRemotely?("mybranch", "origin").should eq false
|
89
|
+
end
|
90
|
+
|
91
|
+
it "will push a local branch to the remote not forcing it" do
|
92
|
+
@repoBranches.createLocalBranch("mybranch").should eq true
|
93
|
+
@repoBranches.existsRemotely?("mybranch", "origin").should eq false
|
94
|
+
@repoBranches.pushLocalBranchToRemote("mybranch", "origin", false).should eq true
|
95
|
+
@repoBranches.existsRemotely?("mybranch", "origin").should eq true
|
96
|
+
end
|
97
|
+
|
98
|
+
it "will push a local branch to the remote forcing it" do
|
99
|
+
@repoBranches.createLocalBranch("mybranch").should eq true
|
100
|
+
@repoBranches.existsRemotely?("mybranch", "origin").should eq false
|
101
|
+
@repoBranches.pushLocalBranchToRemote("mybranch", "origin", true).should eq true
|
102
|
+
@repoBranches.existsRemotely?("mybranch", "origin").should eq true
|
103
|
+
end
|
104
|
+
|
86
105
|
after(:each) do
|
87
106
|
FileUtils.rm_rf TEST_REPO_PATH
|
88
107
|
FileUtils.rm_rf TEST_REPO_PATH_BARE
|
data/spec/gitit_config_spec.rb
CHANGED
@@ -30,6 +30,17 @@ module Gitit
|
|
30
30
|
value.should eq KEY_VALUE
|
31
31
|
end
|
32
32
|
|
33
|
+
it "will set the specified global value successfully" do
|
34
|
+
lambda{@config.setGlobalValue(KEY_NAME, KEY_VALUE)}.should_not raise_error
|
35
|
+
end
|
36
|
+
|
37
|
+
it "will retrieve the specified global value successfully" do
|
38
|
+
value = ""
|
39
|
+
lambda{@config.setGlobalValue(KEY_NAME, KEY_VALUE)}.should_not raise_error
|
40
|
+
lambda{value = @config.getGlobalValue(KEY_NAME)}.should_not raise_error
|
41
|
+
value.should eq KEY_VALUE
|
42
|
+
end
|
43
|
+
|
33
44
|
after(:each) do
|
34
45
|
FileUtils.rm_rf TEST_REPO_PATH
|
35
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Laplante
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
183
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.1.11
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: ''
|