piston 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,9 @@
1
1
  *SVN*
2
2
 
3
+ 2007-03-22 1.3.3
4
+ * Repaired problems with import subcommand. Wrote specifications to prevent
5
+ the same failure mode again.
6
+
3
7
  2007-03-09 1.3.2
4
8
  * piston switch had a bad constant access which caused failures.
5
9
 
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
- require 'rake/testtask'
3
2
  require 'rake/gempackagetask'
4
3
  require 'rake/contrib/rubyforgepublisher'
4
+ require 'spec/rake/spectask'
5
5
  require File.join(File.dirname(__FILE__), 'lib', 'piston', 'version')
6
6
 
7
7
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
@@ -14,15 +14,10 @@ RELEASE_NAME = "REL #{PKG_VERSION}"
14
14
  RUBY_FORGE_PROJECT = "piston"
15
15
  RUBY_FORGE_USER = "fbos"
16
16
 
17
- task :default => :test
18
- Rake::TestTask.new { |t|
19
- t.pattern = 'test/**/*_test.rb'
20
- t.verbose = true
21
- t.warning = false
22
- }
17
+ task :default => :specs
23
18
 
24
19
  # Create compressed packages
25
- dist_dirs = [ "lib", "test"]
20
+ dist_dirs = [ "lib", "spec"]
26
21
 
27
22
  spec = Gem::Specification.new do |s|
28
23
  s.name = PKG_NAME
@@ -34,7 +29,7 @@ spec = Gem::Specification.new do |s|
34
29
  s.executables = ["piston"]
35
30
  s.default_executable = "piston"
36
31
 
37
- s.files = [ "CHANGELOG", "README", "LICENSE", "Rakefile" ] + FileList["{contrib,bin,test,lib}/**/*"].to_a
32
+ s.files = [ "CHANGELOG", "README", "LICENSE", "Rakefile" ] + FileList["{contrib,bin,spec,lib}/**/*"].to_a
38
33
 
39
34
  s.require_path = 'lib'
40
35
  s.has_rdoc = false
@@ -61,3 +56,8 @@ task :release => [ :package ] do
61
56
  system(release_command)
62
57
  end
63
58
  end
59
+
60
+ desc "Run all examples with RCov"
61
+ Spec::Rake::SpecTask.new('specs') do |t|
62
+ t.spec_files = FileList['specs/**/*.rb']
63
+ end
@@ -18,8 +18,8 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- # $HeadURL: svn+ssh://fbos@rubyforge.org/var/svn/piston/tags/1.3.2/lib/piston.rb $
22
- # $Id: piston.rb 86 2007-03-01 16:33:06Z fbos $
21
+ # $HeadURL: svn+ssh://fbos@rubyforge.org/var/svn/piston/tags/1.3.3/lib/piston.rb $
22
+ # $Id: piston.rb 93 2007-03-13 19:41:08Z fbos $
23
23
 
24
24
  require 'yaml'
25
25
  require 'uri'
@@ -31,8 +31,10 @@ Dir[File.join(PISTON_ROOT, 'core_ext', '*.rb')].each do |file|
31
31
  end
32
32
 
33
33
  require "piston/version"
34
- require File.join(PISTON_ROOT, "transat", "parser")
35
- require File.join(PISTON_ROOT, 'piston', 'command')
34
+ require "piston/command"
35
+ require "piston/command_error"
36
+
37
+ require "transat/parser"
36
38
  Dir[File.join(PISTON_ROOT, "piston", "commands", "*.rb")].each do |file|
37
39
  require file.gsub(PISTON_ROOT, "")[1..-4]
38
40
  end
@@ -1,3 +1,5 @@
1
+ require "piston"
2
+
1
3
  module Piston
2
4
  # The base class which all commands subclass to obtain services from.
3
5
  class Command
@@ -8,23 +10,17 @@ module Piston
8
10
 
9
11
  def initialize(non_options, options)
10
12
  @args = non_options
11
- options.each do |option, value|
12
- self.send("#{option}=", value)
13
- end
14
- end
15
13
 
16
- # Execute this command. The arguments are pre-processed to expand any
17
- # wildcards using Dir#[]. This is because the Windows shell does not
18
- # know it should expand wildcards before calling an executable.
19
- def execute(args)
20
14
  # Because the Windows shell does not process wildcards, we must do it
21
15
  # here ourselves
22
- args.map do |arg|
16
+ @args.collect! do |arg|
23
17
  next arg unless arg =~ /[*?]/
24
18
  Dir[arg]
25
19
  end
26
20
 
27
- run(args.flatten)
21
+ options.each do |option, value|
22
+ self.send("#{option}=", value)
23
+ end
28
24
  end
29
25
 
30
26
  # Run a Subversion command using the shell. If the Subversion command
@@ -1,3 +1,5 @@
1
+ require "piston"
2
+
1
3
  module Piston
2
4
  # Raised whenever an argument is not correct during processing.
3
5
  class CommandError < ArgumentError; end
@@ -1,4 +1,6 @@
1
- require 'piston/commands/import'
1
+ require "piston"
2
+ require "piston/command"
3
+ require "piston/commands/import"
2
4
 
3
5
  module Piston
4
6
  module Commands
@@ -21,15 +23,15 @@ module Piston
21
23
  externals.each_line do |external|
22
24
  external.chomp!
23
25
  next if external.empty?
24
- next skip_no_match(external) unless external =~ /^([^ ]+)\s+(?:-r(\d+)\s+)?(.*)$/
26
+ next skip_no_match(external) unless external =~ /^([^ ]+)\s+(?:-r\s*(\d+)\s+)?(.*)$/
25
27
 
26
28
  local, revision, repos = $1, $2, $3
27
29
  lock = true if revision
