gitit 1.1.0 → 2.0.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/Gemfile +2 -0
- data/Rakefile +4 -4
- data/VERSION +1 -1
- data/lib/gitit/git.rb +7 -6
- data/lib/gitit/{command_branch.rb → git_branch.rb} +4 -4
- data/lib/gitit/{command_branches.rb → git_branches.rb} +3 -3
- data/lib/gitit/{command_config.rb → git_config.rb} +15 -15
- data/lib/gitit/git_executor.rb +20 -0
- data/lib/gitit/{repo.rb → git_repo.rb} +1 -1
- data/lib/gitit/{command_status.rb → git_status.rb} +3 -3
- data/lib/gitit/version.rb +1 -1
- data/spec/gitit_branch_spec.rb +2 -2
- data/spec/gitit_branches_spec.rb +27 -27
- data/spec/gitit_config_spec.rb +13 -13
- data/spec/gitit_spec.rb +13 -18
- data/spec/gitit_status_spec.rb +18 -18
- data/spec/spec_helper.rb +6 -0
- metadata +31 -33
- data/.idea/dictionaries/pat.xml +0 -19
- data/lib/gitit/command_executor.rb +0 -16
- data/lib/gitit/foo.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7cf071b26037281690cd5e4e4789e5decbe072d
|
4
|
+
data.tar.gz: 226e78dddf07743516812d73904818b156fba32c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8401fe9bcb048e6f53c4ce393b170c63a466bbc04ea31a42819f0c35605726832e3140ab23598e05156fa1890f1fa8d50850ceab01cff3e762691621d753948
|
7
|
+
data.tar.gz: 6fb384a6d5468dae0bb716b4d002f9838a6fe03717836cc0bd6aa92bca8ca912a90062920eff9bcb99275385a7be9c655b64e9990e016515553b5dfca11b185c
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ begin
|
|
6
6
|
Bundler.setup(:default, :development)
|
7
7
|
rescue Bundler::BundlerError => e
|
8
8
|
$stderr.puts e.message
|
9
|
-
$stderr.puts
|
9
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
10
10
|
exit e.status_code
|
11
11
|
end
|
12
12
|
require 'rake'
|
@@ -29,7 +29,7 @@ require 'rspec/core'
|
|
29
29
|
require 'rspec/core/rake_task'
|
30
30
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
31
|
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
-
spec.rspec_opts = Dir.glob(
|
32
|
+
spec.rspec_opts = Dir.glob('[0-9][0-9][0-9]_*').collect { |x| "-I#{x}" }
|
33
33
|
spec.rspec_opts << '--color -f d'
|
34
34
|
end
|
35
35
|
|
@@ -40,7 +40,7 @@ end
|
|
40
40
|
|
41
41
|
RSpec::Core::RakeTask.new(:coverage) do |spec|
|
42
42
|
# add simplecov
|
43
|
-
ENV[
|
43
|
+
ENV['COVERAGE'] = 'yes'
|
44
44
|
|
45
45
|
# run the specs
|
46
46
|
Rake::Task['spec'].execute
|
@@ -53,7 +53,7 @@ task :default => :spec
|
|
53
53
|
|
54
54
|
require 'rdoc/task'
|
55
55
|
Rake::RDocTask.new do |rdoc|
|
56
|
-
version = File.exist?('VERSION') ? File.read('VERSION') :
|
56
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
57
57
|
|
58
58
|
rdoc.rdoc_dir = 'rdoc'
|
59
59
|
rdoc.title = "gitit #{version}"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/lib/gitit/git.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'gitit'
|
2
|
-
require 'gitit/
|
2
|
+
#require 'gitit/git_repo'
|
3
3
|
|
4
|
-
Dir[File.dirname(__FILE__) + '/
|
4
|
+
Dir[File.dirname(__FILE__) + '/git_*.rb'].each do |file|
|
5
|
+
# noinspection RubyResolve
|
5
6
|
require file
|
6
7
|
end
|
7
8
|
|
@@ -18,10 +19,10 @@ module Gitit
|
|
18
19
|
# -------------------------------------------------------------------------
|
19
20
|
# -------------------------------------------------------------------------
|
20
21
|
def initialize(location)
|
21
|
-
@repo =
|
22
|
-
@config =
|
23
|
-
@status =
|
24
|
-
@branches =
|
22
|
+
@repo = GitRepo.new(location)
|
23
|
+
@config = GitConfig.new(repo)
|
24
|
+
@status = GitStatus.new(repo)
|
25
|
+
@branches = GitBranches.new(repo)
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require 'gitit/
|
1
|
+
require 'gitit/git_executor'
|
2
2
|
|
3
3
|
module Gitit
|
4
4
|
|
5
5
|
# ---------------------------------------------------------------------------
|
6
6
|
# ---------------------------------------------------------------------------
|
7
|
-
class
|
8
|
-
include
|
7
|
+
class GitBranch
|
8
|
+
include GitExecutor
|
9
9
|
|
10
|
-
attr_reader :name
|
10
|
+
attr_reader :name
|
11
11
|
|
12
12
|
# -------------------------------------------------------------------------
|
13
13
|
# -------------------------------------------------------------------------
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require 'gitit/
|
1
|
+
require 'gitit/git_executor'
|
2
2
|
|
3
3
|
module Gitit
|
4
4
|
|
5
5
|
# ---------------------------------------------------------------------------
|
6
6
|
# ---------------------------------------------------------------------------
|
7
|
-
class
|
8
|
-
include
|
7
|
+
class GitBranches
|
8
|
+
include GitExecutor
|
9
9
|
|
10
10
|
# -------------------------------------------------------------------------
|
11
11
|
# -------------------------------------------------------------------------
|
@@ -1,45 +1,45 @@
|
|
1
|
-
require 'gitit/
|
1
|
+
require 'gitit/git_executor'
|
2
2
|
|
3
3
|
module Gitit
|
4
4
|
|
5
5
|
# ---------------------------------------------------------------------------
|
6
6
|
# ---------------------------------------------------------------------------
|
7
|
-
class
|
8
|
-
include
|
7
|
+
class GitConfig
|
8
|
+
include GitExecutor
|
9
9
|
|
10
|
-
attr_accessor :location
|
11
|
-
|
12
|
-
# -------------------------------------------------------------------------
|
13
10
|
# -------------------------------------------------------------------------
|
14
|
-
|
11
|
+
# @param [Object] repo
|
12
|
+
# @param [Object] location
|
13
|
+
# @return [Object]
|
14
|
+
def initialize(repo, location: '')
|
15
15
|
@repo = repo
|
16
16
|
@location = location
|
17
17
|
end
|
18
|
-
|
19
|
-
# -------------------------------------------------------------------------
|
18
|
+
|
20
19
|
# -------------------------------------------------------------------------
|
20
|
+
# @param [Object] key
|
21
21
|
def get_value(key)
|
22
22
|
value = execute_command("config #{@location} --null --get #{key}")
|
23
23
|
raise 'failure running command' if $?.exitstatus != 0
|
24
24
|
value.slice!(0, value.length-1)
|
25
25
|
end
|
26
|
-
|
27
|
-
# -------------------------------------------------------------------------
|
26
|
+
|
28
27
|
# -------------------------------------------------------------------------
|
28
|
+
# @param [Object] key
|
29
|
+
# @param [Object] value
|
29
30
|
def set_value(key, value)
|
30
31
|
val = value
|
31
32
|
execute_command("config #{@location} \"#{key}\" \"#{val}\"")
|
32
33
|
raise 'failure running command' if $?.exitstatus != 0
|
33
34
|
end
|
34
|
-
|
35
|
-
# -------------------------------------------------------------------------
|
35
|
+
|
36
36
|
# -------------------------------------------------------------------------
|
37
|
+
# @param [Object] key
|
37
38
|
def unset_value(key)
|
38
39
|
execute_command("config #{@location} --null --unset #{key}")
|
39
40
|
raise 'failure running command' if $?.exitstatus != 0
|
40
41
|
end
|
41
|
-
|
42
|
-
# -------------------------------------------------------------------------
|
42
|
+
|
43
43
|
# -------------------------------------------------------------------------
|
44
44
|
def remove_section(section)
|
45
45
|
execute_command("config #{@location} --remove-section #{section}")
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
module Gitit
|
3
|
+
|
4
|
+
module GitExecutor
|
5
|
+
|
6
|
+
attr_reader :repo
|
7
|
+
|
8
|
+
def self.repo
|
9
|
+
@repo
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute_command(command)
|
13
|
+
git_command = ['git', command].join(' ')
|
14
|
+
`(cd #{@repo.location} && #{git_command} 2>&1)`
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
@@ -4,7 +4,7 @@ module Gitit
|
|
4
4
|
|
5
5
|
# ---------------------------------------------------------------------------
|
6
6
|
# ---------------------------------------------------------------------------
|
7
|
-
class
|
7
|
+
class GitRepo
|
8
8
|
attr_reader :location;
|
9
9
|
|
10
10
|
# -------------------------------------------------------------------------
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require 'gitit/
|
1
|
+
require 'gitit/git_executor'
|
2
2
|
|
3
3
|
module Gitit
|
4
4
|
|
5
5
|
# ---------------------------------------------------------------------------
|
6
6
|
# ---------------------------------------------------------------------------
|
7
|
-
class
|
8
|
-
include
|
7
|
+
class GitStatus
|
8
|
+
include GitExecutor
|
9
9
|
|
10
10
|
# -------------------------------------------------------------------------
|
11
11
|
# -------------------------------------------------------------------------
|
data/lib/gitit/version.rb
CHANGED
data/spec/gitit_branch_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
3
3
|
module Gitit
|
4
4
|
|
5
|
-
describe
|
5
|
+
describe 'GitBranchSpec' do
|
6
6
|
|
7
7
|
# -------------------------------------------------------------------------
|
8
8
|
# -------------------------------------------------------------------------
|
@@ -13,7 +13,7 @@ module Gitit
|
|
13
13
|
git = Git.new(TEST_REPO_PATH)
|
14
14
|
@my_repo = git.repo
|
15
15
|
@my_repo.init
|
16
|
-
@
|
16
|
+
@repo_branch = Gitit::GitBranch.new(@my_repo, 'master')
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'will tell us if the branch is a valid branch' do
|
data/spec/gitit_branches_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
3
3
|
module Gitit
|
4
4
|
|
5
|
-
describe
|
5
|
+
describe GitBranches do
|
6
6
|
|
7
7
|
# -------------------------------------------------------------------------
|
8
8
|
# -------------------------------------------------------------------------
|
@@ -13,12 +13,12 @@ module Gitit
|
|
13
13
|
git = Git.new(TEST_REPO_PATH)
|
14
14
|
@my_repo = git.repo
|
15
15
|
@my_repo.init
|
16
|
-
@
|
16
|
+
@repo_branches = git.branches
|
17
17
|
|
18
18
|
`(cd #{TEST_REPO_PATH} && git config user.email "you@example.com")`
|
19
19
|
`(cd #{TEST_REPO_PATH} && git config user.name "example")`
|
20
20
|
|
21
|
-
File.open("#{TEST_REPO_PATH}/out.txt",
|
21
|
+
File.open("#{TEST_REPO_PATH}/out.txt", 'w+') { |file| file.write('boo!') }
|
22
22
|
`(cd #{TEST_REPO_PATH} && git add #{TEST_REPO_PATH}/out.txt && git commit -am "wip")`
|
23
23
|
|
24
24
|
`(mkdir -p #{TEST_REPO_PATH_BARE} && cd #{TEST_REPO_PATH_BARE} && git init --bare)`
|
@@ -28,24 +28,24 @@ module Gitit
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'will successfully find a valid local branch' do
|
31
|
-
@
|
31
|
+
expect(@repo_branches.exists_locally?('master')).to be_truthy
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'will fail to find an invalid local branch' do
|
35
|
-
@
|
35
|
+
expect(@repo_branches.exists_locally?('some_random_name')).to be_falsey
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'will successfully find a valid remote branch' do
|
39
|
-
@
|
39
|
+
expect(@repo_branches.exists_remotely?('master', 'origin')).to be_truthy
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'will fail to find an invalid remote branch' do
|
43
|
-
@
|
43
|
+
expect(@repo_branches.exists_remotely?('some_random_name', 'origin')).to be_falsey
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'will successfully return the right branch name' do
|
47
47
|
`(cd #{TEST_REPO_PATH} && git checkout master --quiet)`
|
48
|
-
@
|
48
|
+
expect(@repo_branches.get_current_branch).to eq('master')
|
49
49
|
end
|
50
50
|
|
51
51
|
after(:each) do
|
@@ -64,9 +64,9 @@ module Gitit
|
|
64
64
|
git = Git.new(TEST_REPO_PATH)
|
65
65
|
@my_repo = git.repo
|
66
66
|
@my_repo.init
|
67
|
-
@
|
67
|
+
@repo_branches = git.branches
|
68
68
|
|
69
|
-
File.open("#{TEST_REPO_PATH}/out.txt",
|
69
|
+
File.open("#{TEST_REPO_PATH}/out.txt", 'w+') { |file| file.write('boo!') }
|
70
70
|
`(cd #{TEST_REPO_PATH} && git add #{TEST_REPO_PATH}/out.txt && git commit -am "wip")`
|
71
71
|
|
72
72
|
`(mkdir -p #{TEST_REPO_PATH_BARE} && cd #{TEST_REPO_PATH_BARE} && git init --bare)`
|
@@ -76,35 +76,35 @@ module Gitit
|
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'will fail to create a local branch' do
|
79
|
-
@
|
80
|
-
@
|
79
|
+
expect(@repo_branches.create_local_branch('mybranch')).to be_truthy
|
80
|
+
expect(@repo_branches.create_local_branch('mybranch')).to be_falsey
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'will create a local branch successfully' do
|
84
|
-
@
|
85
|
-
@
|
86
|
-
@
|
84
|
+
expect(@repo_branches.create_local_branch('mybranch')).to be_truthy
|
85
|
+
expect(@repo_branches.exists_locally?('mybranch')).to be_truthy
|
86
|
+
expect(@repo_branches.exists_remotely?('mybranch', 'origin')).to be_falsey
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'will fail to push a local branch to an invalid remote' do
|
90
|
-
@
|
91
|
-
@
|
92
|
-
@
|
93
|
-
@
|
90
|
+
expect(@repo_branches.create_local_branch('mybranch')).to be_truthy
|
91
|
+
expect(@repo_branches.exists_remotely?('mybranch', 'origin')).to be_falsey
|
92
|
+
expect(@repo_branches.push_local_branch_to_remote('mybranch', 'badorigin', false)).to be_falsey
|
93
|
+
expect(@repo_branches.exists_remotely?('mybranch', 'origin')).to be_falsey
|
94
94
|
end
|
95
95
|
|
96
96
|
it 'will push a local branch to the remote not forcing it' do
|
97
|
-
@
|
98
|
-
@
|
99
|
-
@
|
100
|
-
@
|
97
|
+
expect(@repo_branches.create_local_branch('mybranch')).to be_truthy
|
98
|
+
expect(@repo_branches.exists_remotely?('mybranch', 'origin')).to be_falsey
|
99
|
+
expect(@repo_branches.push_local_branch_to_remote('mybranch', 'origin', false)).to be_truthy
|
100
|
+
expect(@repo_branches.exists_remotely?('mybranch', 'origin')).to be_truthy
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'will push a local branch to the remote forcing it' do
|
104
|
-
@
|
105
|
-
@
|
106
|
-
@
|
107
|
-
@
|
104
|
+
expect(@repo_branches.create_local_branch('mybranch')).to be_truthy
|
105
|
+
expect(@repo_branches.exists_remotely?('mybranch', 'origin')).to be_falsey
|
106
|
+
expect(@repo_branches.push_local_branch_to_remote('mybranch', 'origin', true)).to be_truthy
|
107
|
+
expect(@repo_branches.exists_remotely?('mybranch', 'origin')).to be_truthy
|
108
108
|
end
|
109
109
|
|
110
110
|
after(:each) do
|
data/spec/gitit_config_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
3
3
|
module Gitit
|
4
4
|
|
5
|
-
describe
|
5
|
+
describe GitConfig do
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
# -----------------------------------------------------------------------------
|
@@ -20,7 +20,7 @@ module Gitit
|
|
20
20
|
FileUtils.mkpath TEST_REPO_PATH
|
21
21
|
@git = Git.new(TEST_REPO_PATH)
|
22
22
|
@git.repo.init
|
23
|
-
@config =
|
23
|
+
@config = GitConfig.new(@git.repo, location: mode)
|
24
24
|
|
25
25
|
@key_name = 'bla'
|
26
26
|
@key = key_section + '.' + @key_name
|
@@ -29,7 +29,7 @@ module Gitit
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'will set the specified key to the specified value successfully' do
|
32
|
-
|
32
|
+
expect{@config.set_value(@key, @key_value)}.to_not raise_error
|
33
33
|
|
34
34
|
`(git config #{mode} --unset #{@key})`
|
35
35
|
`(cd #{TEST_REPO_PATH} && git config #{mode} --remove-section #{key_section})`
|
@@ -37,27 +37,27 @@ module Gitit
|
|
37
37
|
|
38
38
|
it 'will retrieve the specified value successfully' do
|
39
39
|
value = ''
|
40
|
-
|
41
|
-
|
42
|
-
value.
|
40
|
+
expect{@config.set_value(@key, @key_value)}.to_not raise_error
|
41
|
+
expect{value = @config.get_value(@key)}.to_not raise_error
|
42
|
+
expect(value).to eq(@key_value)
|
43
43
|
|
44
44
|
`(git config #{mode} --unset #{@key})`
|
45
45
|
`(cd #{TEST_REPO_PATH} && git config #{mode} --remove-section #{key_section})`
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'will unset the specified key successfully' do
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
expect{@config.set_value(@key, @key_value)}.to_not raise_error
|
50
|
+
expect{@config.unset_value(@key)}.to_not raise_error
|
51
|
+
expect{@config.get_value(@key)}.to raise_error
|
52
52
|
|
53
53
|
`(cd #{TEST_REPO_PATH} && git config #{mode} --remove-section #{key_section})`
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'will remove the specified section successfully' do
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
expect{@config.set_value(@key, @key_value)}.to_not raise_error
|
58
|
+
expect{@config.unset_value(@key)}.to_not raise_error
|
59
|
+
expect{@config.remove_section(key_section)}.to_not raise_error
|
60
|
+
expect{@config.get_value(@key)}.to raise_error
|
61
61
|
end
|
62
62
|
|
63
63
|
after(:each) do
|
data/spec/gitit_spec.rb
CHANGED
@@ -2,36 +2,31 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
3
3
|
module Gitit
|
4
4
|
|
5
|
-
describe
|
5
|
+
describe GitRepo do
|
6
6
|
|
7
7
|
# -------------------------------------------------------------------------
|
8
8
|
# -------------------------------------------------------------------------
|
9
9
|
describe '#initialize' do
|
10
10
|
|
11
|
-
TMP_PATH = '/tmp/'
|
12
|
-
BAD_PATH = '/adsdsadasdsa'
|
13
|
-
TEST_REPO_PATH = '/tmp/test_git'
|
14
|
-
TEST_REPO_PATH_BARE = '/tmp/test_git_bare'
|
15
|
-
|
16
11
|
before(:each) do
|
17
12
|
end
|
18
13
|
|
19
14
|
it 'will open fine given a valid repo' do
|
20
|
-
|
15
|
+
expect { Git.new(Dir.pwd) }.to_not raise_exception
|
21
16
|
end
|
22
17
|
|
23
18
|
it 'will throw an error given an invalid repo' do
|
24
|
-
|
19
|
+
expect { Git.new(BAD_PATH) }.to raise_exception
|
25
20
|
end
|
26
21
|
|
27
22
|
it 'will return true on valid repo' do
|
28
|
-
|
29
|
-
|
23
|
+
my_repo = Git.new(Dir.pwd).repo
|
24
|
+
expect(my_repo.valid?).to be_truthy
|
30
25
|
end
|
31
26
|
|
32
27
|
it 'will return false on invalid repo' do
|
33
|
-
|
34
|
-
|
28
|
+
my_repo = Git.new(TMP_PATH).repo
|
29
|
+
expect(my_repo.valid?).to be_falsey
|
35
30
|
end
|
36
31
|
|
37
32
|
end
|
@@ -47,15 +42,15 @@ module Gitit
|
|
47
42
|
end
|
48
43
|
|
49
44
|
it 'will initialize a new repo on an existing folder' do
|
50
|
-
@my_repo.valid
|
51
|
-
|
45
|
+
expect(@my_repo.valid?).to be_falsey
|
46
|
+
expect { @my_repo.init }.to_not raise_exception
|
52
47
|
end
|
53
48
|
|
54
49
|
it 'will fail to initialize a new repo on an existing folder already initialized' do
|
55
|
-
@my_repo.valid
|
56
|
-
|
57
|
-
@my_repo.valid
|
58
|
-
|
50
|
+
expect(@my_repo.valid?).to be_falsey
|
51
|
+
expect { @my_repo.init }.to_not raise_exception
|
52
|
+
expect(@my_repo.valid?).to be_truthy
|
53
|
+
expect { @my_repo.init }.to raise_exception
|
59
54
|
end
|
60
55
|
|
61
56
|
after(:each) do
|
data/spec/gitit_status_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
|
4
4
|
module Gitit
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe GitStatus do
|
7
7
|
|
8
8
|
# -------------------------------------------------------------------------
|
9
9
|
# -------------------------------------------------------------------------
|
@@ -22,15 +22,15 @@ module Gitit
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'will tell us that the current branch is clean when nothing has been changed' do
|
25
|
-
@repo_status.clean
|
25
|
+
expect(@repo_status.clean?).to be_truthy
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'will tell us that the current branch is not clean when there are untracked file' do
|
29
29
|
File.open("#{TEST_REPO_PATH}/out.txt", 'w+') { |file| file.write('boo!') }
|
30
|
-
@repo_status.untracked_files
|
31
|
-
@repo_status.unstaged_files
|
32
|
-
@repo_status.uncommited_files
|
33
|
-
@repo_status.clean
|
30
|
+
expect(@repo_status.untracked_files?).to be_truthy
|
31
|
+
expect(@repo_status.unstaged_files?).to be_falsey
|
32
|
+
expect(@repo_status.uncommited_files?).to be_falsey
|
33
|
+
expect(@repo_status.clean?).to be_falsey
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'will tell us that the current branch is not clean when there are unstaged file' do
|
@@ -38,10 +38,10 @@ module Gitit
|
|
38
38
|
`(cd #{TEST_REPO_PATH} && git add #{TEST_REPO_PATH}/out.txt)`
|
39
39
|
`(cd #{TEST_REPO_PATH} && git commit -am "wip")`
|
40
40
|
File.open("#{TEST_REPO_PATH}/out.txt", 'w') { |file| file.write('bdssdsoo!') }
|
41
|
-
@repo_status.untracked_files
|
42
|
-
@repo_status.unstaged_files
|
43
|
-
@repo_status.uncommited_files
|
44
|
-
@repo_status.clean
|
41
|
+
expect(@repo_status.untracked_files?).to be_falsey
|
42
|
+
expect(@repo_status.unstaged_files?).to be_truthy
|
43
|
+
expect(@repo_status.uncommited_files?).to be_falsey
|
44
|
+
expect(@repo_status.clean?).to be_falsey
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'will tell us that the current branch is not clean when there are uncommited file' do
|
@@ -50,23 +50,23 @@ module Gitit
|
|
50
50
|
`(cd #{TEST_REPO_PATH} && git commit -am "wip")`
|
51
51
|
File.open("#{TEST_REPO_PATH}/out.txt", 'w') { |file| file.write('bdssdsoo!') }
|
52
52
|
`(cd #{TEST_REPO_PATH} && git add #{TEST_REPO_PATH}/out.txt)`
|
53
|
-
@repo_status.untracked_files
|
54
|
-
@repo_status.unstaged_files
|
55
|
-
@repo_status.uncommited_files
|
56
|
-
@repo_status.clean
|
53
|
+
expect(@repo_status.untracked_files?).to be_falsey
|
54
|
+
expect(@repo_status.unstaged_files?).to be_falsey
|
55
|
+
expect(@repo_status.uncommited_files?).to be_truthy
|
56
|
+
expect(@repo_status.clean?).to be_falsey
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'will tell us that there are untracked files after adding a new file' do
|
60
60
|
File.open("#{TEST_REPO_PATH}/out.txt", 'w+') { |file| file.write('boo!') }
|
61
|
-
@repo_status.untracked_files
|
61
|
+
expect(@repo_status.untracked_files?).to be_truthy
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'will tell us that there are unstage files after modifying a file' do
|
65
|
-
File.open("#{TEST_REPO_PATH}/out.txt",
|
65
|
+
File.open("#{TEST_REPO_PATH}/out.txt", 'w+') { |file| file.write('boo!') }
|
66
66
|
`(cd #{TEST_REPO_PATH} && git add #{TEST_REPO_PATH}/out.txt)`
|
67
67
|
`(cd #{TEST_REPO_PATH} && git commit -am "wip")`
|
68
68
|
File.open("#{TEST_REPO_PATH}/out.txt", 'w') { |file| file.write('bdssdsoo!') }
|
69
|
-
@repo_status.unstaged_files
|
69
|
+
expect(@repo_status.unstaged_files?).to be_truthy
|
70
70
|
end
|
71
71
|
|
72
72
|
it 'will tell us if there are uncommit files after adding a modified file to staging' do
|
@@ -75,7 +75,7 @@ module Gitit
|
|
75
75
|
`(cd #{TEST_REPO_PATH} && git commit -am "wip")`
|
76
76
|
File.open("#{TEST_REPO_PATH}/out.txt", 'w') { |file| file.write('bdssdsoo!') }
|
77
77
|
`(cd #{TEST_REPO_PATH} && git add #{TEST_REPO_PATH}/out.txt)`
|
78
|
-
@repo_status.uncommited_files
|
78
|
+
expect(@repo_status.uncommited_files?).to be_truthy
|
79
79
|
end
|
80
80
|
|
81
81
|
after(:each) do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.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:
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
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: :development
|
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: cli-colorize
|
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: :development
|
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: rdoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.12'
|
48
48
|
type: :development
|
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: '3.12'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: cucumber
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.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: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.0.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.0.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: ruby
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: builder
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
description: '"ruby git command line wrapper"'
|
@@ -129,11 +129,10 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
-
- .document
|
133
|
-
- .gitignore
|
134
|
-
- .
|
135
|
-
- .
|
136
|
-
- .travis.yml
|
132
|
+
- ".document"
|
133
|
+
- ".gitignore"
|
134
|
+
- ".rspec"
|
135
|
+
- ".travis.yml"
|
137
136
|
- Gemfile
|
138
137
|
- LICENSE.txt
|
139
138
|
- README.md
|
@@ -146,14 +145,13 @@ files:
|
|
146
145
|
- gitit.gemspec
|
147
146
|
- gitit.gemspecbak
|
148
147
|
- lib/gitit.rb
|
149
|
-
- lib/gitit/command_branch.rb
|
150
|
-
- lib/gitit/command_branches.rb
|
151
|
-
- lib/gitit/command_config.rb
|
152
|
-
- lib/gitit/command_executor.rb
|
153
|
-
- lib/gitit/command_status.rb
|
154
|
-
- lib/gitit/foo.rb
|
155
148
|
- lib/gitit/git.rb
|
156
|
-
- lib/gitit/
|
149
|
+
- lib/gitit/git_branch.rb
|
150
|
+
- lib/gitit/git_branches.rb
|
151
|
+
- lib/gitit/git_config.rb
|
152
|
+
- lib/gitit/git_executor.rb
|
153
|
+
- lib/gitit/git_repo.rb
|
154
|
+
- lib/gitit/git_status.rb
|
157
155
|
- lib/gitit/version.rb
|
158
156
|
- lib/tasks/version.rake
|
159
157
|
- spec/gitit_branch_spec.rb
|
@@ -172,17 +170,17 @@ require_paths:
|
|
172
170
|
- lib
|
173
171
|
required_ruby_version: !ruby/object:Gem::Requirement
|
174
172
|
requirements:
|
175
|
-
- -
|
173
|
+
- - ">="
|
176
174
|
- !ruby/object:Gem::Version
|
177
175
|
version: '0'
|
178
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
177
|
requirements:
|
180
|
-
- -
|
178
|
+
- - ">="
|
181
179
|
- !ruby/object:Gem::Version
|
182
180
|
version: '0'
|
183
181
|
requirements: []
|
184
182
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
183
|
+
rubygems_version: 2.4.8
|
186
184
|
signing_key:
|
187
185
|
specification_version: 4
|
188
186
|
summary: ''
|
data/.idea/dictionaries/pat.xml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
<component name="ProjectDictionaryState">
|
2
|
-
<dictionary name="pat">
|
3
|
-
<words>
|
4
|
-
<w>adsdsadasdsa</w>
|
5
|
-
<w>badorigin</w>
|
6
|
-
<w>bdssdsoo</w>
|
7
|
-
<w>dsaadk</w>
|
8
|
-
<w>gitit</w>
|
9
|
-
<w>mybranch</w>
|
10
|
-
<w>mytestkey</w>
|
11
|
-
<w>uncommit</w>
|
12
|
-
<w>uncommited</w>
|
13
|
-
<w>unstage</w>
|
14
|
-
<w>unstaged</w>
|
15
|
-
<w>untracked</w>
|
16
|
-
<w>withsub</w>
|
17
|
-
</words>
|
18
|
-
</dictionary>
|
19
|
-
</component>
|