jeremylightsmith-piston 1.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.gitignore +6 -0
  2. data/History.txt +6 -0
  3. data/License.txt +20 -0
  4. data/Manifest.txt +86 -0
  5. data/README.txt +136 -0
  6. data/Rakefile +4 -0
  7. data/bin/piston +5 -0
  8. data/config/hoe.rb +76 -0
  9. data/config/requirements.rb +18 -0
  10. data/lib/piston.rb +18 -0
  11. data/lib/piston/cli.rb +279 -0
  12. data/lib/piston/commands.rb +4 -0
  13. data/lib/piston/commands/base.rb +44 -0
  14. data/lib/piston/commands/import.rb +69 -0
  15. data/lib/piston/commands/info.rb +14 -0
  16. data/lib/piston/commands/lock_unlock.rb +21 -0
  17. data/lib/piston/commands/update.rb +28 -0
  18. data/lib/piston/git.rb +12 -0
  19. data/lib/piston/git/client.rb +77 -0
  20. data/lib/piston/git/commit.rb +70 -0
  21. data/lib/piston/git/repository.rb +63 -0
  22. data/lib/piston/git/working_copy.rb +63 -0
  23. data/lib/piston/repository.rb +57 -0
  24. data/lib/piston/revision.rb +48 -0
  25. data/lib/piston/svn.rb +14 -0
  26. data/lib/piston/svn/client.rb +88 -0
  27. data/lib/piston/svn/repository.rb +67 -0
  28. data/lib/piston/svn/revision.rb +74 -0
  29. data/lib/piston/svn/working_copy.rb +55 -0
  30. data/lib/piston/version.rb +9 -0
  31. data/lib/piston/working_copy.rb +129 -0
  32. data/lib/subclass_responsibility_error.rb +2 -0
  33. data/log/.gitignore +0 -0
  34. data/samples/common.rb +19 -0
  35. data/samples/import_git_git.rb +39 -0
  36. data/samples/import_git_svn.rb +36 -0
  37. data/samples/import_svn_git.rb +29 -0
  38. data/samples/import_svn_svn.rb +24 -0
  39. data/script/destroy +14 -0
  40. data/script/generate +14 -0
  41. data/script/txt2html +74 -0
  42. data/setup.rb +1585 -0
  43. data/tasks/deployment.rake +40 -0
  44. data/tasks/environment.rake +7 -0
  45. data/tasks/samples.rake +6 -0
  46. data/tasks/test.rake +30 -0
  47. data/tasks/website.rake +17 -0
  48. data/test/integration/test_import_git_git.rb +96 -0
  49. data/test/integration/test_import_git_svn.rb +131 -0
  50. data/test/integration/test_import_svn_git.rb +52 -0
  51. data/test/integration/test_import_svn_svn.rb +43 -0
  52. data/test/integration_helpers.rb +33 -0
  53. data/test/test_helper.rb +56 -0
  54. data/test/unit/git/commit/test_checkout.rb +30 -0
  55. data/test/unit/git/commit/test_each.rb +36 -0
  56. data/test/unit/git/commit/test_rememberance.rb +20 -0
  57. data/test/unit/git/commit/test_validation.rb +33 -0
  58. data/test/unit/git/repository/test_at.rb +22 -0
  59. data/test/unit/git/repository/test_basename.rb +12 -0
  60. data/test/unit/git/repository/test_branchanme.rb +15 -0
  61. data/test/unit/git/repository/test_guessing.rb +32 -0
  62. data/test/unit/git/working_copy/test_copying.rb +28 -0
  63. data/test/unit/git/working_copy/test_creation.rb +26 -0
  64. data/test/unit/git/working_copy/test_existence.rb +21 -0
  65. data/test/unit/git/working_copy/test_finalization.rb +18 -0
  66. data/test/unit/git/working_copy/test_guessing.rb +34 -0
  67. data/test/unit/git/working_copy/test_rememberance.rb +25 -0
  68. data/test/unit/svn/repository/test_at.rb +18 -0
  69. data/test/unit/svn/repository/test_basename.rb +24 -0
  70. data/test/unit/svn/repository/test_guessing.rb +45 -0
  71. data/test/unit/svn/revision/test_checkout.rb +27 -0
  72. data/test/unit/svn/revision/test_each.rb +21 -0
  73. data/test/unit/svn/revision/test_rememberance.rb +42 -0
  74. data/test/unit/svn/revision/test_validation.rb +49 -0
  75. data/test/unit/svn/working_copy/test_copying.rb +29 -0
  76. data/test/unit/svn/working_copy/test_creation.rb +19 -0
  77. data/test/unit/svn/working_copy/test_existence.rb +26 -0
  78. data/test/unit/svn/working_copy/test_finalization.rb +21 -0
  79. data/test/unit/svn/working_copy/test_guessing.rb +17 -0
  80. data/test/unit/svn/working_copy/test_rememberance.rb +26 -0
  81. data/test/unit/test_import.rb +13 -0
  82. data/test/unit/test_info.rb +36 -0
  83. data/test/unit/test_lock_unlock.rb +46 -0
  84. data/test/unit/test_repository.rb +50 -0
  85. data/test/unit/test_revision.rb +30 -0
  86. data/test/unit/working_copy/test_guessing.rb +34 -0
  87. data/test/unit/working_copy/test_info.rb +13 -0
  88. data/test/unit/working_copy/test_rememberance.rb +48 -0
  89. data/test/unit/working_copy/test_validate.rb +68 -0
  90. data/website/index.html +11 -0
  91. data/website/index.txt +39 -0
  92. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  93. data/website/stylesheets/screen.css +138 -0
  94. data/website/template.rhtml +48 -0
  95. metadata +228 -0