28
30
  local_dir = File.join(dir, local)
29
31
  if File.exists?(local_dir)
30
- raise Piston::CommandError, "'#{local_dir}' is not a directory" unless File.directory?(local_dir)
32
+ raise Piston::CommandError, "#{local_dir.inspect} is not a directory" unless File.directory?(local_dir)
31
33
  status = svn(:status, local_dir)
32
- raise Piston::CommandError, "'#{local_dir}' has local modifications. Revert before trying again." unless status.empty?
34
+ raise Piston::CommandError, "#{local_dir.inspect} has local modifications:\n#{status}\nYour must revert or commit before trying again." unless status.empty?
33
35
  info = YAML::load(svn(:info, local_dir))
34
36
  revision = info['Last Changed Rev'] unless revision
35
37
  FileUtils.rm_rf(local_dir)
@@ -40,11 +42,11 @@ module Piston
40
42
 
41
43
  operations.each do |local_dir, revision, repos, lock|
42
44
  logging_stream.puts "Importing '#{repos}' to #{local_dir} (-r #{revision || 'HEAD'}#{' locked' if lock})"
43
- import = Piston::Commands::Import.new
45
+ import = Piston::Commands::Import.new([repos, local_dir], {})
44
46
  import.revision = revision
45
47
  import.verbose, import.quiet, import.logging_stream = self.verbose, self.quiet, self.logging_stream
46
48
  import.lock = lock
47
- import.run([repos, local_dir])
49
+ import.run
48
50
  logging_stream.puts
49
51
  end
50
52
  end
@@ -1,3 +1,6 @@
1
+ require "piston"
2
+ require "piston/command"
3
+
1
4
  module Piston
2
5
  module Commands
3
6
  class Import < Piston::Command
@@ -1,3 +1,6 @@
1
+ require "piston"
2
+ require "piston/command"
3
+
1
4
  module Piston
2
5
  module Commands
3
6
  class Lock < Piston::Command
@@ -1,3 +1,5 @@
1
+ require "piston"
2
+ require "piston/command"
1
3
  require 'pp'
2
4
 
3
5
  module Piston
@@ -1,3 +1,6 @@
1
+ require "piston"
2
+ require "piston/command"
3
+
1
4
  module Piston
2
5
  module Commands
3
6
  class Switch < Piston::Command
@@ -33,15 +36,13 @@ module Piston
33
36
  local_revision = local_revision.succ
34
37
 
35
38
  new_info = YAML::load(svn(:info, new_repos))
36
- raise Piston::CommandError unless uuid == new_info['Repository UUID']
39
+ raise Piston::CommandError, "Switching repositories is not supported at this time\nYou initially imported from #{uuid}, but are now importing from #{new_info['Repository UUID']}" unless uuid == new_info['Repository UUID']
37
40
 
38
41
  logging_stream.puts " Fetching remote repository's latest revision and UUID"
39
42
  info = YAML::load(svn(:info, "#{repos}@#{remote_revision}"))
40
43
  return skip(dir, "Repository UUID changed\n Expected #{uuid}\n Found #{info['Repository UUID']}\n Repository: #{repos}") unless uuid == info['Repository UUID']
41
44
 
42
45
  new_remote_rev = new_info['Last Changed Rev'].to_i
43
- return skip(dir, "unchanged from revision #{remote_revision}", false) if remote_revision == new_remote_rev
44
-
45
46
  revisions = (remote_revision .. (revision || new_remote_rev))
46
47
 
47
48
  logging_stream.puts " Restoring remote repository to known state at r#{revisions.first}"
@@ -1,3 +1,6 @@
1
+ require "piston"
2
+ require "piston/command"
3
+
1
4
  module Piston
2
5
  module Commands
3
6
  class Unlock < Piston::Command
@@ -1,3 +1,5 @@
1
+ require "piston"
2
+ require "piston/command"
1
3
  require 'find'
2
4
 
3
5
  module Piston
@@ -1,8 +1,10 @@
1
+ require "piston"
2
+
1
3
  module Piston
2
4
  module VERSION #:nodoc:
3
5
  MAJOR = 1
4
6
  MINOR = 3
5
- TINY = 2
7
+ TINY = 3
6
8
 
7
9
  STRING = [MAJOR, MINOR, TINY].join('.')
8
10
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: piston
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.3.2
7
- date: 2007-03-09 00:00:00 -05:00
6
+ version: 1.3.3
7
+ date: 2007-03-22 00:00:00 -04:00
8
8
  summary: Piston is a utility that enables merge tracking of remote repositories.
9
9
  require_paths:
10
10
  - lib
@@ -36,15 +36,10 @@ files:
36
36
  - contrib/piston
37
37
  - bin/piston
38
38
  - lib/core_ext
39
- - lib/piston
40
- - lib/transat
41
- - lib/piston.rb
42
39
  - lib/core_ext/string.rb
43
40
  - lib/core_ext/range.rb
41
+ - lib/piston
44
42
  - lib/piston/commands
45
- - lib/piston/command.rb
46
- - lib/piston/command_error.rb
47
- - lib/piston/version.rb
48
43
  - lib/piston/commands/convert.rb
49
44
  - lib/piston/commands/switch.rb
50
45
  - lib/piston/commands/update.rb
@@ -52,7 +47,12 @@ files:
52
47
  - lib/piston/commands/lock.rb
53
48
  - lib/piston/commands/import.rb
54
49
  - lib/piston/commands/unlock.rb
50
+ - lib/piston/command.rb
51
+ - lib/piston/version.rb
52
+ - lib/piston/command_error.rb
53
+ - lib/transat
55
54
  - lib/transat/parser.rb
55
+ - lib/piston.rb
56
56
  test_files: []
57
57
 
58
58
  rdoc_options: []