giternal 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/{spec/spec.opts → .rspec} +0 -0
- data/README.rdoc +9 -1
- data/Rakefile +19 -28
- data/UPGRADING.rdoc +17 -0
- data/VERSION.yml +3 -2
- data/bin/giternal +3 -1
- data/features/checking_out_externals.feature +27 -1
- data/features/freeze_externals.feature +8 -1
- data/features/steps/repository_steps.rb +26 -13
- data/features/unfreeze_externals.feature +13 -2
- data/giternal.gemspec +39 -46
- data/lib/giternal/app.rb +34 -10
- data/lib/giternal/repository.rb +23 -15
- data/lib/giternal/yaml_config.rb +9 -0
- data/spec/giternal/app_spec.rb +1 -1
- data/spec/giternal/repository_spec.rb +29 -5
- data/{giternal_helper.rb → spec/giternal_helper.rb} +7 -7
- data/spec/spec_helper.rb +5 -8
- metadata +29 -31
- data/.gitignore +0 -4
data/{spec/spec.opts → .rspec}
RENAMED
File without changes
|
data/README.rdoc
CHANGED
@@ -70,6 +70,14 @@ version. If not, look at what it would take to take for my code and
|
|
70
70
|
the library code to work. If I feel like I can do it, I do, otherwise
|
71
71
|
I unfreeze and stay on the older working version.
|
72
72
|
|
73
|
+
= THANK YOUs
|
74
|
+
|
75
|
+
Rollcall of awesome people who have contributed to giternal:
|
76
|
+
|
77
|
+
Brian Takita & Honkster Team - ability to specify individual repos for
|
78
|
+
freeze/unfreeze/update
|
79
|
+
|
80
|
+
|
73
81
|
== Copyright
|
74
82
|
|
75
|
-
Copyright (c) 2009 Pat Maddox. See LICENSE for details.
|
83
|
+
Copyright (c) 2009-2011 Pat Maddox. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -4,31 +4,23 @@ require 'rake'
|
|
4
4
|
begin
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "giternal"
|
7
|
+
gem.name = "#{ENV["GEM_PREFIX"]}giternal"
|
8
8
|
gem.summary = %Q{Non-sucky git externals}
|
9
9
|
gem.description = %Q{Giternal provides dead-simple management of external git dependencies. It only stores a small bit of metadata, letting you actively develop in any of the repos. Come deploy time, you can easily freeze freeze all the dependencies to particular versions}
|
10
10
|
gem.email = "pat.maddox@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/
|
11
|
+
gem.homepage = "http://github.com/patmaddox/giternal"
|
12
12
|
gem.authors = ["Pat Maddox"]
|
13
|
-
gem.add_development_dependency "rspec"
|
14
|
-
gem.add_development_dependency "cucumber"
|
13
|
+
gem.add_development_dependency "rspec", "~> 2"
|
14
|
+
gem.add_development_dependency "cucumber", "~> 1"
|
15
|
+
gem.post_install_message = "** IMPORTANT - Please see UPGRADING.rdoc for important changes **"
|
15
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
17
|
end
|
17
18
|
rescue LoadError
|
18
19
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
20
|
end
|
20
21
|
|
21
|
-
require '
|
22
|
-
|
23
|
-
spec.libs << 'lib' << 'spec'
|
24
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
-
end
|
26
|
-
|
27
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
-
spec.libs << 'lib' << 'spec'
|
29
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
-
spec.rcov = true
|
31
|
-
end
|
22
|
+
require 'rspec/core/rake_task'
|
23
|
+
RSpec::Core::RakeTask.new(:spec)
|
32
24
|
|
33
25
|
task :spec => :check_dependencies
|
34
26
|
|
@@ -45,16 +37,15 @@ end
|
|
45
37
|
|
46
38
|
task :default => [:spec, :features]
|
47
39
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
rdoc.
|
57
|
-
rdoc.
|
58
|
-
rdoc.rdoc_files.include('
|
59
|
-
|
60
|
-
end
|
40
|
+
#Rake::RDocTask.new do |rdoc|
|
41
|
+
# if File.exist?('VERSION')
|
42
|
+
# version = File.read('VERSION')
|
43
|
+
# else
|
44
|
+
# version = ""
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# rdoc.rdoc_dir = 'rdoc'
|
48
|
+
# rdoc.title = "giternal #{version}"
|
49
|
+
# rdoc.rdoc_files.include('README*')
|
50
|
+
# rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
+
#end
|
data/UPGRADING.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Upgrading giternal
|
2
|
+
|
3
|
+
## 0.1.0 -> *
|
4
|
+
|
5
|
+
0.1.0 has a nasty bug that corrupts a checked out external's .git
|
6
|
+
repository. This happens because giternal sorts the files in .git before piping
|
7
|
+
them to tar, in order to minimize repo bloat. Unfortunately, tar doesn't seem to
|
8
|
+
like that, and so when unfreezing the repository it loses many of the files in
|
9
|
+
.git/objects. Instant repository corruption.
|
10
|
+
|
11
|
+
### What you can do
|
12
|
+
|
13
|
+
The best thing to do is probably to wipe your external dir and do a giternal
|
14
|
+
update. This will check out a fresh copy of the dependency, along with its
|
15
|
+
uncorrupted git repo.
|
16
|
+
|
17
|
+
I don't actually think there's anything else you can do. Sorry :(
|
data/VERSION.yml
CHANGED
data/bin/giternal
CHANGED
@@ -9,9 +9,11 @@ action = ARGV[0]
|
|
9
9
|
available_actions = %w(update freeze unfreeze)
|
10
10
|
unless available_actions.include?(action)
|
11
11
|
puts "Usage: giternal (#{available_actions.join(':')})"
|
12
|
+
puts ""
|
13
|
+
puts File.read(File.dirname(__FILE__) + '/../README.rdoc')
|
12
14
|
exit 1
|
13
15
|
end
|
14
16
|
|
15
17
|
Giternal::Repository.verbose = true
|
16
18
|
app = Giternal::App.new(FileUtils.pwd)
|
17
|
-
app.run(
|
19
|
+
app.run(*ARGV)
|
@@ -22,4 +22,30 @@ Feature: Checking out and updating externals
|
|
22
22
|
And content is added to 'first_external'
|
23
23
|
Then 'first_external' should not be up to date
|
24
24
|
When I update the externals
|
25
|
-
Then 'first_external' should be up to date
|
25
|
+
Then 'first_external' should be up to date
|
26
|
+
|
27
|
+
Scenario: Two Repositories checked out and one updated
|
28
|
+
Given an external repository named 'first_external'
|
29
|
+
And an external repository named 'second_external'
|
30
|
+
And the externals are up to date
|
31
|
+
And content is added to 'first_external'
|
32
|
+
And content is added to 'second_external'
|
33
|
+
Then 'first_external' should not be up to date
|
34
|
+
And 'second_external' should not be up to date
|
35
|
+
When I update the external 'second_external'
|
36
|
+
Then 'first_external' should not be up to date
|
37
|
+
And 'second_external' should be up to date
|
38
|
+
|
39
|
+
Scenario: One repo frozen, one repo unfrozen, and all updated
|
40
|
+
Given an external repository named 'first_external'
|
41
|
+
And an external repository named 'second_external'
|
42
|
+
And the externals are up to date
|
43
|
+
And the externals are frozen
|
44
|
+
And content is added to 'first_external'
|
45
|
+
And content is added to 'second_external'
|
46
|
+
Then 'first_external' should not be up to date
|
47
|
+
And 'second_external' should not be up to date
|
48
|
+
When I unfreeze the external 'second_external'
|
49
|
+
And I update the externals
|
50
|
+
Then 'first_external' should not be up to date
|
51
|
+
And 'second_external' should be up to date
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Feature: Freeze externals
|
2
2
|
As a developer
|
3
3
|
I want to freeze externals
|
4
4
|
So that I can test and deploy my app with no worries
|
@@ -17,3 +17,10 @@ Story: Freeze externals
|
|
17
17
|
When I freeze the externals
|
18
18
|
Then 'first_external' should be added to the commit index
|
19
19
|
|
20
|
+
Scenario: Main project has two externals
|
21
|
+
Given an external repository named 'first_external'
|
22
|
+
And an external repository named 'second_external'
|
23
|
+
And the externals are up to date
|
24
|
+
When I freeze the external 'second_external'
|
25
|
+
Then 'second_external' should be added to the commit index
|
26
|
+
And 'first_external' should be removed from the commit index
|
@@ -1,29 +1,30 @@
|
|
1
|
-
require '
|
1
|
+
require 'rspec'
|
2
2
|
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
3
|
require 'giternal'
|
4
|
+
$:.unshift(File.dirname(__FILE__) + '/../../spec')
|
4
5
|
require 'giternal_helper'
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
File.directory?(GiternalHelper.checked_out_path(
|
9
|
-
|
10
|
-
GiternalHelper.repo_contents(GiternalHelper.external_path(
|
7
|
+
RSpec::Matchers.define :be_up_to_date do
|
8
|
+
match do |actual_repo_name|
|
9
|
+
File.directory?(GiternalHelper.checked_out_path(actual_repo_name)) &&
|
10
|
+
GiternalHelper.repo_contents(GiternalHelper.checked_out_path(actual_repo_name)) ==
|
11
|
+
GiternalHelper.repo_contents(GiternalHelper.external_path(actual_repo_name))
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
File.directory?(GiternalHelper.checked_out_path(
|
15
|
+
RSpec::Matchers.define :be_a_git_repo do
|
16
|
+
match do |actual_repo_name|
|
17
|
+
File.directory?(GiternalHelper.checked_out_path(actual_repo_name) + '/.git')
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
RSpec::Matchers.define :be_added_to_commit_index do
|
22
|
+
match do |actual_repo_name|
|
22
23
|
Dir.chdir(GiternalHelper.tmp_path + '/main_repo') do
|
23
24
|
status = `git status`
|
24
25
|
flattened_status = status.split("\n").join(" ")
|
25
|
-
to_be_committed_regex = /new file:\W+dependencies\/#{
|
26
|
-
untracked_files_regex = /Untracked files:.*#{
|
26
|
+
to_be_committed_regex = /new file:\W+dependencies\/#{actual_repo_name}/
|
27
|
+
untracked_files_regex = /Untracked files:.*#{actual_repo_name}/
|
27
28
|
status =~ to_be_committed_regex && !(flattened_status =~ untracked_files_regex)
|
28
29
|
end
|
29
30
|
end
|
@@ -68,14 +69,26 @@ When "I update the externals" do
|
|
68
69
|
GiternalHelper.update_externals
|
69
70
|
end
|
70
71
|
|
72
|
+
When /I update the external '(.*)'/ do |external_name|
|
73
|
+
GiternalHelper.update_externals("dependencies/#{external_name}")
|
74
|
+
end
|
75
|
+
|
71
76
|
When "I freeze the externals" do
|
72
77
|
GiternalHelper.freeze_externals
|
73
78
|
end
|
74
79
|
|
80
|
+
When /I freeze the external '(.*)'/ do |external_name|
|
81
|
+
GiternalHelper.freeze_externals("dependencies/#{external_name}")
|
82
|
+
end
|
83
|
+
|
75
84
|
When "I unfreeze the externals" do
|
76
85
|
GiternalHelper.unfreeze_externals
|
77
86
|
end
|
78
87
|
|
88
|
+
When /I unfreeze the external '(.*)'/ do |external_name|
|
89
|
+
GiternalHelper.unfreeze_externals("dependencies/#{external_name}")
|
90
|
+
end
|
91
|
+
|
79
92
|
Then /'(.*)' should be checked out/ do |repo_name|
|
80
93
|
repo_name.should be_up_to_date
|
81
94
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Feature: Unfreeze externals
|
2
2
|
As a developer
|
3
3
|
I want to unfreeze externals
|
4
4
|
So that I can continue to update and develop on them
|
@@ -9,4 +9,15 @@ Story: Unfreeze externals
|
|
9
9
|
And the externals are frozen
|
10
10
|
When I unfreeze the externals
|
11
11
|
Then 'first_external' should be a git repo
|
12
|
-
And 'first_external' should be removed from the commit index
|
12
|
+
And 'first_external' should be removed from the commit index
|
13
|
+
|
14
|
+
Scenario: Main project has two frozen externals
|
15
|
+
Given an external repository named 'first_external'
|
16
|
+
And an external repository named 'second_external'
|
17
|
+
And the externals are up to date
|
18
|
+
And the externals are frozen
|
19
|
+
When I unfreeze the external 'second_external'
|
20
|
+
Then 'second_external' should be a git repo
|
21
|
+
And 'second_external' should be removed from the commit index
|
22
|
+
And 'first_external' should no longer be a git repo
|
23
|
+
And 'first_external' should be added to the commit index
|
data/giternal.gemspec
CHANGED
@@ -1,74 +1,67 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{giternal}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Pat Maddox"]
|
12
|
-
s.date = %q{
|
13
|
-
s.default_executable = %q{giternal}
|
12
|
+
s.date = %q{2011-06-24}
|
14
13
|
s.description = %q{Giternal provides dead-simple management of external git dependencies. It only stores a small bit of metadata, letting you actively develop in any of the repos. Come deploy time, you can easily freeze freeze all the dependencies to particular versions}
|
15
14
|
s.email = %q{pat.maddox@gmail.com}
|
16
15
|
s.executables = ["giternal"]
|
17
16
|
s.extra_rdoc_files = [
|
18
17
|
"LICENSE",
|
19
|
-
|
18
|
+
"README.rdoc"
|
20
19
|
]
|
21
20
|
s.files = [
|
22
21
|
".emacs-project",
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
22
|
+
".rspec",
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"UPGRADING.rdoc",
|
27
|
+
"VERSION.yml",
|
28
|
+
"bin/giternal",
|
29
|
+
"features/checking_out_externals.feature",
|
30
|
+
"features/freeze_externals.feature",
|
31
|
+
"features/steps/repository_steps.rb",
|
32
|
+
"features/unfreeze_externals.feature",
|
33
|
+
"giternal.gemspec",
|
34
|
+
"lib/giternal.rb",
|
35
|
+
"lib/giternal/app.rb",
|
36
|
+
"lib/giternal/repository.rb",
|
37
|
+
"lib/giternal/version.rb",
|
38
|
+
"lib/giternal/yaml_config.rb",
|
39
|
+
"spec/giternal/app_spec.rb",
|
40
|
+
"spec/giternal/repository_spec.rb",
|
41
|
+
"spec/giternal/yaml_config_spec.rb",
|
42
|
+
"spec/giternal_helper.rb",
|
43
|
+
"spec/spec_helper.rb",
|
44
|
+
"test_trackers.rb"
|
46
45
|
]
|
47
|
-
s.homepage = %q{http://github.com/
|
48
|
-
s.
|
46
|
+
s.homepage = %q{http://github.com/patmaddox/giternal}
|
47
|
+
s.post_install_message = %q{** IMPORTANT - Please see UPGRADING.rdoc for important changes **}
|
49
48
|
s.require_paths = ["lib"]
|
50
|
-
s.rubygems_version = %q{1.
|
49
|
+
s.rubygems_version = %q{1.7.2}
|
51
50
|
s.summary = %q{Non-sucky git externals}
|
52
|
-
s.test_files = [
|
53
|
-
"spec/giternal/app_spec.rb",
|
54
|
-
"spec/giternal/repository_spec.rb",
|
55
|
-
"spec/giternal/yaml_config_spec.rb",
|
56
|
-
"spec/spec_helper.rb"
|
57
|
-
]
|
58
51
|
|
59
52
|
if s.respond_to? :specification_version then
|
60
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
61
53
|
s.specification_version = 3
|
62
54
|
|
63
|
-
if Gem::Version.new(Gem::
|
64
|
-
s.add_development_dependency(%q<rspec>, ["
|
65
|
-
s.add_development_dependency(%q<cucumber>, ["
|
55
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
+
s.add_development_dependency(%q<rspec>, ["~> 2"])
|
57
|
+
s.add_development_dependency(%q<cucumber>, ["~> 1"])
|
66
58
|
else
|
67
|
-
s.add_dependency(%q<rspec>, ["
|
68
|
-
s.add_dependency(%q<cucumber>, ["
|
59
|
+
s.add_dependency(%q<rspec>, ["~> 2"])
|
60
|
+
s.add_dependency(%q<cucumber>, ["~> 1"])
|
69
61
|
end
|
70
62
|
else
|
71
|
-
s.add_dependency(%q<rspec>, ["
|
72
|
-
s.add_dependency(%q<cucumber>, ["
|
63
|
+
s.add_dependency(%q<rspec>, ["~> 2"])
|
64
|
+
s.add_dependency(%q<cucumber>, ["~> 1"])
|
73
65
|
end
|
74
66
|
end
|
67
|
+
|
data/lib/giternal/app.rb
CHANGED
@@ -4,26 +4,50 @@ module Giternal
|
|
4
4
|
@base_dir = base_dir
|
5
5
|
end
|
6
6
|
|
7
|
-
def update
|
8
|
-
|
7
|
+
def update(*dirs)
|
8
|
+
if dirs.empty?
|
9
|
+
config.each_repo {|r| r.update }
|
10
|
+
else
|
11
|
+
dirs.each do |dir|
|
12
|
+
if repo = config.find_repo(dir)
|
13
|
+
repo.update
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
9
17
|
end
|
10
18
|
|
11
|
-
def freezify
|
12
|
-
|
19
|
+
def freezify(*dirs)
|
20
|
+
if dirs.empty?
|
21
|
+
config.each_repo {|r| r.freezify }
|
22
|
+
else
|
23
|
+
dirs.each do |dir|
|
24
|
+
if repo = config.find_repo(dir)
|
25
|
+
repo.freezify
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
13
29
|
end
|
14
30
|
|
15
|
-
def unfreezify
|
16
|
-
|
31
|
+
def unfreezify(*dirs)
|
32
|
+
if dirs.empty?
|
33
|
+
config.each_repo {|r| r.unfreezify }
|
34
|
+
else
|
35
|
+
dirs.each do |dir|
|
36
|
+
if repo = config.find_repo(dir)
|
37
|
+
repo.unfreezify
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
17
41
|
end
|
18
42
|
|
19
|
-
def run(action)
|
43
|
+
def run(action, *args)
|
20
44
|
case action
|
21
45
|
when "freeze"
|
22
|
-
freezify
|
46
|
+
freezify(*args)
|
23
47
|
when "unfreeze"
|
24
|
-
unfreezify
|
48
|
+
unfreezify(*args)
|
25
49
|
else
|
26
|
-
send(action)
|
50
|
+
send(action, *args)
|
27
51
|
end
|
28
52
|
end
|
29
53
|
|
data/lib/giternal/repository.rb
CHANGED
@@ -24,7 +24,7 @@ module Giternal
|
|
24
24
|
if !File.exist?(repo_path + '/.git')
|
25
25
|
raise "Directory '#{@name}' exists but is not a git repository"
|
26
26
|
else
|
27
|
-
|
27
|
+
update_output { `cd #{repo_path} && git pull 2>&1` }
|
28
28
|
end
|
29
29
|
else
|
30
30
|
update_output { `cd #{checkout_path} && git clone #{@repo_url} #{@name}` }
|
@@ -37,7 +37,7 @@ module Giternal
|
|
37
37
|
|
38
38
|
Dir.chdir(repo_path) do
|
39
39
|
`tar czf .git.frozen.tgz .git`
|
40
|
-
|
40
|
+
FileUtils.rm_r('.git')
|
41
41
|
end
|
42
42
|
`cd #{@base_dir} && git add -f #{rel_repo_path}`
|
43
43
|
true
|
@@ -75,18 +75,26 @@ module Giternal
|
|
75
75
|
@rel_path + '/' + @name
|
76
76
|
end
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
78
|
+
def update_output(&block)
|
79
|
+
puts "Updating #{@name}" if verbose
|
80
|
+
block.call
|
81
|
+
puts " ..updated\n" if verbose
|
82
|
+
end
|
83
|
+
|
84
|
+
def git_ignore_self
|
85
|
+
Dir.chdir(@base_dir) do
|
86
|
+
contents = File.read('.gitignore') if File.exist?('.gitignore')
|
87
|
+
|
88
|
+
unless contents.to_s.include?(rel_repo_path)
|
89
|
+
File.open('.gitignore', 'w') do |file|
|
90
|
+
if contents
|
91
|
+
file << contents
|
92
|
+
file << "\n" unless contents[-1] == 10 # ascii code for \n
|
93
|
+
end
|
94
|
+
file << rel_repo_path << "\n"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
91
99
|
end
|
92
100
|
end
|
data/lib/giternal/yaml_config.rb
CHANGED
@@ -11,6 +11,15 @@ module Giternal
|
|
11
11
|
repositories.each { |r| yield(r) if block_given? }
|
12
12
|
end
|
13
13
|
|
14
|
+
def find_repo(path)
|
15
|
+
@config_hash.each do |name, attributes|
|
16
|
+
if path == File.join(attributes["path"], name)
|
17
|
+
return Repository.new(@base_dir, name, attributes["repo"], attributes["path"])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
return nil
|
21
|
+
end
|
22
|
+
|
14
23
|
private
|
15
24
|
def repositories
|
16
25
|
@config_hash.map do |name, attributes|
|
data/spec/giternal/app_spec.rb
CHANGED
@@ -22,15 +22,31 @@ module Giternal
|
|
22
22
|
Dir.chdir(GiternalHelper.base_project_dir) do
|
23
23
|
# TODO: What I really want is to say it shouldn't include 'foo'
|
24
24
|
`git status`.should_not include('dependencies')
|
25
|
+
File.read('.gitignore').should == "dependencies/foo\n"
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
28
29
|
it "should only add itself to .gitignore if it's not already there" do
|
29
|
-
2.times { @repository.update }
|
30
30
|
Dir.chdir(GiternalHelper.base_project_dir) do
|
31
|
-
File.
|
32
|
-
|
33
|
-
|
31
|
+
File.open('.gitignore', 'w') {|f| f << "dependencies/foo\n" }
|
32
|
+
end
|
33
|
+
|
34
|
+
@repository.update
|
35
|
+
|
36
|
+
Dir.chdir(GiternalHelper.base_project_dir) do
|
37
|
+
File.read('.gitignore').should == "dependencies/foo\n"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it "adds a newline if it needs to" do
|
42
|
+
Dir.chdir(GiternalHelper.base_project_dir) do
|
43
|
+
File.open('.gitignore', 'w') {|f| f << "something/else" }
|
44
|
+
end
|
45
|
+
|
46
|
+
@repository.update
|
47
|
+
|
48
|
+
Dir.chdir(GiternalHelper.base_project_dir) do
|
49
|
+
File.read('.gitignore').should == "something/else\ndependencies/foo\n"
|
34
50
|
end
|
35
51
|
end
|
36
52
|
|
@@ -116,18 +132,26 @@ module Giternal
|
|
116
132
|
GiternalHelper.external_path('external'),
|
117
133
|
'dependencies')
|
118
134
|
@repository.update
|
119
|
-
@repository.freezify
|
120
135
|
end
|
121
136
|
|
122
137
|
it "should unarchive the .git dir" do
|
138
|
+
@repository.freezify
|
123
139
|
@repository.unfreezify
|
124
140
|
File.directory?(GiternalHelper.checked_out_path('external/.git')).should be_true
|
125
141
|
end
|
126
142
|
|
127
143
|
it "should remove the archived file" do
|
144
|
+
@repository.freezify
|
128
145
|
@repository.unfreezify
|
129
146
|
File.file?(GiternalHelper.checked_out_path('external/.git.frozen.tgz')).should be_false
|
130
147
|
end
|
148
|
+
|
149
|
+
it "leaves the .git directory exactly how it found it" do
|
150
|
+
expect {
|
151
|
+
@repository.freezify
|
152
|
+
@repository.unfreezify
|
153
|
+
}.to_not change { Dir[GiternalHelper.checked_out_path('external/.git/**/**')] }
|
154
|
+
end
|
131
155
|
end
|
132
156
|
end
|
133
157
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class GiternalHelper
|
2
|
-
@@giternal_base ||= File.expand_path(File.dirname(__FILE__))
|
2
|
+
@@giternal_base ||= File.expand_path(File.dirname(__FILE__) + '/..')
|
3
3
|
|
4
4
|
def self.create_main_repo
|
5
5
|
FileUtils.mkdir_p tmp_path
|
@@ -69,21 +69,21 @@ class GiternalHelper
|
|
69
69
|
%w(GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE).each {|var| ENV[var] = nil }
|
70
70
|
end
|
71
71
|
|
72
|
-
def self.update_externals
|
72
|
+
def self.update_externals(*args)
|
73
73
|
Dir.chdir(tmp_path + '/main_repo') do
|
74
|
-
GiternalHelper.run('update')
|
74
|
+
GiternalHelper.run('update', *args)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
def self.freeze_externals
|
78
|
+
def self.freeze_externals(*args)
|
79
79
|
Dir.chdir(tmp_path + '/main_repo') do
|
80
|
-
GiternalHelper.run(
|
80
|
+
GiternalHelper.run("freeze", *args)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
def self.unfreeze_externals
|
84
|
+
def self.unfreeze_externals(*args)
|
85
85
|
Dir.chdir(tmp_path + '/main_repo') do
|
86
|
-
GiternalHelper.run(
|
86
|
+
GiternalHelper.run("unfreeze", *args)
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
begin
|
2
|
-
require '
|
2
|
+
require 'rspec'
|
3
3
|
rescue LoadError
|
4
4
|
require 'rubygems'
|
5
|
-
require '
|
5
|
+
require 'rspec'
|
6
6
|
end
|
7
7
|
|
8
8
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
@@ -10,10 +10,7 @@ require 'giternal'
|
|
10
10
|
require 'fileutils'
|
11
11
|
require 'giternal_helper'
|
12
12
|
|
13
|
-
|
14
|
-
GiternalHelper.clean!
|
15
|
-
|
16
|
-
|
17
|
-
Spec::Runner.configuration.after(:each) do
|
18
|
-
GiternalHelper.clean!
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.before { GiternalHelper.clean! }
|
15
|
+
config.after { GiternalHelper.clean! }
|
19
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: giternal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.1
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Pat Maddox
|
@@ -9,29 +10,30 @@ autorequire:
|
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
12
|
|
12
|
-
date:
|
13
|
-
default_executable: giternal
|
13
|
+
date: 2011-06-24 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
20
|
requirements:
|
21
|
-
- -
|
21
|
+
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: "
|
24
|
-
|
23
|
+
version: "2"
|
24
|
+
type: :development
|
25
|
+
version_requirements: *id001
|
25
26
|
- !ruby/object:Gem::Dependency
|
26
27
|
name: cucumber
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
30
31
|
requirements:
|
31
|
-
- -
|
32
|
+
- - ~>
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version: "
|
34
|
-
|
34
|
+
version: "1"
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id002
|
35
37
|
description: Giternal provides dead-simple management of external git dependencies. It only stores a small bit of metadata, letting you actively develop in any of the repos. Come deploy time, you can easily freeze freeze all the dependencies to particular versions
|
36
38
|
email: pat.maddox@gmail.com
|
37
39
|
executables:
|
@@ -43,10 +45,11 @@ extra_rdoc_files:
|
|
43
45
|
- README.rdoc
|
44
46
|
files:
|
45
47
|
- .emacs-project
|
46
|
-
- .
|
48
|
+
- .rspec
|
47
49
|
- LICENSE
|
48
50
|
- README.rdoc
|
49
51
|
- Rakefile
|
52
|
+
- UPGRADING.rdoc
|
50
53
|
- VERSION.yml
|
51
54
|
- bin/giternal
|
52
55
|
- features/checking_out_externals.feature
|
@@ -54,7 +57,6 @@ files:
|
|
54
57
|
- features/steps/repository_steps.rb
|
55
58
|
- features/unfreeze_externals.feature
|
56
59
|
- giternal.gemspec
|
57
|
-
- giternal_helper.rb
|
58
60
|
- lib/giternal.rb
|
59
61
|
- lib/giternal/app.rb
|
60
62
|
- lib/giternal/repository.rb
|
@@ -63,39 +65,35 @@ files:
|
|
63
65
|
- spec/giternal/app_spec.rb
|
64
66
|
- spec/giternal/repository_spec.rb
|
65
67
|
- spec/giternal/yaml_config_spec.rb
|
66
|
-
- spec/
|
68
|
+
- spec/giternal_helper.rb
|
67
69
|
- spec/spec_helper.rb
|
68
70
|
- test_trackers.rb
|
69
|
-
|
70
|
-
homepage: http://github.com/pat-maddox/giternal
|
71
|
+
homepage: http://github.com/patmaddox/giternal
|
71
72
|
licenses: []
|
72
73
|
|
73
|
-
post_install_message:
|
74
|
-
rdoc_options:
|
75
|
-
|
74
|
+
post_install_message: "** IMPORTANT - Please see UPGRADING.rdoc for important changes **"
|
75
|
+
rdoc_options: []
|
76
|
+
|
76
77
|
require_paths:
|
77
78
|
- lib
|
78
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
79
81
|
requirements:
|
80
82
|
- - ">="
|
81
83
|
- !ruby/object:Gem::Version
|
82
84
|
version: "0"
|
83
|
-
version:
|
84
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
85
87
|
requirements:
|
86
88
|
- - ">="
|
87
89
|
- !ruby/object:Gem::Version
|
88
90
|
version: "0"
|
89
|
-
version:
|
90
91
|
requirements: []
|
91
92
|
|
92
93
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.
|
94
|
+
rubygems_version: 1.7.2
|
94
95
|
signing_key:
|
95
96
|
specification_version: 3
|
96
97
|
summary: Non-sucky git externals
|
97
|
-
test_files:
|
98
|
-
|
99
|
-
- spec/giternal/repository_spec.rb
|
100
|
-
- spec/giternal/yaml_config_spec.rb
|
101
|
-
- spec/spec_helper.rb
|
98
|
+
test_files: []
|
99
|
+
|
data/.gitignore
DELETED