winton-externals 0.1.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,31 +1,48 @@
1
+ require 'rubygems'
1
2
  require 'rake'
3
+ require 'rake/gempackagetask'
4
+ require 'spec/rake/spectask'
2
5
 
3
- task :default => 'externals.gemspec'
6
+ GEM_NAME = 'externals'
7
+ PKG_FILES = FileList['**/*'] - FileList['coverage', 'coverage/**/*', 'pkg', 'pkg/**/*']
4
8
 
5
- file 'externals.gemspec' => FileList['{lib,spec}/**','Rakefile'] do |f|
6
- # read spec file and split out manifest section
7
- spec = File.read(f.name)
8
- parts = spec.split(" # = MANIFEST =\n")
9
- fail 'bad spec' if parts.length != 3
10
- # determine file list from git ls-files
11
- files = `git ls-files`.
12
- split("\n").
13
- sort.
14
- reject{ |file| file =~ /^\./ }.
15
- reject { |file| file =~ /^doc/ }.
16
- map{ |file| " #{file}" }.
17
- join("\n")
18
- # piece file back together and write...
19
- parts[1] = " s.files = %w[\n#{files}\n ]\n"
20
- spec = parts.join(" # = MANIFEST =\n")
21
- File.open(f.name, 'w') { |io| io.write(spec) }
22
- puts "Updated #{f.name}"
9
+ spec = Gem::Specification.new do |s|
10
+ s.author = "Winton Welsh"
11
+ s.email = "mail@wintoni.us"
12
+ s.executables << GEM_NAME
13
+ s.extra_rdoc_files = [ "README.markdown" ]
14
+ s.files = PKG_FILES.to_a
15
+ s.has_rdoc = false
16
+ s.homepage = "http://github.com/winton/#{GEM_NAME}"
17
+ s.name = GEM_NAME
18
+ s.platform = Gem::Platform::RUBY
19
+ s.require_path = "lib"
20
+ s.summary = "Work on git externals without affecting others"
21
+ s.version = "1.0.0"
23
22
  end
24
23
 
25
- # sudo rake install
24
+ desc "Package gem"
25
+ Rake::GemPackageTask.new(spec) do |pkg|
26
+ pkg.gem_spec = spec
27
+ end
28
+
29
+ desc "Install gem"
26
30
  task :install do
27
- `sudo gem uninstall externals -x`
28
- `gem build externals.gemspec`
29
- `sudo gem install externals*.gem`
30
- `rm externals*.gem`
31
+ Rake::Task['gem'].invoke
32
+ `sudo gem uninstall #{GEM_NAME} -x`
33
+ `sudo gem install pkg/#{GEM_NAME}*.gem`
34
+ `rm -Rf pkg`
35
+ end
36
+
37
+ desc "Generate gemspec"
38
+ task :gemspec do
39
+ File.open("#{File.dirname(__FILE__)}/#{GEM_NAME}.gemspec", 'w') do |f|
40
+ f.write(spec.to_ruby)
41
+ end
42
+ end
43
+
44
+ desc "Run specs"
45
+ Spec::Rake::SpecTask.new do |t|
46
+ t.spec_opts = ["--format", "specdoc", "--colour"]
47
+ t.spec_files = FileList["spec/**/*_spec.rb"]
31
48
  end
data/externals.gemspec CHANGED
@@ -1,35 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  Gem::Specification.new do |s|
2
- s.name = 'externals'
3
- s.version = '0.1.6'
4
- s.date = '2008-03-12'
5
-
6
- s.summary = "Work on git externals without affecting others"
7
- s.description = "Work on git externals without affecting others"
8
-
9
- s.author = 'Winton Welsh'
10
- s.email = 'mail@wintoni.us'
11
- s.homepage = 'http://github.com/winton/externals'
12
-
4
+ s.name = %q{externals}
5
+ s.version = "1.0.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Winton Welsh"]
9
+ s.date = %q{2009-04-27}
10
+ s.default_executable = %q{externals}
11
+ s.email = %q{mail@wintoni.us}
13
12
  s.executables = ["externals"]