@@ -0,0 +1,40 @@
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
35
+
36
+ desc 'Generate Gemspec file for GitHub'
37
+ task :refresh_gemspec do
38
+ gemspec = `rake debug_gem`.split("\n")[1..-1].join("\n")
39
+ File.open("piston.gemspec", "w") {|f| f << gemspec }
40
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
@@ -0,0 +1,6 @@
1
+ task :samples do
2
+ Dir["samples/*"].each do |sample|
3
+ next if sample =~ /common/
4
+ ruby sample
5
+ end
6
+ end
@@ -0,0 +1,30 @@
1
+ require "rake/testtask"
2
+
3
+ namespace :test do
4
+ Rake::TestTask.new("units") do |t|
5
+ t.libs << "test"
6
+ t.test_files = FileList['test/unit/**/test_*.rb']
7
+ t.verbose = true
8
+ t.warning = false
9
+ end
10
+
11
+ Rake::TestTask.new("integration") do |t|
12
+ t.libs << "test"
13
+ t.test_files = FileList['test/integration/**/test_*.rb']
14
+ t.verbose = true
15
+ t.warning = false
16
+ end
17
+
18
+ Rake::TestTask.new("recent") do |t|
19
+ t.libs << "test"
20
+ t.verbose = true
21
+ t.warning = false
22
+
23
+ # 10 minutes ago
24
+ cutoff_at = Time.now - 10 * 60
25
+
26
+ t.test_files = FileList["test/integration/**/test_*.rb", "test/unit/**/test_*.rb"].select do |path|
27
+ File.mtime(path) > cutoff_at
28
+ end
29
+ end
30
+ end
@@ -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,96 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+ require File.dirname(__FILE__) + "/../integration_helpers"
3
+
4
+ class TestImportGitGit < Test::Unit::TestCase
5
+ attr_reader :root_path, :repos_path, :wc_path
6
+
7
+ def setup
8
+ @root_path = Pathname.new("/tmp/import_git_git")
9
+ @wc_path = @root_path + "wc"
10
+
11
+ root_path.rmtree rescue nil
12
+ root_path.mkpath
13
+
14
+ wc_path.mkpath
15
+ Dir.chdir(wc_path) do
16
+ git(:init)
17
+ File.open(wc_path + "README", "wb") {|f| f.write "Hello World!"}
18
+ (wc_path + "vendor").mkdir
19
+ File.open(wc_path + "vendor/.gitignore", "wb") {|f| f.write "*.swp"}
20
+ git(:add, ".")
21
+ git(:commit, "-m", "'first commit'")
22
+ end
23
+ end
24
+
25
+ def teardown
26
+ root_path.rmtree rescue nil
27
+ end
28
+
29
+ def test_import
30
+ piston(:import, "git://github.com/technoweenie/attachment_fu.git", wc_path + "vendor/attachment_fu")
31
+
32
+ Dir.chdir(wc_path) do
33
+ assert_equal STATUS.split("\n").sort, git(:status).split("\n").sort
34
+ end
35
+
36
+ info = YAML.load(File.read(wc_path + "vendor/attachment_fu/.piston.yml"))
37
+ assert_equal 1, info["format"]
38
+ assert_equal "git://github.com/technoweenie/attachment_fu.git", info["repository_url"]
39
+ assert_equal "Piston::Git::Repository", info["repository_class"]
40
+
41
+ response = `git-ls-remote git://github.com/technoweenie/attachment_fu.git`
42
+ head_commit = response.grep(/HEAD/).first.chomp.split(/\s+/).first
43
+ assert_equal head_commit, info["handler"][Piston::Git::COMMIT]
44
+ end
45
+
46
+ STATUS = %Q(# On branch master
47
+ # Changes to be committed:
48
+ # (use "git reset HEAD <file>..." to unstage)
49
+ #
50
+ #\tnew file: vendor/attachment_fu/.piston.yml
51
+ #\tnew file: vendor/attachment_fu/CHANGELOG
52
+ #\tnew file: vendor/attachment_fu/README
53
+ #\tnew file: vendor/attachment_fu/Rakefile
54
+ #\tnew file: vendor/attachment_fu/amazon_s3.yml.tpl
55
+ #\tnew file: vendor/attachment_fu/init.rb
56
+ #\tnew file: vendor/attachment_fu/install.rb
57
+ #\tnew file: vendor/attachment_fu/lib/geometry.rb
58
+ #\tnew file: vendor/attachment_fu/lib/technoweenie/attachment_fu.rb
59
+ #\tnew file: vendor/attachment_fu/lib/technoweenie/attachment_fu/backends/db_file_backend.rb
60
+ #\tnew file: vendor/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb
61
+ #\tnew file: vendor/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb
62
+ #\tnew file: vendor/attachment_fu/lib/technoweenie/attachment_fu/processors/core_image_processor.rb
63
+ #\tnew file: vendor/attachment_fu/lib/technoweenie/attachment_fu/processors/gd2_processor.rb
64
+ #\tnew file: vendor/attachment_fu/lib/technoweenie/attachment_fu/processors/image_science_processor.rb
65
+ #\tnew file: vendor/attachment_fu/lib/technoweenie/attachment_fu/processors/mini_magick_processor.rb
66
+ #\tnew file: vendor/attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb
67
+ #\tnew file: vendor/attachment_fu/test/backends/db_file_test.rb
68
+ #\tnew file: vendor/attachment_fu/test/backends/file_system_test.rb
69
+ #\tnew file: vendor/attachment_fu/test/backends/remote/s3_test.rb
70
+ #\tnew file: vendor/attachment_fu/test/base_attachment_tests.rb
71
+ #\tnew file: vendor/attachment_fu/test/basic_test.rb
72
+ #\tnew file: vendor/attachment_fu/test/database.yml
73
+ #\tnew file: vendor/attachment_fu/test/extra_attachment_test.rb
74
+ #\tnew file: vendor/attachment_fu/test/fixtures/attachment.rb
75
+ #\tnew file: vendor/attachment_fu/test/fixtures/files/fake/rails.png
76
+ #\tnew file: vendor/attachment_fu/test/fixtures/files/foo.txt
77
+ #\tnew file: vendor/attachment_fu/test/fixtures/files/rails.png
78
+ #\tnew file: vendor/attachment_fu/test/geometry_test.rb
79
+ #\tnew file: vendor/attachment_fu/test/processors/core_image_test.rb
80
+ #\tnew file: vendor/attachment_fu/test/processors/gd2_test.rb
81
+ #\tnew file: vendor/attachment_fu/test/processors/image_science_test.rb
82
+ #\tnew file: vendor/attachment_fu/test/processors/mini_magick_test.rb
83
+ #\tnew file: vendor/attachment_fu/test/processors/rmagick_test.rb
84
+ #\tnew file: vendor/attachment_fu/test/schema.rb
85
+ #\tnew file: vendor/attachment_fu/test/test_helper.rb
86
+ #\tnew file: vendor/attachment_fu/test/validation_test.rb
87
+ #\tnew file: vendor/attachment_fu/vendor/red_artisan/core_image/filters/color.rb
88
+ #\tnew file: vendor/attachment_fu/vendor/red_artisan/core_image/filters/effects.rb
89
+ #\tnew file: vendor/attachment_fu/vendor/red_artisan/core_image/filters/perspective.rb
90
+ #\tnew file: vendor/attachment_fu/vendor/red_artisan/core_image/filters/quality.rb
91
+ #\tnew file: vendor/attachment_fu/vendor/red_artisan/core_image/filters/scale.rb
92
+ #\tnew file: vendor/attachment_fu/vendor/red_artisan/core_image/filters/watermark.rb
93
+ #\tnew file: vendor/attachment_fu/vendor/red_artisan/core_image/processor.rb
94
+ #
95
+ )
96
+ end
@@ -0,0 +1,131 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+ require File.dirname(__FILE__) + "/../integration_helpers"
3
+
4
+ class TestImportGitSvn < Test::Unit::TestCase
5
+ attr_reader :root_path, :repos_path, :wc_path
6
+
7
+ def setup
8
+ @root_path = Pathname.new("/tmp/import_git_svn")
9
+ @repos_path = @root_path + "repos"
10
+ @wc_path = @root_path + "wc"
11
+
12
+ root_path.rmtree rescue nil
13
+ root_path.mkpath
14
+
15
+ svnadmin :create, repos_path
16
+ svn :checkout, "file://#{repos_path}", wc_path
17
+ svn :mkdir, wc_path + "trunk", wc_path + "tags", wc_path + "branches", wc_path + "trunk/vendor"
18
+ svn :commit, wc_path, "--message", "'first commit'"
19
+ end
20
+
21
+ def teardown
22
+ root_path.rmtree rescue nil
23
+ end
24
+
25
+ def test_import
26
+ piston(:import, "git://github.com/technoweenie/attachment_fu.git", wc_path + "trunk/vendor/attachment_fu")
27
+
28
+ assert_equal ADD_STATUS.split("\n").sort, svn(:status, wc_path + "trunk/vendor").gsub((wc_path + "trunk/").to_s, "").split("\n").sort
29
+
30
+ info = YAML.load(File.read(wc_path + "trunk/vendor/attachment_fu/.piston.yml"))
31
+ assert_equal 1, info["format"]
32
+ assert_equal "git://github.com/technoweenie/attachment_fu.git", info["repository_url"]
33
+ assert_equal "Piston::Git::Repository", info["repository_class"]
34
+
35
+ response = `git-ls-remote git://github.com/technoweenie/attachment_fu.git`
36
+ head_commit = response.grep(/HEAD/).first.chomp.split(/\s+/).first
37
+ assert_equal head_commit, info["handler"][Piston::Git::COMMIT]
38
+ end
39
+
40
+ def test_import_from_branch
41
+ piston(:import, "--revision", "origin/rewrite", "git://github.com/technoweenie/attachment_fu.git", wc_path + "trunk/vendor/attachment_fu")
42
+
43
+ assert File.directory?(wc_path + "trunk/vendor/attachment_fu/vendor"),
44
+ "Could not find vendor director in attachment_fu imported directory: please check that there still exists a rewrite branch on GitHub AND that the rewrite branch has a vendor/ directory."
45
+
46
+ info = YAML.load(File.read(wc_path + "trunk/vendor/attachment_fu/.piston.yml"))
47
+ assert_equal 1, info["format"]
48
+ assert_equal "git://github.com/technoweenie/attachment_fu.git", info["repository_url"]
49
+ assert_equal "Piston::Git::Repository", info["repository_class"]
50
+
51
+ response = `git-ls-remote git://github.com/technoweenie/attachment_fu.git`
52
+ head_commit = response.grep(/refs\/heads\/rewrite/).first.chomp.split(/\s+/).first
53
+ assert_equal head_commit, info["handler"][Piston::Git::COMMIT]
54
+ assert_equal "origin/rewrite", info["handler"][Piston::Git::BRANCH]
55
+ end
56
+
57
+ def test_import_from_tag
58
+ piston(:import, "--revision", "1.9.1", "git://github.com/francois/piston.git", wc_path + "trunk/vendor/piston")
59
+
60
+ info = YAML.load(File.read(wc_path + "trunk/vendor/piston/.piston.yml"))
61
+ assert_equal 1, info["format"]
62
+ assert_equal "git://github.com/francois/piston.git", info["repository_url"]
63
+ assert_equal "Piston::Git::Repository", info["repository_class"]
64
+
65
+ assert_equal "684301c8b5cc1c95fe1568fb80e8f4da20c2a235", info["handler"][Piston::Git::COMMIT]
66
+ assert_equal "1.9.1", info["handler"][Piston::Git::BRANCH]
67
+ end
68
+
69
+ ADD_STATUS = %Q(A vendor/attachment_fu
70
+ A vendor/attachment_fu/test
71
+ A vendor/attachment_fu/test/test_helper.rb
72
+ A vendor/attachment_fu/test/processors
73
+ A vendor/attachment_fu/test/processors/mini_magick_test.rb
74
+ A vendor/attachment_fu/test/processors/core_image_test.rb
75
+ A vendor/attachment_fu/test/processors/image_science_test.rb
76
+ A vendor/attachment_fu/test/processors/gd2_test.rb
77
+ A vendor/attachment_fu/test/processors/rmagick_test.rb
78
+ A vendor/attachment_fu/test/basic_test.rb
79
+ A vendor/attachment_fu/test/schema.rb
80
+ A vendor/attachment_fu/test/database.yml
81
+ A vendor/attachment_fu/test/base_attachment_tests.rb
82
+ A vendor/attachment_fu/test/fixtures
83
+ A vendor/attachment_fu/test/fixtures/files
84
+ A vendor/attachment_fu/test/fixtures/files/foo.txt
85
+ A vendor/attachment_fu/test/fixtures/files/fake
86
+ A vendor/attachment_fu/test/fixtures/files/fake/rails.png
87
+ A vendor/attachment_fu/test/fixtures/files/rails.png
88
+ A vendor/attachment_fu/test/fixtures/attachment.rb
89
+ A vendor/attachment_fu/test/backends
90
+ A vendor/attachment_fu/test/backends/file_system_test.rb
91
+ A vendor/attachment_fu/test/backends/db_file_test.rb
92
+ A vendor/attachment_fu/test/backends/remote
93
+ A vendor/attachment_fu/test/backends/remote/s3_test.rb
94
+ A vendor/attachment_fu/test/validation_test.rb
95
+ A vendor/attachment_fu/test/extra_attachment_test.rb
96
+ A vendor/attachment_fu/test/geometry_test.rb
97
+ A vendor/attachment_fu/Rakefile
98
+ A vendor/attachment_fu/init.rb
99
+ A vendor/attachment_fu/lib
100
+ A vendor/attachment_fu/lib/technoweenie
101
+ A vendor/attachment_fu/lib/technoweenie/attachment_fu
102
+ A vendor/attachment_fu/lib/technoweenie/attachment_fu/processors
103
+ A vendor/attachment_fu/lib/technoweenie/attachment_fu/processors/mini_magick_processor.rb
104
+ A vendor/attachment_fu/lib/technoweenie/attachment_fu/processors/core_image_processor.rb
105
+ A vendor/attachment_fu/lib/technoweenie/attachment_fu/processors/image_science_processor.rb
106
+ A vendor/attachment_fu/lib/technoweenie/attachment_fu/processors/gd2_processor.rb
107
+ A vendor/attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb
108
+ A vendor/attachment_fu/lib/technoweenie/attachment_fu/backends
109
+ A vendor/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb
110
+ A vendor/attachment_fu/lib/technoweenie/attachment_fu/backends/db_file_backend.rb
111
+ A vendor/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb
112
+ A vendor/attachment_fu/lib/technoweenie/attachment_fu.rb
113
+ A vendor/attachment_fu/lib/geometry.rb
114
+ A vendor/attachment_fu/CHANGELOG
115
+ A vendor/attachment_fu/amazon_s3.yml.tpl
116
+ A vendor/attachment_fu/install.rb
117
+ A vendor/attachment_fu/.piston.yml
118
+ A vendor/attachment_fu/vendor
119
+ A vendor/attachment_fu/vendor/red_artisan
120
+ A vendor/attachment_fu/vendor/red_artisan/core_image
121
+ A vendor/attachment_fu/vendor/red_artisan/core_image/processor.rb
122
+ A vendor/attachment_fu/vendor/red_artisan/core_image/filters
123
+ A vendor/attachment_fu/vendor/red_artisan/core_image/filters/watermark.rb
124
+ A vendor/attachment_fu/vendor/red_artisan/core_image/filters/color.rb
125
+ A vendor/attachment_fu/vendor/red_artisan/core_image/filters/effects.rb
126
+ A vendor/attachment_fu/vendor/red_artisan/core_image/filters/scale.rb
127
+ A vendor/attachment_fu/vendor/red_artisan/core_image/filters/quality.rb
128
+ A vendor/attachment_fu/vendor/red_artisan/core_image/filters/perspective.rb
129
+ A vendor/attachment_fu/README
130
+ )
131
+ end
@@ -0,0 +1,52 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+ require File.dirname(__FILE__) + "/../integration_helpers"
3
+
4
+ class TestImportSvnGit < Test::Unit::TestCase
5
+ attr_reader :root_path, :repos_path, :wc_path
6
+
7
+ def setup
8
+ @root_path = Pathname.new("/tmp/import_svn_git")
9
+ @repos_path = @root_path + "repos"
10
+ @wc_path = @root_path + "wc"
11
+
12
+ root_path.rmtree rescue nil
13
+ root_path.mkpath
14
+
15
+ wc_path.mkpath
16
+ Dir.chdir(wc_path) do
17
+ git(:init)
18
+ File.open(wc_path + "README", "wb") {|f| f.write "Hello World!"}
19
+ (wc_path + "vendor").mkdir
20
+ File.open(wc_path + "vendor/.gitignore", "wb") {|f| f.write "*.swp"}
21
+ git(:add, ".")
22
+ git(:commit, "-m", "'first commit'")
23
+ end
24
+ end
25
+
26
+ def teardown
27
+ root_path.rmtree rescue nil
28
+ end
29
+
30
+ def test_import
31
+ piston :import, "http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/", wc_path + "vendor/ssl_requirement"
32
+
33
+ Dir.chdir(wc_path) do
34
+ assert_equal %Q(# On branch master
35
+ # Changes to be committed:
36
+ # (use "git reset HEAD <file>..." to unstage)
37
+ #
38
+ #\tnew file: vendor/ssl_requirement/.piston.yml
39
+ #\tnew file: vendor/ssl_requirement/README
40
+ #\tnew file: vendor/ssl_requirement/lib/ssl_requirement.rb
41
+ #\tnew file: vendor/ssl_requirement/test/ssl_requirement_test.rb
42
+ #
43
+ ).split("\n").sort, git(:status).split("\n").sort
44
+ end
45
+
46
+ info = YAML.load(File.read(wc_path + "vendor/ssl_requirement/.piston.yml"))
47
+ assert_equal 1, info["format"]
48
+ assert_equal "http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/", info["repository_url"]
49
+ assert_equal "Piston::Svn::Repository", info["repository_class"]
50
+ assert_equal "5ecf4fe2-1ee6-0310-87b1-e25e094e27de", info["handler"][Piston::Svn::UUID]
51
+ end
52
+ end
@@ -0,0 +1,43 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+ require File.dirname(__FILE__) + "/../integration_helpers"
3
+
4
+ class TestImportSvnSvn < Test::Unit::TestCase
5
+ attr_reader :root_path, :repos_path, :wc_path
6
+
7
+ def setup
8
+ @root_path = Pathname.new("/tmp/import_svn_svn")
9
+ @repos_path = @root_path + "repos"
10
+ @wc_path = @root_path + "wc"
11
+
12
+ root_path.rmtree rescue nil
13
+ root_path.mkpath
14
+
15
+ svnadmin :create, repos_path
16
+ svn :checkout, "file://#{repos_path}", wc_path
17
+ svn :mkdir, wc_path + "trunk", wc_path + "tags", wc_path + "branches", wc_path + "trunk/vendor"
18
+ svn :commit, wc_path, "--message", "'first commit'"
19
+ end
20
+
21
+ def teardown
22
+ root_path.rmtree rescue nil
23
+ end
24
+
25
+ def test_import
26
+ piston :import, "http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/", wc_path + "trunk/vendor/ssl_requirement"
27
+
28
+ assert_equal "A vendor/ssl_requirement
29
+ A vendor/ssl_requirement/test
30
+ A vendor/ssl_requirement/test/ssl_requirement_test.rb
31
+ A vendor/ssl_requirement/lib
32
+ A vendor/ssl_requirement/lib/ssl_requirement.rb
33
+ A vendor/ssl_requirement/.piston.yml
34
+ A vendor/ssl_requirement/README
35
+ ".split("\n").sort, svn(:status, wc_path + "trunk/vendor/").gsub((wc_path + "trunk/").to_s, "").split("\n").sort
36
+
37
+ info = YAML.load(File.read(wc_path + "trunk/vendor/ssl_requirement/.piston.yml"))
38
+ assert_equal 1, info["format"]
39
+ assert_equal "http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/", info["repository_url"]
40
+ assert_equal "Piston::Svn::Repository", info["repository_class"]
41
+ assert_equal "5ecf4fe2-1ee6-0310-87b1-e25e094e27de", info["handler"][Piston::Svn::UUID]
42
+ end
43
+ end
@@ -0,0 +1,33 @@
1
+ PISTON_ROOT = Pathname.new(File.dirname(__FILE__)).parent.realpath
2
+
3
+ def logger
4
+ @logger ||= Log4r::Logger["test"]
5
+ end
6
+
7
+ def runcmd(cmd, *args)
8
+ cmdline = [cmd]
9
+ cmdline += args
10
+ cmdline = cmdline.flatten.map {|s| s.to_s}.join(" ")
11
+ logger.debug "> #{cmdline}"
12
+
13
+ output = `#{cmdline}`
14
+ logger.debug "< #{output}"
15
+ return output if $?.success?
16
+ raise output
17
+ end
18
+
19
+ def svn(*args)
20
+ runcmd(:svn, *args)
21
+ end
22
+
23
+ def svnadmin(*args)
24
+ runcmd(:svnadmin, *args)
25
+ end
26
+
27
+ def git(*args)
28
+ runcmd(:git, *args)
29
+ end
30
+
31
+ def piston(*args)
32
+ runcmd(:ruby, "-I", PISTON_ROOT + "lib", PISTON_ROOT + "bin/piston", *args)
33
+ end