pivotal-piston 1.9.4
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.
- data/.gitignore +8 -0
- data/History.txt +11 -0
- data/License.txt +20 -0
- data/Manifest.txt +85 -0
- data/README.txt +136 -0
- data/Rakefile +4 -0
- data/bin/piston +5 -0
- data/config/hoe.rb +79 -0
- data/config/requirements.rb +18 -0
- data/lib/piston.rb +18 -0
- data/lib/piston/cli.rb +315 -0
- data/lib/piston/commands.rb +4 -0
- data/lib/piston/commands/base.rb +44 -0
- data/lib/piston/commands/import.rb +42 -0
- data/lib/piston/commands/info.rb +14 -0
- data/lib/piston/commands/lock_unlock.rb +21 -0
- data/lib/piston/commands/update.rb +29 -0
- data/lib/piston/git.rb +12 -0
- data/lib/piston/git/client.rb +77 -0
- data/lib/piston/git/commit.rb +74 -0
- data/lib/piston/git/repository.rb +63 -0
- data/lib/piston/git/working_copy.rb +86 -0
- data/lib/piston/repository.rb +57 -0
- data/lib/piston/revision.rb +53 -0
- data/lib/piston/svn.rb +14 -0
- data/lib/piston/svn/client.rb +88 -0
- data/lib/piston/svn/repository.rb +67 -0
- data/lib/piston/svn/revision.rb +74 -0
- data/lib/piston/svn/working_copy.rb +108 -0
- data/lib/piston/version.rb +9 -0
- data/lib/piston/working_copy.rb +183 -0
- data/lib/subclass_responsibility_error.rb +2 -0
- data/log/.gitignore +0 -0
- data/samples/common.rb +19 -0
- data/samples/import_git_git.rb +39 -0
- data/samples/import_git_svn.rb +36 -0
- data/samples/import_svn_git.rb +29 -0
- data/samples/import_svn_svn.rb +24 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/samples.rake +6 -0
- data/tasks/test.rake +69 -0
- data/tasks/website.rake +17 -0
- data/test/integration/test_git_git.rb +99 -0
- data/test/integration/test_git_svn.rb +121 -0
- data/test/integration/test_import_svn_git.rb +47 -0
- data/test/integration/test_import_svn_svn.rb +38 -0
- data/test/integration_helpers.rb +33 -0
- data/test/test_helper.rb +83 -0
- data/test/unit/git/commit/test_checkout.rb +31 -0
- data/test/unit/git/commit/test_each.rb +30 -0
- data/test/unit/git/commit/test_rememberance.rb +21 -0
- data/test/unit/git/commit/test_validation.rb +34 -0
- data/test/unit/git/repository/test_at.rb +23 -0
- data/test/unit/git/repository/test_basename.rb +12 -0
- data/test/unit/git/repository/test_branchanme.rb +15 -0
- data/test/unit/git/repository/test_guessing.rb +32 -0
- data/test/unit/git/working_copy/test_copying.rb +25 -0
- data/test/unit/git/working_copy/test_creation.rb +22 -0
- data/test/unit/git/working_copy/test_existence.rb +18 -0
- data/test/unit/git/working_copy/test_finalization.rb +15 -0
- data/test/unit/git/working_copy/test_guessing.rb +35 -0
- data/test/unit/git/working_copy/test_rememberance.rb +21 -0
- data/test/unit/svn/repository/test_at.rb +19 -0
- data/test/unit/svn/repository/test_basename.rb +24 -0
- data/test/unit/svn/repository/test_guessing.rb +45 -0
- data/test/unit/svn/revision/test_checkout.rb +28 -0
- data/test/unit/svn/revision/test_each.rb +22 -0
- data/test/unit/svn/revision/test_rememberance.rb +38 -0
- data/test/unit/svn/revision/test_validation.rb +50 -0
- data/test/unit/svn/working_copy/test_copying.rb +26 -0
- data/test/unit/svn/working_copy/test_creation.rb +16 -0
- data/test/unit/svn/working_copy/test_existence.rb +23 -0
- data/test/unit/svn/working_copy/test_externals.rb +56 -0
- data/test/unit/svn/working_copy/test_finalization.rb +17 -0
- data/test/unit/svn/working_copy/test_guessing.rb +18 -0
- data/test/unit/svn/working_copy/test_merging.rb +47 -0
- data/test/unit/svn/working_copy/test_rememberance.rb +26 -0
- data/test/unit/test_info.rb +37 -0
- data/test/unit/test_lock_unlock.rb +47 -0
- data/test/unit/test_repository.rb +51 -0
- data/test/unit/test_revision.rb +31 -0
- data/test/unit/working_copy/test_guessing.rb +35 -0
- data/test/unit/working_copy/test_info.rb +14 -0
- data/test/unit/working_copy/test_rememberance.rb +42 -0
- data/test/unit/working_copy/test_validate.rb +63 -0
- data/website/index.html +11 -0
- data/website/index.txt +39 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.rhtml +48 -0
- metadata +244 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
desc 'Release the website and new gem version'
|
|
2
|
+
task :deploy => [:check_version, :website, :release] do
|
|
3
|
+
puts "Remember to create SVN tag:"
|
|
4
|
+
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
|
5
|
+
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
|
6
|
+
puts "Suggested comment:"
|
|
7
|
+
puts "Tagging release #{CHANGES}"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
|
11
|
+
task :local_deploy => [:website_generate, :install_gem]
|
|
12
|
+
|
|
13
|
+
task :check_version do
|
|
14
|
+
unless ENV['VERSION']
|
|
15
|
+
puts 'Must pass a VERSION=x.y.z release version'
|
|
16
|
+
exit
|
|
17
|
+
end
|
|
18
|
+
unless ENV['VERSION'] == VERS
|
|
19
|
+
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
|
20
|
+
exit
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
|
25
|
+
task :install_gem_no_doc => [:clean, :package] do
|
|
26
|
+
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
namespace :manifest do
|
|
30
|
+
desc 'Recreate Manifest.txt to include ALL files'
|
|
31
|
+
task :refresh do
|
|
32
|
+
`rake check_manifest | patch -p0 > Manifest.txt`
|
|
33
|
+
end
|
|
34
|
+
end
|
data/tasks/samples.rake
ADDED
data/tasks/test.rake
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
require "rake/testtask"
|
|
2
|
+
|
|
3
|
+
Rake.application.instance_variable_get("@tasks").delete("test")
|
|
4
|
+
Rake::TestTask.new("test") do |t|
|
|
5
|
+
t.libs << "test"
|
|
6
|
+
t.test_files = FileList['test/**/test_*.rb']
|
|
7
|
+
t.verbose = true
|
|
8
|
+
t.warning = false
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
namespace :test do
|
|
12
|
+
Rake::TestTask.new("units") do |t|
|
|
13
|
+
t.libs << "test"
|
|
14
|
+
t.test_files = FileList['test/unit/**/test_*.rb']
|
|
15
|
+
t.verbose = true
|
|
16
|
+
t.warning = false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Rake::TestTask.new("integration") do |t|
|
|
20
|
+
t.libs << "test"
|
|
21
|
+
t.test_files = FileList['test/integration/**/test_*.rb']
|
|
22
|
+
t.verbose = true
|
|
23
|
+
t.warning = false
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
Rake::TestTask.new("recent") do |t|
|
|
27
|
+
t.libs << "test"
|
|
28
|
+
t.verbose = true
|
|
29
|
+
t.warning = false
|
|
30
|
+
|
|
31
|
+
# 10 minutes ago
|
|
32
|
+
cutoff_at = Time.now - 10 * 60
|
|
33
|
+
|
|
34
|
+
t.test_files = FileList["test/integration/**/test_*.rb", "test/unit/**/test_*.rb"].select do |path|
|
|
35
|
+
File.mtime(path) > cutoff_at
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
desc "Prepares an SVN and Git repository for manual testing"
|
|
40
|
+
task :prep do
|
|
41
|
+
require "pathname"
|
|
42
|
+
PISTON_ROOT = Pathname.new(File.expand_path(Dir.pwd))
|
|
43
|
+
MANUAL_ROOT = PISTON_ROOT + "tmp/manual"
|
|
44
|
+
rm_rf MANUAL_ROOT; mkdir MANUAL_ROOT
|
|
45
|
+
REPOS_ROOT = MANUAL_ROOT + "repos"
|
|
46
|
+
REPOS_URL = "file://#{REPOS_ROOT}"
|
|
47
|
+
WC_ROOT = MANUAL_ROOT + "wc"
|
|
48
|
+
|
|
49
|
+
sh "svnadmin create #{REPOS_ROOT}"
|
|
50
|
+
sh "svn checkout #{REPOS_URL} #{WC_ROOT}"
|
|
51
|
+
Dir.chdir(WC_ROOT) do
|
|
52
|
+
sh "svn mkdir project plugins plugins/libcalc plugins/libpower"
|
|
53
|
+
Dir.chdir("plugins/libcalc") do
|
|
54
|
+
File.open("README", "w") {|io| io.puts "libcalc\n-------\n\nThis is libcalc\n"}
|
|
55
|
+
File.open("libcalc.rb", "w") {|io| io.puts "# libcaclc.rb\n# Ensure this is powerful enough\n"}
|
|
56
|
+
end
|
|
57
|
+
Dir.chdir("plugins/libpower") do
|
|
58
|
+
File.open("README", "w") {|io| io.puts "libpower\n-------\n\nThis is libpower\n"}
|
|
59
|
+
end
|
|
60
|
+
sh "svn add plugins/libcalc/README plugins/libcalc/libcalc.rb plugins/libpower/README"
|
|
61
|
+
sh "svn commit -m 'Initial revision'"
|
|
62
|
+
sh "ruby -I#{PISTON_ROOT}/lib #{PISTON_ROOT}/bin/piston import #{REPOS_URL}"
|
|
63
|
+
Dir.chdir("plugins/libcalc") do
|
|
64
|
+
File.open("libcalc.rb", "w") {|io| io.puts "# libcalc.rb\n# Ensure this is powerful enough\n\nclass Libcalc\nend\n"}
|
|
65
|
+
end
|
|
66
|
+
sh "svn commit -m 'Implement libcalc'"
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
data/tasks/website.rake
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
desc 'Generate website files'
|
|
2
|
+
task :website_generate => :ruby_env do
|
|
3
|
+
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
|
4
|
+
sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
desc 'Upload website files to rubyforge'
|
|
9
|
+
task :website_upload do
|
|
10
|
+
host = "#{rubyforge_username}@rubyforge.org"
|
|
11
|
+
remote_dir = "/var/www/gforge-projects/#{PATH}/"
|
|
12
|
+
local_dir = 'website'
|
|
13
|
+
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
desc 'Generate and upload website files'
|
|
17
|
+
task :website => [:website_generate, :website_upload, :publish_docs]
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
|
|
2
|
+
|
|
3
|
+
class TestGitGit < Piston::TestCase
|
|
4
|
+
attr_reader :root_path, :parent_path, :wc_path
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
super
|
|
8
|
+
@root_path = mkpath("tmp/import_git_git")
|
|
9
|
+
|
|
10
|
+
@parent_path = root_path + "parent"
|
|
11
|
+
mkpath(parent_path)
|
|
12
|
+
|
|
13
|
+
@wc_path = root_path + "wc"
|
|
14
|
+
mkpath(wc_path)
|
|
15
|
+
|
|
16
|
+
Dir.chdir(parent_path) do
|
|
17
|
+
git(:init)
|
|
18
|
+
File.open("README", "wb") {|f| f.write "Readme - first commit"}
|
|
19
|
+
File.open("file_in_first_commit", "wb") {|f| f.write "file_in_first_commit"}
|
|
20
|
+
git(:add, ".")
|
|
21
|
+
git(:commit, "-m", "'first commit'")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
Dir.chdir(wc_path) do
|
|
25
|
+
git(:init)
|
|
26
|
+
File.open("README", "wb") {|f| f.write "Hello World!"}
|
|
27
|
+
Pathname.new("vendor").mkdir
|
|
28
|
+
File.open("vendor/.gitignore", "wb") {|f| f.write "*.swp"}
|
|
29
|
+
git(:add, ".")
|
|
30
|
+
git(:commit, "-m", "'first commit'")
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def test_import
|
|
35
|
+
Dir.chdir(wc_path) do
|
|
36
|
+
piston(:import, parent_path, "vendor/parent")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
Dir.chdir(wc_path) do
|
|
40
|
+
assert_equal IMPORT_STATUS.split("\n").sort, git(:status).split("\n").sort
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
info = YAML.load_file(wc_path + "vendor/parent/.piston.yml")
|
|
44
|
+
assert_equal 1, info["format"]
|
|
45
|
+
assert_equal parent_path.to_s, info["repository_url"]
|
|
46
|
+
assert_equal "Piston::Git::Repository", info["repository_class"]
|
|
47
|
+
|
|
48
|
+
response = `git-ls-remote #{parent_path}`
|
|
49
|
+
head_commit = response.grep(/HEAD/).first.chomp.split(/\s+/).first
|
|
50
|
+
assert_equal head_commit, info["handler"][Piston::Git::COMMIT]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
IMPORT_STATUS = %Q(# On branch master
|
|
54
|
+
# Changes to be committed:
|
|
55
|
+
# (use "git reset HEAD <file>..." to unstage)
|
|
56
|
+
#
|
|
57
|
+
#\tnew file: vendor/parent/.piston.yml
|
|
58
|
+
#\tnew file: vendor/parent/README
|
|
59
|
+
#\tnew file: vendor/parent/file_in_first_commit
|
|
60
|
+
#
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
def test_update
|
|
64
|
+
Dir.chdir(wc_path) do
|
|
65
|
+
piston(:import, parent_path, "vendor/parent")
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
Dir.chdir(wc_path) do
|
|
69
|
+
git(:add, ".")
|
|
70
|
+
git(:commit, "-m", "'next commit'")
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
Dir.chdir(parent_path) do
|
|
74
|
+
File.open("README", "wb") {|f| f.write "Readme - second commit"}
|
|
75
|
+
FileUtils.rm("file_in_first_commit")
|
|
76
|
+
File.open("file_in_second_commit", "wb") {|f| f.write "file_in_second_commit"}
|
|
77
|
+
git(:add, ".")
|
|
78
|
+
git(:commit, "-m", "'second commit'")
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
Dir.chdir(wc_path) do
|
|
82
|
+
piston(:update, "vendor/parent")
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
Dir.chdir(wc_path) do
|
|
86
|
+
assert_equal CHANGE_STATUS.split("\n"), git(:status).split("\n")
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
CHANGE_STATUS = %Q(# On branch master
|
|
91
|
+
# Changes to be committed:
|
|
92
|
+
# (use "git reset HEAD <file>..." to unstage)
|
|
93
|
+
#
|
|
94
|
+
#\tmodified: vendor/parent/.piston.yml
|
|
95
|
+
#\tmodified: vendor/parent/README
|
|
96
|
+
#\tnew file: vendor/parent/file_in_second_commit
|
|
97
|
+
#
|
|
98
|
+
)
|
|
99
|
+
end
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
|
|
2
|
+
|
|
3
|
+
class TestGitSvn < Piston::TestCase
|
|
4
|
+
attr_reader :root_path, :parent_path, :repos_path, :wc_path
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
super
|
|
8
|
+
@root_path = mkpath("/tmp/import_git_svn")
|
|
9
|
+
|
|
10
|
+
@repos_path = @root_path + "repos"
|
|
11
|
+
|
|
12
|
+
@parent_path = root_path + "parent"
|
|
13
|
+
mkpath(parent_path)
|
|
14
|
+
|
|
15
|
+
@wc_path = root_path + "wc"
|
|
16
|
+
mkpath(wc_path)
|
|
17
|
+
|
|
18
|
+
Dir.chdir(parent_path) do
|
|
19
|
+
git(:init)
|
|
20
|
+
File.open(parent_path + "README", "wb") {|f| f.write "Readme - first commit"}
|
|
21
|
+
File.open(parent_path + "file_in_first_commit", "wb") {|f| f.write "file_in_first_commit"}
|
|
22
|
+
git(:add, ".")
|
|
23
|
+
git(:commit, "-m", "'first commit'")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
svnadmin :create, repos_path
|
|
27
|
+
svn :checkout, "file://#{repos_path}", wc_path
|
|
28
|
+
svn :mkdir, wc_path + "trunk", wc_path + "tags", wc_path + "branches", wc_path + "trunk/vendor"
|
|
29
|
+
svn :commit, wc_path, "--message", "'first commit'"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_import
|
|
33
|
+
piston(:import, parent_path, wc_path + "trunk/vendor/parent")
|
|
34
|
+
|
|
35
|
+
assert_equal ADD_STATUS.split("\n").sort, svn(:status, wc_path + "trunk/vendor").gsub((wc_path + "trunk/").to_s, "").split("\n").sort
|
|
36
|
+
|
|
37
|
+
info = YAML.load_file(wc_path + "trunk/vendor/parent/.piston.yml")
|
|
38
|
+
assert_equal 1, info["format"]
|
|
39
|
+
assert_equal parent_path.to_s, info["repository_url"]
|
|
40
|
+
assert_equal "Piston::Git::Repository", info["repository_class"]
|
|
41
|
+
|
|
42
|
+
response = `git-ls-remote #{parent_path}`
|
|
43
|
+
head_commit = response.grep(/HEAD/).first.chomp.split(/\s+/).first
|
|
44
|
+
assert_equal head_commit, info["handler"][Piston::Git::COMMIT]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def test_import_from_branch
|
|
48
|
+
Dir.chdir(parent_path) do
|
|
49
|
+
git(:branch, "rewrite")
|
|
50
|
+
git(:checkout, "rewrite")
|
|
51
|
+
touch("file_in_branch")
|
|
52
|
+
git(:add, ".")
|
|
53
|
+
git(:commit, "-m", "'commit after branch'")
|
|
54
|
+
end
|
|
55
|
+
piston(:import, "--revision", "origin/rewrite", parent_path, wc_path + "trunk/vendor/parent")
|
|
56
|
+
|
|
57
|
+
assert File.exists?(wc_path + "trunk/vendor/parent/file_in_branch"),
|
|
58
|
+
"Could not find file_in_branch in parent imported directory."
|
|
59
|
+
|
|
60
|
+
info = YAML.load(File.read(wc_path + "trunk/vendor/parent/.piston.yml"))
|
|
61
|
+
assert_equal 1, info["format"]
|
|
62
|
+
assert_equal parent_path.to_s, info["repository_url"]
|
|
63
|
+
assert_equal "Piston::Git::Repository", info["repository_class"]
|
|
64
|
+
|
|
65
|
+
response = `git-ls-remote #{parent_path}`
|
|
66
|
+
head_commit = response.grep(/refs\/heads\/rewrite/).first.chomp.split(/\s+/).first
|
|
67
|
+
assert_equal head_commit, info["handler"][Piston::Git::COMMIT]
|
|
68
|
+
assert_equal "origin/rewrite", info["handler"][Piston::Git::BRANCH]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def test_import_from_tag
|
|
72
|
+
Dir.chdir(parent_path) do
|
|
73
|
+
git(:tag, "the_tag_name")
|
|
74
|
+
touch("file_past_tag")
|
|
75
|
+
git(:add, ".")
|
|
76
|
+
git(:commit, "-m", "'commit after tag'")
|
|
77
|
+
end
|
|
78
|
+
piston(:import, "--revision", "the_tag_name", parent_path, wc_path + "trunk/vendor/parent")
|
|
79
|
+
|
|
80
|
+
info = YAML.load(File.read(wc_path + "trunk/vendor/parent/.piston.yml"))
|
|
81
|
+
assert_equal 1, info["format"]
|
|
82
|
+
assert_equal parent_path.to_s, info["repository_url"]
|
|
83
|
+
assert_equal "Piston::Git::Repository", info["repository_class"]
|
|
84
|
+
|
|
85
|
+
response = `git-ls-remote #{parent_path} the_tag_name`
|
|
86
|
+
tagged_commit = response.chomp.split(/\s+/).first
|
|
87
|
+
assert_equal tagged_commit, info["handler"][Piston::Git::COMMIT]
|
|
88
|
+
assert_equal "the_tag_name", info["handler"][Piston::Git::BRANCH]
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
ADD_STATUS = %Q(A vendor/parent
|
|
92
|
+
A vendor/parent/.piston.yml
|
|
93
|
+
A vendor/parent/README
|
|
94
|
+
A vendor/parent/file_in_first_commit
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
def test_update
|
|
98
|
+
piston(:import, parent_path, wc_path + "trunk/vendor/parent")
|
|
99
|
+
|
|
100
|
+
Dir.chdir(wc_path) do
|
|
101
|
+
svn(:commit, "-m", "'next commit'")
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
Dir.chdir(parent_path) do
|
|
105
|
+
File.open(parent_path + "README", "wb") {|f| f.write "Readme - second commit"}
|
|
106
|
+
FileUtils.rm(parent_path + "file_in_first_commit")
|
|
107
|
+
File.open(parent_path + "file_in_second_commit", "wb") {|f| f.write "file_in_second_commit"}
|
|
108
|
+
git(:add, ".")
|
|
109
|
+
git(:commit, "-m", "'second commit'")
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
piston(:update, wc_path + "trunk/vendor/parent")
|
|
113
|
+
|
|
114
|
+
assert_equal CHANGE_STATUS.split("\n").sort, svn(:status, wc_path + "trunk/vendor").gsub((wc_path + "trunk/").to_s, "").split("\n").sort
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
CHANGE_STATUS = %Q(M vendor/parent/.piston.yml
|
|
118
|
+
M vendor/parent/README
|
|
119
|
+
? vendor/parent/file_in_second_commit
|
|
120
|
+
)
|
|
121
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
|
|
2
|
+
|
|
3
|
+
class TestImportSvnGit < Piston::TestCase
|
|
4
|
+
attr_reader :root_path, :repos_path, :wc_path
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
super
|
|
8
|
+
@root_path = mkpath("/tmp/import_svn_git")
|
|
9
|
+
@repos_path = @root_path + "repos"
|
|
10
|
+
@wc_path = @root_path + "wc"
|
|
11
|
+
mkpath(wc_path)
|
|
12
|
+
|
|
13
|
+
Dir.chdir(wc_path) do
|
|
14
|
+
git(:init)
|
|
15
|
+
File.open(wc_path + "README", "wb") {|f| f.write "Hello World!"}
|
|
16
|
+
(wc_path + "vendor").mkdir
|
|
17
|
+
File.open(wc_path + "vendor/.gitignore", "wb") {|f| f.write "*.swp"}
|
|
18
|
+
git(:add, ".")
|
|
19
|
+
git(:commit, "-m", "'first commit'")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_import
|
|
24
|
+
Dir.chdir(wc_path) do
|
|
25
|
+
piston :import, "http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/", "vendor/ssl_requirement"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
Dir.chdir(wc_path) do
|
|
29
|
+
assert_equal %Q(# On branch master
|
|
30
|
+
# Changes to be committed:
|
|
31
|
+
# (use "git reset HEAD <file>..." to unstage)
|
|
32
|
+
#
|
|
33
|
+
#\tnew file: vendor/ssl_requirement/.piston.yml
|
|
34
|
+
#\tnew file: vendor/ssl_requirement/README
|
|
35
|
+
#\tnew file: vendor/ssl_requirement/lib/ssl_requirement.rb
|
|
36
|
+
#\tnew file: vendor/ssl_requirement/test/ssl_requirement_test.rb
|
|
37
|
+
#
|
|
38
|
+
).split("\n").sort, git(:status).split("\n").sort
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
info = YAML.load_file(wc_path + "vendor/ssl_requirement/.piston.yml")
|
|
42
|
+
assert_equal 1, info["format"]
|
|
43
|
+
assert_equal "http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/", info["repository_url"]
|
|
44
|
+
assert_equal "Piston::Svn::Repository", info["repository_class"]
|
|
45
|
+
assert_equal "5ecf4fe2-1ee6-0310-87b1-e25e094e27de", info["handler"][Piston::Svn::UUID]
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
|
|
2
|
+
|
|
3
|
+
class TestImportSvnSvn < Piston::TestCase
|
|
4
|
+
attr_reader :root_path, :repos_path, :wc_path
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
super
|
|
8
|
+
@root_path = mkpath("/tmp/import_svn_svn")
|
|
9
|
+
@repos_path = @root_path + "repos"
|
|
10
|
+
@wc_path = @root_path + "wc"
|
|
11
|
+
|
|
12
|
+
svnadmin :create, repos_path
|
|
13
|
+
svn :checkout, "file://#{repos_path}", wc_path
|
|
14
|
+
svn :mkdir, wc_path + "trunk", wc_path + "tags", wc_path + "branches", wc_path + "trunk/vendor"
|
|
15
|
+
svn :commit, wc_path, "--message", "'first commit'"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_import
|
|
19
|
+
Dir.chdir(wc_path + "trunk/vendor") do # make a test guessing the path where import
|
|
20
|
+
piston :import, "http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
assert_equal "A vendor/ssl_requirement
|
|
24
|
+
A vendor/ssl_requirement/test
|
|
25
|
+
A vendor/ssl_requirement/test/ssl_requirement_test.rb
|
|
26
|
+
A vendor/ssl_requirement/lib
|
|
27
|
+
A vendor/ssl_requirement/lib/ssl_requirement.rb
|
|
28
|
+
A vendor/ssl_requirement/.piston.yml
|
|
29
|
+
A vendor/ssl_requirement/README
|
|
30
|
+
".split("\n").sort, svn(:status, wc_path + "trunk/vendor/").gsub((wc_path + "trunk/").to_s, "").split("\n").sort
|
|
31
|
+
|
|
32
|
+
info = YAML.load_file(wc_path + "trunk/vendor/ssl_requirement/.piston.yml")
|
|
33
|
+
assert_equal 1, info["format"]
|
|
34
|
+
assert_equal "http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/", info["repository_url"]
|
|
35
|
+
assert_equal "Piston::Svn::Repository", info["repository_class"]
|
|
36
|
+
assert_equal "5ecf4fe2-1ee6-0310-87b1-e25e094e27de", info["handler"][Piston::Svn::UUID]
|
|
37
|
+
end
|
|
38
|
+
end
|