14
- s.has_rdoc = false
15
-
16
- # = MANIFEST =
17
- s.files = %w[
18
- MIT-LICENSE
19
- README.markdown
20
- Rakefile
21
- bin/externals
22
- changelog.markdown
23
- externals.gemspec
24
- lib/externals.rb
25
- lib/externals/app.rb
26
- lib/externals/repository.rb
27
- lib/externals/yaml_config.rb
28
- spec/bin/externals_spec.rb
29
- spec/lib/app_spec.rb
30
- spec/lib/yaml_config_spec.rb
31
- spec/spec.opts
32
- spec/spec_helper.rb
33
- ]
34
- # = MANIFEST =
35
- end
13
+ s.extra_rdoc_files = ["README.markdown"]
14
+ s.files = ["bin", "bin/externals", "externals.gemspec", "lib", "lib/externals", "lib/externals/app.rb", "lib/externals/repository.rb", "lib/externals/yaml_config.rb", "lib/externals.rb", "MIT-LICENSE", "Rakefile", "README.markdown", "spec", "spec/externals", "spec/externals/app_spec.rb", "spec/externals/repository_spec.rb", "spec/externals/yaml_config_spec.rb", "spec/spec.opts", "spec/spec_helper.rb"]
15
+ s.homepage = %q{http://github.com/winton/externals}
16
+ s.require_paths = ["lib"]
17
+ s.rubygems_version = %q{1.3.1}
18
+ s.summary = %q{Work on git externals without affecting others}
19
+
20
+ if s.respond_to? :specification_version then
21
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
22
+ s.specification_version = 2
23
+
24
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25
+ else
26
+ end
27
+ else
28
+ end
29
+ end
data/lib/externals/app.rb CHANGED
@@ -1,44 +1,42 @@
1
1
  module Externals
2
2
  class App
3
+
3
4
  def initialize(base_dir)
4
5
  @base_dir = base_dir
5
6
  end
6
-
7
- def status(filtr = nil)
8
- config.each_repo(filtr) {|r| r.status }
9
- end
10
- alias_method :st, :status
11
-
12
- def freeze(filtr = nil)
13
- config.each_repo(filtr) {|r| r.freeze }
7
+
8
+ def config
9
+ return @config if @config
10
+ config_path = ['config/externals.yml', '.externals.yml'].detect do |file|
11
+ File.exists? File.expand_path(@base_dir + '/' + file)
12
+ end
13
+ @config = YamlConfig.new(@base_dir, config_path)
14
14
  end
15
15
 
16
- def unfreeze(filtr = nil)
17
- config.each_repo(filtr) {|r| r.unfreeze }
16
+ def freeze(filter = nil)
17
+ config.each_repo(filter) { |r| r.freeze }
18
18
  end
19
19
 
20
- def run(action, filtr_str = nil)
21
- available_actions = %w(status freeze unfreeze)
20
+ def run(action, filter_str = nil)
21
+ available_actions = %w(st status fr freeze un unfreeze)
22
22
  if available_actions.include?(action)
23
- filtr = Regexp.new(filtr_str) if filtr_str
24
- send(action, filtr)
23
+ filter = Regexp.new(filter_str) if filter_str
24
+ send(action, filter)
25
25
  else
26
26
  puts "Usage: externals (#{available_actions.join(':')}) optional_regex_string"
27
27
  end
28
28
  end
29
-
30
- def config
31
- return @config if @config
32
-
33
- config_file = ['config/externals.yml', '.externals.yml'].detect do |file|
34
- File.file? File.expand_path(@base_dir + '/' + file)
35
- end
36
-
37
- if config_file.nil?
38
- $stderr.puts "config/externals.yml is missing"
39
- else
40
- @config = YamlConfig.new(@base_dir, File.read(config_file))
41
- end
29
+
30
+ def status(filter = nil)
31
+ config.each_repo(filter) { |r| r.status }
42
32
  end
33
+
34
+ def unfreeze(filter = nil)
35
+ config.each_repo(filter) { |r| r.unfreeze }
36
+ end
37
+
38
+ alias_method :fr, :freeze
39
+ alias_method :st, :status
40
+ alias_method :un, :unfreeze
43
41
  end
44
42
  end
@@ -3,27 +3,19 @@ require 'fileutils'
3
3
  module Externals
4
4
  class Repository
5
5
 
6
+ attr_reader :name
7
+
6
8
  def initialize(base_dir, name, repo_url, rel_path)
7
9
  @base_dir = base_dir
8
10
  @name = name
9
11
  @repo_url = repo_url
10
12
  @rel_path = rel_path
11
13
  end
12
- attr_reader :name
13
14
 
14
- def install
15
- # Create directory that we will clone into
16
- unless File.exist?(checkout_path)
17
- FileUtils.mkdir_p(checkout_path)
18
- end
19
- Dir.chdir(checkout_path) do
20
- # Remove repository if exists
21
- FileUtils.rm_rf(@name)
22
- # Clone repository
23
- `git clone #{@repo_url} #{@name}`
24
- end
15
+ def exists?
16
+ File.exist?(repo_path)
25
17
  end
26
-
18
+
27
19
  def freeze
28
20
  install unless exists?
29
21
  if is_not_a_git_repo?
@@ -40,7 +32,7 @@ module Externals
40
32
  # Make temp directory
41
33
  FileUtils.mkdir_p(temp_path)
42
34
  # Compress .git folder to temp
43
- `tar czf #{temp_path}/#{@name}.git.tgz .git`
35
+ `tar czf #{temp_path}/#{@name}.git.tgz .git` unless $TESTING
44
36
  end
45
37
  # Remove repository's .git folder
46
38
  FileUtils.rm_r('.git')
@@ -49,6 +41,35 @@ module Externals
49
41
  end
50
42
  end
51
43
 
44
+ def install
45
+ # Create directory that we will clone into
46
+ unless File.exist?(checkout_path)
47
+ FileUtils.mkdir_p(checkout_path)
48
+ end
49
+ Dir.chdir(checkout_path) do
50
+ # Remove repository if exists
51
+ FileUtils.rm_rf(@name)
52
+ # Clone repository
53
+ `git clone #{@repo_url} #{@name}` unless $TESTING
54
+ end
55
+ end
56
+
57
+ def is_a_git_repo?
58
+ File.exist?("#{repo_path}/.git")
59
+ end
60
+
61
+ def is_not_a_git_repo?
62
+ !is_a_git_repo?
63
+ end
64
+
65
+ def is_compressed?
66
+ File.exists?("#{temp_path}/#{@name}.git.tgz")
67
+ end
68
+
69
+ def is_not_compressed?
70
+ !is_compressed?
71
+ end
72
+
52
73
  def status
53
74
  if exists?
54
75
  puts "#{@name} is #{is_a_git_repo? ? "not frozen" : "frozen and #{is_compressed? ? "has" : "does not have"} a snapshot"}"
@@ -67,7 +88,7 @@ module Externals
67
88
  if is_compressed?
68
89
  Dir.chdir(temp_path) do
69
90
  # Decompress git snapshot
70
- `tar xzf #{@name}.git.tgz`
91
+ `tar xzf #{@name}.git.tgz` unless $TESTING
71
92
  # Move back to repo
72
93
  FileUtils.mv(".git", repo_path)
73
94
  # Remove snapshot
@@ -75,7 +96,7 @@ module Externals
75
96
  end
76
97
  # Reset repository to snapshot
77
98
  Dir.chdir(repo_path) do
78
- `git reset --hard`
99
+ `git reset --hard` unless $TESTING
79
100
  end
80
101
  else
81
102
  # Clone fresh repo if no snapshot found
@@ -84,28 +105,9 @@ module Externals
84
105
  puts "#{@name} unfrozen"
85
106
  end
86
107
  end
87
-
88
- def exists?
89
- File.exist?(repo_path)
90
- end
91
-
92
- def is_a_git_repo?
93
- File.exist?("#{repo_path}/.git")
94
- end
95
-
96
- def is_not_a_git_repo?
97
- !is_a_git_repo?
98
- end
99
-
100
- def is_compressed?
101
- File.exists?("#{temp_path}/#{@name}.git.tgz")
102
- end
103
-
104
- def is_not_compressed?
105
- !is_compressed?
106
- end
107
108
 
108
109
  private
110
+
109
111
  def checkout_path
110
112
  File.expand_path(File.join(@base_dir, @rel_path))
111
113
  end
@@ -2,19 +2,32 @@ require 'yaml'
2
2
 
3
3
  module Externals
4
4
  class YamlConfig
5
- def initialize(base_dir, yaml_string)
5
+
6
+ attr_reader :repositories
7
+
8
+ def initialize(base_dir, config_path)
6
9
  @base_dir = base_dir
7
- @config_hash = YAML.load yaml_string
8
- end
9
-
10
- def each_repo(filtr = nil)
11
- repositories.each { |r| yield(r) if block_given? and (!filtr or filtr.match(r.name)) }
10
+ if config_path && File.exists?(config_path)
11
+ config = YAML.load(File.read(config_path))
12
+ @repositories = config.map do |name, attributes|
13
+ Repository.new(
14
+ @base_dir,
15
+ name,
16
+ attributes["repo"],
17
+ attributes["path"]
18
+ )
19
+ end
20
+ else
21
+ $stderr.puts "config/externals.yml is missing"
22
+ @repositories = []
23
+ end
12
24
  end
13
25
 
14
- private
15
- def repositories
16
- @config_hash.map do |name, attributes|
17
- Repository.new(@base_dir, name, attributes["repo"], attributes["path"])
26
+ def each_repo(filter = nil)
27
+ repositories.each do |r|
28
+ if block_given? and (!filter or filter.match(r.name))
29
+ yield(r)
30
+ end
18
31
  end
19
32
  end
20
33
  end
@@ -1,43 +1,39 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
2
 
3
3
  module Externals
4
- describe App do
4
+ describe Externals::App do
5
+
5
6
  before(:each) do
6
7
  @app = App.new("some_fake_dir")
7
8
  @mock_config = stub("config", :null_object => true)
8
9
  end
9
10
 
10
11
  describe "loading the config file" do
12
+
11
13
  before(:each) do
12
- File.stub!(:file?).and_return(true)
13
- File.stub!(:read).and_return("yaml config")
14
+ File.stub!(:exists?).and_return(true)
14
15
  YamlConfig.stub!(:new).and_return(@mock_config)
15
16
  end
16
17
 
17
18
  it "should look for config/externals.yml" do
18
- File.should_receive(:file?).with(/some_fake_dir\/config\/externals\.yml/)
19
+ File.should_receive(:exists?).with(/some_fake_dir\/config\/externals\.yml/)
19
20
  @app.config
20
21
  end
21
22
 
22
23
  it "should look for .externals.yml if externals.yml does not exist" do
23
- File.should_receive(:file?).with(/some_fake_dir\/config\/externals\.yml/).and_return(false)
24
- File.should_receive(:file?).with(/some_fake_dir\/\.externals\.yml/).and_return(true)
25
- @app.config
26
- end
27
-
28
- it "should exit with an error when no config file exists" do
29
- File.stub!(:file?).and_return(false)
30
- $stderr.should_receive(:puts)
24
+ File.should_receive(:exists?).with(/some_fake_dir\/config\/externals\.yml/).and_return(false)
25
+ File.should_receive(:exists?).with(/some_fake_dir\/\.externals\.yml/).and_return(true)
31
26
  @app.config
32
27
  end
33
28
 
34
29
  it "should create a config from the config file" do
35
- YamlConfig.should_receive(:new).with('some_fake_dir', "yaml config").and_return(@mock_config)
30
+ YamlConfig.should_receive(:new).with('some_fake_dir', "config/externals.yml").and_return(@mock_config)
36
31
  @app.config
37
32
  end
38
33
  end
39
34
 
40
35
  describe "app actions" do
36
+
41
37
  before(:each) do
42
38
  @app.stub!(:config).and_return(@mock_config)
43
39
  @mock_repo = mock("repo")
@@ -50,13 +46,13 @@ module Externals
50
46
  end
51
47
 
52
48
  it "should freeze each of the repositories" do
53
- @mock_repo.should_receive(:freezify)
54
- @app.freezify
49
+ @mock_repo.should_receive(:freeze)
50
+ @app.freeze
55
51
  end
56
52
 
57
53
  it "should unfreeze each of the repositories" do
58
- @mock_repo.should_receive(:unfreezify)
59
- @app.unfreezify
54
+ @mock_repo.should_receive(:unfreeze)
55
+ @app.unfreeze
60
56
  end
61
57
  end
62
58
  end
@@ -0,0 +1,141 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ module Externals
4
+ describe Externals::Repository do
5
+
6
+ before(:each) do
7
+ @stdout = $stdout
8
+ $stdout = StringIO.new
9
+ @repo = Repository.new("/", "tmp", "git://", "/")
10
+ end
11
+
12
+ after(:each) do
13
+ $stdout = @stdout
14
+ end
15
+
16
+ describe "freeze" do
17
+
18
+ before(:each) do
19
+ @repo.stub!(:exists?).and_return(false)
20
+ @repo.stub!(:install)
21
+ @repo.stub!(:is_not_a_git_repo?)
22
+ @repo.stub!(:is_a_git_repo?).and_return(true)
23
+ @repo.stub!(:is_compressed?).and_return(true)
24
+ STDIN.stub!(:gets).and_return('y')
25
+ FileUtils.stub!(:mkdir_p)
26
+ FileUtils.stub!(:rm_r)
27
+ end
28
+
29
+ it "should install the repository if it does not exist" do
30
+ @repo.should_receive(:install)
31
+ @repo.freeze
32
+ end
33
+
34
+ it "should display a message if the repository is already frozen" do
35
+ @repo.stub!(:is_not_a_git_repo?).and_return(true)
36
+ @repo.freeze
37
+ $stdout.string.include?("already frozen").should == true
38
+ end
39
+
40
+ it "should ask if the compressed file should be overwritten if exists" do
41
+ @repo.stub!(:is_not_a_git_repo?).and_return(false)
42
+ @repo.freeze
43
+ $stdout.string.include?("Overwrite?").should == true
44
+ end
45
+
46
+ it "should remove the repository's .git file" do
47
+ FileUtils.should_receive(:rm_r).with('.git')
48
+ @repo.freeze
49
+ end
50
+ end
51
+
52
+ describe "install" do
53
+
54
+ before(:each) do
55
+ File.stub!(:exist?)
56
+ FileUtils.stub!(:mkdir_p)
57
+ FileUtils.stub!(:rm_f)
58
+ end
59
+
60
+ after(:each) do
61
+ @repo.install
62
+ end
63
+
64
+ it "should create the checkout path if does not exist" do
65
+ File.should_receive(:exist?).and_return(false)
66
+ FileUtils.should_receive(:mkdir_p)
67
+ end
68
+
69
+ it "should remove repository if exists" do
70
+ FileUtils.should_receive(:rm_rf)
71
+ end
72
+ end
73
+
74
+ describe "unfreeze" do
75
+
76
+ before(:each) do
77
+ @repo.stub!(:is_a_git_repo?)
78
+ @repo.stub!(:exists?)
79
+ @repo.stub!(:install)
80
+ @repo.stub!(:is_not_a_git_repo?)
81
+ @repo.stub!(:is_compressed?)
82
+ FileUtils.stub!(:mv)
83
+ FileUtils.stub!(:rm_f)
84
+ end
85
+
86
+ it "should display a message if the repository is already unfrozen" do
87
+ @repo.should_receive(:is_a_git_repo?).and_return(true)
88
+ @repo.unfreeze
89
+ $stdout.string.include?("already unfrozen").should == true
90
+ end
91
+
92
+ it "should install the repository if it does not exist" do
93
+ @repo.should_receive(:exists?).and_return(false)
94
+ @repo.should_receive(:install)
95
+ @repo.unfreeze
96
+ end
97
+
98
+ it "should display a message after the install" do
99
+ @repo.should_receive(:is_a_git_repo?).and_return(false)
100
+ @repo.should_receive(:exists?).and_return(false)
101
+ @repo.unfreeze
102
+ $stdout.string.include?("unfrozen").should == true
103
+ end
104
+
105
+ it "should move the uncompressed .git directory back to the repo if compressed file exists" do
106
+ @repo.should_receive(:is_a_git_repo?).and_return(false)
107
+ @repo.should_receive(:exists?).and_return(true)
108
+ @repo.should_receive(:is_not_a_git_repo?).and_return(true)
109
+ @repo.should_receive(:is_compressed?).and_return(true)
110
+ FileUtils.should_receive(:mv)
111
+ @repo.unfreeze
112
+ end
113
+
114
+ it "should remove the snapshot if compressed file exists" do
115
+ @repo.should_receive(:is_a_git_repo?).and_return(false)
116
+ @repo.should_receive(:exists?).and_return(true)
117
+ @repo.should_receive(:is_not_a_git_repo?).and_return(true)
118
+ @repo.should_receive(:is_compressed?).and_return(true)
119
+ FileUtils.should_receive(:rm_f)
120
+ @repo.unfreeze
121
+ end
122
+
123
+ it "should install the repository if no snapshot found" do
124
+ @repo.should_receive(:is_a_git_repo?).and_return(false)
125
+ @repo.should_receive(:exists?).and_return(true)
126
+ @repo.should_receive(:is_not_a_git_repo?).and_return(true)
127
+ @repo.should_receive(:is_compressed?).and_return(false)
128
+ @repo.should_receive(:install)
129
+ @repo.unfreeze
130
+ end
131
+
132
+ it "should display a message when finished" do
133
+ @repo.should_receive(:is_a_git_repo?).and_return(false)
134
+ @repo.should_receive(:exists?).and_return(true)
135
+ @repo.should_receive(:is_not_a_git_repo?).and_return(true)
136
+ @repo.unfreeze
137
+ $stdout.string.include?("unfrozen").should == true
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,44 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ module Externals
4
+ describe Externals::YamlConfig do
5
+
6
+ before(:each) do
7
+ @rspec = mock("rspec")
8
+ @foo = mock("foo")
9
+ @rspec.stub!(:name).and_return('rspec')
10
+ @foo.stub!(:name).and_return('foo')
11
+ File.stub!(:read).and_return(
12
+ "rspec:\n repo: git://rspec\n path: vendor/plugins\n" +
13
+ "foo:\n repo: git://at/foo\n path: path/to/foo\n"
14
+ )
15
+ Repository.stub!(:new).and_return(@rspec)
16
+ Repository.stub!(:new).and_return(@foo)
17
+ end
18
+
19
+ it "should create repositories" do
20
+ File.stub!(:exists?).and_return(true)
21
+ Repository.should_receive(:new).with(
22
+ "base_dir", "rspec", "git://rspec", "vendor/plugins"
23
+ )
24
+ Repository.should_receive(:new).with(
25
+ "base_dir", "foo", "git://at/foo", "path/to/foo"
26
+ )
27
+ config = YamlConfig.new("base_dir", "config/externals.yml")
28
+ end
29
+
30
+ it "should allow repository iteration" do
31
+ File.stub!(:exists?).and_return(true)
32
+ config = YamlConfig.new("base_dir", "config/externals.yml")
33
+ config.each_repo { |r| [ @rspec, @foo ].include?(r).should == true }
34
+ config.each_repo('r') { |r| r.should == @rspec }
35
+ config.each_repo('f') { |r| r.should == @foo }
36
+ end
37
+
38
+ it "should error if config doesn't exist" do
39
+ File.stub!(:exists?).and_return(false)
40
+ $stderr.should_receive(:puts)
41
+ config = YamlConfig.new('base_dir', 'config/externals.yml')
42
+ end
43
+ end
44
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,11 @@
1
+ $TESTING = true
1
2
  $:.unshift(File.dirname(__FILE__) + '/../lib')
2
3
 
3
- require 'rubygems'
4
4
  require 'externals'
5
- require 'spec'
5
+ require 'pp'
6
+
7
+ def debug(object)
8
+ puts "<pre>"
9
+ pp object
10
+ puts "</pre>"
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winton-externals
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winton Welsh
@@ -9,32 +9,36 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-12 00:00:00 -07:00
13
- default_executable:
12
+ date: 2009-04-27 00:00:00 -07:00
13
+ default_executable: externals
14
14
  dependencies: []
15
15
 
16
- description: Work on git externals without affecting others
16
+ description:
17
17
  email: mail@wintoni.us
18
18
  executables:
19
19
  - externals
20
20
  extensions: []
21
21
 
22
- extra_rdoc_files: []
23
-
24
- files:
25
- - MIT-LICENSE
22
+ extra_rdoc_files:
26
23
  - README.markdown
27
- - Rakefile
24
+ files:
25
+ - bin
28
26
  - bin/externals
29
- - changelog.markdown
30
27
  - externals.gemspec
31
- - lib/externals.rb
28
+ - lib
29
+ - lib/externals
32
30
  - lib/externals/app.rb
33
31
  - lib/externals/repository.rb
34
32
  - lib/externals/yaml_config.rb
35
- - spec/bin/externals_spec.rb
36
- - spec/lib/app_spec.rb
37
- - spec/lib/yaml_config_spec.rb
33
+ - lib/externals.rb
34
+ - MIT-LICENSE
35
+ - Rakefile
36
+ - README.markdown
37
+ - spec
38
+ - spec/externals
39
+ - spec/externals/app_spec.rb
40
+ - spec/externals/repository_spec.rb
41
+ - spec/externals/yaml_config_spec.rb
38
42
  - spec/spec.opts
39
43
  - spec/spec_helper.rb
40
44
  has_rdoc: false
data/changelog.markdown DELETED
@@ -1,3 +0,0 @@
1
- Version 0.1.0
2
- -------------
3
- * Initial Creation
@@ -1,100 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
-
3
- describe :externals do
4
- before(:all) do
5
- @stdout = $stdout
6
- $stdout = StringIO.new
7
- # Test $stdout.string
8
- end
9
-
10
- after(:all) do
11
- $stdout = @stdout
12
- end
13
-
14
- describe "help" do
15
- it "should show a help message with no input" do
16
- run
17
- $stdout.string.should match(/Usage: externals/)
18
- end
19
- end
20
-
21
- describe "status" do
22
- it "should tell the user if the repository exists" do
23
- end
24
-
25
- it "should tell the user if the repository is frozen" do
26
- end
27
-
28
- it "should tell the user if a snapshot exists" do
29
- end
30
- end
31
-
32
- describe "freeze" do
33
- describe "on a non-existent repository" do
34
- it "should clone a new repository" do
35
- end
36
- end
37
-
38
- describe "on a frozen repository" do
39
- it "should tell the user the repository is already frozen" do
40
- end
41
- end
42
-
43
- describe "on an unfrozen repository" do
44
- it "should make the temp directory if it does not exist" do
45
- end
46
-
47
- it "should compress the repository's .git folder to the temp directory" do
48
- end
49
-
50
- it "should remove the repository's .git folder" do
51
- end
52
-
53
- describe "when a snapshot exists" do
54
- it "should ask the user if the user wants to overwrite the snapshot" do
55
- end
56
-
57
- it "should not overwrite if the user says no" do
58
- end
59
- end
60
- end
61
- end
62
-
63
- describe "unfreeze" do
64
- describe "on a frozen repository" do
65
- it "should tell the user the repository is already unfrozen" do
66
- end
67
- end
68
-
69
- describe "on a non-existent repository" do
70
- it "should clone the repository" do
71
- end
72
- end
73
-
74
- describe "on a frozen repository" do
75
- describe "that has a snapshot" do
76
- it "should decompress the snapshot" do
77
- end
78
-
79
- it "should move the snapshot back to the repository" do
80
- end
81
-
82
- it "should remove the snapshot" do
83
- end
84
-
85
- it "should reset the repository" do
86
- end
87
- end
88
-
89
- describe "that does not have a snapshot" do
90
- it "should clone a new repository" do
91
- end
92
- end
93
- end
94
- end
95
-
96
- def run(action=nil)
97
- app = Externals::App.new(FileUtils.pwd)
98
- app.run(action)
99
- end
100
- end
@@ -1,20 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
-
3
- module Externals
4
- describe YamlConfig do
5
- it "should create repositories from the config" do
6
- config = YamlConfig.new(
7
- 'base_dir',
8
- "rspec:\n repo: git://rspec\n path: vendor/plugins\n" +
9
- "foo:\n repo: git://at/foo\n path: path/to/foo\n"
10
- )
11
- Repository.should_receive(:new).with(
12
- 'base_dir', "rspec", "git://rspec", "vendor/plugins"
13
- ).and_return :a_repo
14
- Repository.should_receive(:new).with(
15
- 'base_dir', "foo", "git://at/foo", "path/to/foo"
16
- ).and_return :a_repo
17
- config.each_repo { |r| r.should == :a_repo }
18
- end
19
- end
20
- end