| |   |
| 1 | *SVN* |
| 2 | |
| 3 | * New Piston2 |
| 4 | |
| 5 | 2007-06-28 branches/piston1 -- NEVER RELEASED |
| 6 | * Per http://rubyforge.org/tracker/?func=detail&atid=8179&aid=10717&group_id=2105 |
| 7 | Don't set LC_ALL, but set LANGUAGE so that repositories with foreign |
| 8 | characters can be used. Thanks go to Per Wigren. |
| 9 | |
| 10 | 2007-03-22 1.3.3 |
| 11 | * Repaired problems with import subcommand. Wrote specifications to prevent |
| 12 | the same failure mode again. |
| 13 | |
| 14 | 2007-03-09 1.3.2 |
| 15 | * piston switch had a bad constant access which caused failures. |
| 16 | |
| 17 | 2007-03-09 1.3.1 |
| 18 | * piston switch would fail if the branch from which we are reading had been |
| 19 | deleted. |
| 20 | * piston switch had a major bug. It did not update the piston:root property |
| 21 | to remember the new repository root. Reported and fixed by Graeme |
| 22 | Mathieson. |
| 23 | * piston switch errors out early if not provided with the right arguments. |
| 24 | Thanks to Graeme Mathieson for the info and patch. |
| 25 | * New internal command parser. No visible external changes. |
| 26 | |
| 27 | 2007-01-22 1.3.0 |
| 28 | * Piston status shows the revision number of locked repositories. Thanks to |
| 29 | Chris Wanstrath <http://errtheblog.com/>. |
| 30 | * New piston switch subcommand to switch repository locations. Thanks to |
| 31 | Greg Spurrier for the prompt which resulted in finally implementing this. |
| 32 | |
| 33 | 2006-11-20 1.2.1 |
| 34 | * Import subcommand would fail with a "svn: Explicit target required |
| 35 | ('vendor/rails' interpreted as prop value)" error. This was a minor |
| 36 | error in the import code. Reported by Daniel N. |
| 37 | * The import subcommand could import another revision than what was intended, |
| 38 | if HEAD was updated while the import is in progress. |
| 39 | |
| 40 | 2006-11-17 1.2.0 |
| 41 | * New status subcommand. Shows M if locally or remotely modified. Applies to |
| 42 | one, many, all folders. This subcommand *requires* the use of a Subversion |
| 43 | 1.2.0 client. Thanks to Chris Wanstrath for the inspiration. His Rake |
| 44 | tasks are available at http://errtheblog.com/post/38. |
| 45 | * Minor patch by Miguel Ibero Carreras to make Subversion always use the |
| 46 | C locale, instead of the current one. This allows Piston to be used |
| 47 | with internationalized versions of Subversion. David Bittencourt later |
| 48 | reported the same problem. Thanks! |
| 49 | * Better handle how update finds it's latest local revision to prevent |
| 50 | conflicts. If you had never locally changed your vendor repositories, |
| 51 | this fix will change nothing for you. This helps prevent local conflicts |
| 52 | if you had ever applied a local patch. |
| 53 | *CAVEAT*: See the release announcement at |
| 54 | http://blog.teksol.info/articles/2006/11/17/piston-1-2-0-status-better-update |
| 55 | for a required local operation. |
| 56 | |
| 57 | 2006-08-30 1.1.1 |
| 58 | * Add contrib/piston [Michael Schuerig] |
| 59 | * Non-recursively add the root directory of the managed folder then set Piston |
| 60 | properties before adding the contents of the managed folder. This is to |
| 61 | help ease work along if an inconsistent EOL is encountered during the |
| 62 | import. The user can finish the import by svn add'ing the rest of the |
| 63 | folder until all files are added. Piston properties will already have been |
| 64 | set. |
| 65 | |
| 66 | 2006-08-26 1.1.0 |
| 67 | * New 'convert' subcommand converts existing svn:externals to Piston managed |
| 68 | folders. Thanks to Dan Kubb for the idea. |
| 69 | * update now recursively finds the folders to process. It bases it's search |
| 70 | on the presence or absence of the piston:root property. |
| 71 | * Changed lock and unlock messages to be more detailed. |
| 72 | |
| 73 | 2006-08-24 1.0.1 |
| 74 | * Corrected minor bug where the core extensions were in core_ext/core_ext |
| 75 | instead of being in core_ext. |
| 76 | * Require the parent working copy path be at HEAD before importing / updating. |
| 77 | * Don't do unnecessary merges if the file had not changed prior to the update. |
| 78 | * During the update, if adding a folder, do an svn mkdir instead of a cp_r. |
| 79 | |
| 80 | 2006-08-24 1.0.0 |
| 81 | * Initial version |
| toggle raw diff |
--- /dev/null
+++ b/History.txt
@@ -0,0 +1,81 @@
+*SVN*
+
+* New Piston2
+
+2007-06-28 branches/piston1 -- NEVER RELEASED
+* Per http://rubyforge.org/tracker/?func=detail&atid=8179&aid=10717&group_id=2105
+ Don't set LC_ALL, but set LANGUAGE so that repositories with foreign
+ characters can be used. Thanks go to Per Wigren.
+
+2007-03-22 1.3.3
+* Repaired problems with import subcommand. Wrote specifications to prevent
+ the same failure mode again.
+
+2007-03-09 1.3.2
+* piston switch had a bad constant access which caused failures.
+
+2007-03-09 1.3.1
+* piston switch would fail if the branch from which we are reading had been
+ deleted.
+* piston switch had a major bug. It did not update the piston:root property
+ to remember the new repository root. Reported and fixed by Graeme
+ Mathieson.
+* piston switch errors out early if not provided with the right arguments.
+ Thanks to Graeme Mathieson for the info and patch.
+* New internal command parser. No visible external changes.
+
+2007-01-22 1.3.0
+* Piston status shows the revision number of locked repositories. Thanks to
+ Chris Wanstrath <http://errtheblog.com/>.
+* New piston switch subcommand to switch repository locations. Thanks to
+ Greg Spurrier for the prompt which resulted in finally implementing this.
+
+2006-11-20 1.2.1
+* Import subcommand would fail with a "svn: Explicit target required
+ ('vendor/rails' interpreted as prop value)" error. This was a minor
+ error in the import code. Reported by Daniel N.
+* The import subcommand could import another revision than what was intended,
+ if HEAD was updated while the import is in progress.
+
+2006-11-17 1.2.0
+* New status subcommand. Shows M if locally or remotely modified. Applies to
+ one, many, all folders. This subcommand *requires* the use of a Subversion
+ 1.2.0 client. Thanks to Chris Wanstrath for the inspiration. His Rake
+ tasks are available at http://errtheblog.com/post/38.
+* Minor patch by Miguel Ibero Carreras to make Subversion always use the
+ C locale, instead of the current one. This allows Piston to be used
+ with internationalized versions of Subversion. David Bittencourt later
+ reported the same problem. Thanks!
+* Better handle how update finds it's latest local revision to prevent
+ conflicts. If you had never locally changed your vendor repositories,
+ this fix will change nothing for you. This helps prevent local conflicts
+ if you had ever applied a local patch.
+ *CAVEAT*: See the release announcement at
+ http://blog.teksol.info/articles/2006/11/17/piston-1-2-0-status-better-update
+ for a required local operation.
+
+2006-08-30 1.1.1
+* Add contrib/piston [Michael Schuerig]
+* Non-recursively add the root directory of the managed folder then set Piston
+ properties before adding the contents of the managed folder. This is to
+ help ease work along if an inconsistent EOL is encountered during the
+ import. The user can finish the import by svn add'ing the rest of the
+ folder until all files are added. Piston properties will already have been
+ set.
+
+2006-08-26 1.1.0
+* New 'convert' subcommand converts existing svn:externals to Piston managed
+ folders. Thanks to Dan Kubb for the idea.
+* update now recursively finds the folders to process. It bases it's search
+ on the presence or absence of the piston:root property.
+* Changed lock and unlock messages to be more detailed.
+
+2006-08-24 1.0.1
+* Corrected minor bug where the core extensions were in core_ext/core_ext
+ instead of being in core_ext.
+* Require the parent working copy path be at HEAD before importing / updating.
+* Don't do unnecessary merges if the file had not changed prior to the update.
+* During the update, if adding a folder, do an svn mkdir instead of a cp_r.
+
+2006-08-24 1.0.0
+* Initial version |
| |   |
| 1 | Copyright (c) 2006 Francois Beausoleil <francois@teksol.info> |
| 2 | |
| 3 | Permission is hereby granted, free of charge, to any person obtaining a copy |
| 4 | of this software and associated documentation files (the "Software"), to deal |
| 5 | in the Software without restriction, including without limitation the rights |
| 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 7 | copies of the Software, and to permit persons to whom the Software is |
| 8 | furnished to do so, subject to the following conditions: |
| 9 | |
| 10 | The above copyright notice and this permission notice shall be included in |
| 11 | all copies or substantial portions of the Software. |
| 12 | |
| 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 19 | THE SOFTWARE. |
| toggle raw diff |
--- /dev/null
+++ b/License.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2006 Francois Beausoleil <francois@teksol.info>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
|
| |   |
| 1 | Piston is a utility that eases vendor branch management. |
| 2 | This is similar to <tt>svn:externals</tt>, except you have a local copy of |
| 3 | the files, which you can modify at will. As long as the changes are |
| 4 | mergeable, you should have no problems. |
| 5 | |
| 6 | This tool has a similar purpose than svnmerge.py which you can find in the |
| 7 | contrib/client-side folder of the main Subversion repository at |
| 8 | http://svn.collab.net/repos/svn/trunk/contrib/client-side/svnmerge.py. |
| 9 | The main difference is that Piston is designed to work with remote |
| 10 | repositories. Another tool you might want to look at, SVK, which you can find |
| 11 | at http://svk.elixus.org/. |
| 12 | |
| 13 | From Wikipedia's Piston page (http://en.wikipedia.org/wiki/Piston): |
| 14 | In general, a piston is a sliding plug that fits closely inside the bore |
| 15 | of a cylinder. |
| 16 | |
| 17 | Its purpose is either to change the volume enclosed by the cylinder, or |
| 18 | to exert a force on a fluid inside the cylinder. |
| 19 | |
| 20 | For this utility, I retain the second meaning, "to exert a force on a fluid |
| 21 | inside the cylinder." Piston forces the content of a remote repository |
| 22 | location back into our own. |
| 23 | |
| 24 | |
| 25 | = Installation |
| 26 | |
| 27 | Nothing could be simpler: |
| 28 | |
| 29 | $ gem install --include-dependencies piston |
| 30 | |
| 31 | |
| 32 | = Usage |
| 33 | |
| 34 | First, you need to import the remote repository location: |
| 35 | |
| 36 | $ piston import http://dev.rubyonrails.org/svn/rails/trunk vendor/rails |
| 37 | Exported r4720 from 'http://dev.rubyonrails.org/svn/rails/trunk' to 'vendor/rails' |
| 38 | |
| 39 | $ svn commit -m "Importing local copy of Rails" |
| 40 | |
| 41 | When you want to get the latest changes from the remote repository location: |
| 42 | |
| 43 | $ piston update vendor/rails |
| 44 | Updated 'vendor/rails' to r4720. |
| 45 | |
| 46 | $ svn commit -m "Updates vendor/rails to the latest revision" |
| 47 | |
| 48 | You can prevent a local Piston-managed folder from updating by using the |
| 49 | +lock+ subcommand: |
| 50 | |
| 51 | $ piston lock vendor/rails |
| 52 | 'vendor/rails' locked at r4720. |
| 53 | |
| 54 | When you want to update again, you unlock: |
| 55 | |
| 56 | $ piston unlock vendor/rails |
| 57 | 'vendor/rails' unlocked. |
| 58 | |
| 59 | If the branch you are following moves, you should use the switch subcommand: |
| 60 | |
| 61 | $ piston import http://dev.rubyonrails.org/svn/rails/branches/1-2-pre-release vendor/rails |
| 62 | $ svn commit vendor/rails |
| 63 | |
| 64 | # Vendor branch is renamed, let's follow it |
| 65 | $ piston switch http://dev.rubyonrails.org/svn/rails/branches/1-2-stable vendor/rails |
| 66 | |
| 67 | |
| 68 | = Contributions |
| 69 | |
| 70 | == Bash Shell Completion Script |
| 71 | |
| 72 | Michael Schuerig contributed a Bash shell completion script. You should copy |
| 73 | +contrib/piston+ from your gem repository to the appropriate folder. Michael |
| 74 | said: |
| 75 | |
| 76 | I've put together a bash completion function for piston. On Debian, I |
| 77 | just put it in /etc/bash_completion.d, alternatively, the contents can |
| 78 | be copied to ~/.bash_completion. I don't know how things are organized |
| 79 | on other Unix/Linux systems. |
| 80 | |
| 81 | |
| 82 | = Caveats |
| 83 | |
| 84 | == Speed |
| 85 | |
| 86 | This tool is SLOW. The update process particularly so. I use a brute force |
| 87 | approach. Subversion cannot merge from remote repositories, so instead I |
| 88 | checkout the folder at the initial revision, and then run svn update and |
| 89 | parse the results of that to determine what changes have occured. |
| 90 | |
| 91 | If a local copy of a file was changed, it's changes will be merged back in. |
| 92 | If that introduces a conflict, Piston will not detect it. The commit will be |
| 93 | rejected by Subversion anyway. |
| 94 | |
| 95 | == Copies / Renames |
| 96 | |
| 97 | Piston *does not* track copies. Since Subversion does renames in two |
| 98 | phases (copy + delete), that is what Piston does. |
| 99 | |
| 100 | == Local Operations Only |
| 101 | |
| 102 | Piston only works if you have a working copy. It also never commits your |
| 103 | working copy directly. You are responsible for reviewing the changes and |
| 104 | applying any pending fixes. |
| 105 | |
| 106 | == Remote Repository UUID |
| 107 | |
| 108 | Piston caches the remote repository UUID, allowing it to know if the remote |
| 109 | repos is still the same. Piston refuses to work against a different |
| 110 | repository than the one we checked out from originally. |
| 111 | |
| 112 | |
| 113 | = Subversion Properties Used |
| 114 | |
| 115 | * <tt>piston:uuid</tt>: The remote repository's UUID, which we always confirm |
| 116 | before doing any operations. |
| 117 | * <tt>piston:root</tt>: The repository root URL from which this Piston folder |
| 118 | was exported from. |
| 119 | * <tt>piston:remote-revision</tt>: The <tt>Last Changed Rev</tt> of the remote |
| 120 | repository. |
| 121 | * <tt>piston:local-revision</tt>: The <tt>Last Changed Rev</tt> of the Piston |
| 122 | managed folder, to enable us to know if we need to do any merging. |
| 123 | * <tt>piston:locked</tt>: The revision at which this folder is locked. If |
| 124 | this property is set and non-blank, Piston will skip the folder with |
| 125 | an appropriate message. |
| 126 | |
| 127 | |
| 128 | = Dependencies |
| 129 | |
| 130 | Piston depends on the following libraries: |
| 131 | |
| 132 | * yaml |
| 133 | * uri |
| 134 | * fileutils |
| toggle raw diff |
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,134 @@
+Piston is a utility that eases vendor branch management.
+This is similar to <tt>svn:externals</tt>, except you have a local copy of
+the files, which you can modify at will. As long as the changes are
+mergeable, you should have no problems.
+
+This tool has a similar purpose than svnmerge.py which you can find in the
+contrib/client-side folder of the main Subversion repository at
+http://svn.collab.net/repos/svn/trunk/contrib/client-side/svnmerge.py.
+The main difference is that Piston is designed to work with remote
+repositories. Another tool you might want to look at, SVK, which you can find
+at http://svk.elixus.org/.
+
+From Wikipedia's Piston page (http://en.wikipedia.org/wiki/Piston):
+ In general, a piston is a sliding plug that fits closely inside the bore
+ of a cylinder.
+
+ Its purpose is either to change the volume enclosed by the cylinder, or
+ to exert a force on a fluid inside the cylinder.
+
+For this utility, I retain the second meaning, "to exert a force on a fluid
+inside the cylinder." Piston forces the content of a remote repository
+location back into our own.
+
+
+= Installation
+
+Nothing could be simpler:
+
+ $ gem install --include-dependencies piston
+
+
+= Usage
+
+First, you need to import the remote repository location:
+
+ $ piston import http://dev.rubyonrails.org/svn/rails/trunk vendor/rails
+ Exported r4720 from 'http://dev.rubyonrails.org/svn/rails/trunk' to 'vendor/rails'
+
+ $ svn commit -m "Importing local copy of Rails"
+
+When you want to get the latest changes from the remote repository location:
+
+ $ piston update vendor/rails
+ Updated 'vendor/rails' to r4720.
+
+ $ svn commit -m "Updates vendor/rails to the latest revision"
+
+You can prevent a local Piston-managed folder from updating by using the
++lock+ subcommand:
+
+ $ piston lock vendor/rails
+ 'vendor/rails' locked at r4720.
+
+When you want to update again, you unlock:
+
+ $ piston unlock vendor/rails
+ 'vendor/rails' unlocked.
+
+If the branch you are following moves, you should use the switch subcommand:
+
+ $ piston import http://dev.rubyonrails.org/svn/rails/branches/1-2-pre-release vendor/rails
+ $ svn commit vendor/rails
+
+ # Vendor branch is renamed, let's follow it
+ $ piston switch http://dev.rubyonrails.org/svn/rails/branches/1-2-stable vendor/rails
+
+
+= Contributions
+
+== Bash Shell Completion Script
+
+Michael Schuerig contributed a Bash shell completion script. You should copy
++contrib/piston+ from your gem repository to the appropriate folder. Michael
+said:
+
+ I've put together a bash completion function for piston. On Debian, I
+ just put it in /etc/bash_completion.d, alternatively, the contents can
+ be copied to ~/.bash_completion. I don't know how things are organized
+ on other Unix/Linux systems.
+
+
+= Caveats
+
+== Speed
+
+This tool is SLOW. The update process particularly so. I use a brute force
+approach. Subversion cannot merge from remote repositories, so instead I
+checkout the folder at the initial revision, and then run svn update and
+parse the results of that to determine what changes have occured.
+
+If a local copy of a file was changed, it's changes will be merged back in.
+If that introduces a conflict, Piston will not detect it. The commit will be
+rejected by Subversion anyway.
+
+== Copies / Renames
+
+Piston *does not* track copies. Since Subversion does renames in two
+phases (copy + delete), that is what Piston does.
+
+== Local Operations Only
+
+Piston only works if you have a working copy. It also never commits your
+working copy directly. You are responsible for reviewing the changes and
+applying any pending fixes.
+
+== Remote Repository UUID
+
+Piston caches the remote repository UUID, allowing it to know if the remote
+repos is still the same. Piston refuses to work against a different
+repository than the one we checked out from originally.
+
+
+= Subversion Properties Used
+
+* <tt>piston:uuid</tt>: The remote repository's UUID, which we always confirm
+ before doing any operations.
+* <tt>piston:root</tt>: The repository root URL from which this Piston folder
+ was exported from.
+* <tt>piston:remote-revision</tt>: The <tt>Last Changed Rev</tt> of the remote
+ repository.
+* <tt>piston:local-revision</tt>: The <tt>Last Changed Rev</tt> of the Piston
+ managed folder, to enable us to know if we need to do any merging.
+* <tt>piston:locked</tt>: The revision at which this folder is locked. If
+ this property is set and non-blank, Piston will skip the folder with
+ an appropriate message.
+
+
+= Dependencies
+
+Piston depends on the following libraries:
+
+* yaml
+* uri
+* fileutils |
| |   |
| 1 | 1 | require 'rubygems' |
| 2 | require 'rake' |
| 3 | require 'rake/clean' |
| 4 | require 'rake/testtask' |
| 5 | require 'rake/packagetask' |
| 2 | 6 | require 'rake/gempackagetask' |
| 7 | require 'rake/rdoctask' |
| 3 | 8 | require 'rake/contrib/rubyforgepublisher' |
| 4 | | require 'spec/rake/spectask' |
| 5 | | require File.join(File.dirname(__FILE__), 'lib', 'piston', 'version') |
| 9 | require 'fileutils' |
| 10 | require 'hoe' |
| 11 | begin |
| 12 | require 'spec/rake/spectask' |
| 13 | rescue LoadError |
| 14 | puts 'To use rspec for testing you must install rspec gem:' |
| 15 | puts '$ sudo gem install rspec' |
| 16 | exit |
| 17 | end |
| 6 | 18 | |
| 7 | | PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : '' |
| 8 | | PKG_NAME = 'piston' |
| 9 | | PKG_VERSION = Piston::VERSION::STRING + PKG_BUILD |
| 10 | | PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" |
| 19 | include FileUtils |
| 20 | require File.join(File.dirname(__FILE__), 'lib', 'piston', 'version') |
| 11 | 21 | |
| 12 | | RELEASE_NAME = "REL #{PKG_VERSION}" |
| 22 | AUTHOR = 'Francois Beausoleil' # can also be an array of Authors |
| 23 | EMAIL = "francois@teksol.info" |
| 24 | DESCRIPTION = "description of gem" |
| 25 | GEM_NAME = 'piston' # what ppl will type to install your gem |
| 13 | 26 | |
| 14 | | RUBY_FORGE_PROJECT = "piston" |
| 15 | | RUBY_FORGE_USER = "fbos" |
| 27 | @config_file = "~/.rubyforge/user-config.yml" |
| 28 | @config = nil |
| 29 | def rubyforge_username |
| 30 | unless @config |
| 31 | begin |
| 32 | @config = YAML.load(File.read(File.expand_path(@config_file))) |
| 33 | rescue |
| 34 | puts <<-EOS |
| 35 | ERROR: No rubyforge config file found: #{@config_file}" |
| 36 | Run 'rubyforge setup' to prepare your env for access to Rubyforge |
| 37 | - See http://newgem.rubyforge.org/rubyforge.html for more details |
| 38 | EOS |
| 39 | exit |
| 40 | end |
| 41 | end |
| 42 | @rubyforge_username ||= @config["username"] |
| 43 | end |
| 16 | 44 | |
| 17 | | task :default => :specs |
| 45 | RUBYFORGE_PROJECT = 'piston' # The unix name for your project |
| 46 | HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org" |
| 47 | DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}" |
| 18 | 48 | |
| 19 | | # Create compressed packages |
| 20 | | dist_dirs = [ "lib", "spec"] |
| 49 | NAME = "piston" |
| 50 | REV = nil |
| 51 | # UNCOMMENT IF REQUIRED: |
| 52 | # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil |
| 53 | VERS = Piston::VERSION::STRING + (REV ? ".#{REV}" : "") |
| 54 | CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] |
| 55 | RDOC_OPTS = ['--quiet', '--title', 'piston documentation', |
| 56 | "--opname", "index.html", |
| 57 | "--line-numbers", |
| 58 | "--main", "README", |
| 59 | "--inline-source"] |
| 21 | 60 | |
| 22 | | spec = Gem::Specification.new do |s| |
| 23 | | s.name = PKG_NAME |
| 24 | | s.version = PKG_VERSION |
| 25 | | s.summary = "Piston is a utility that enables merge tracking of remote repositories." |
| 26 | | s.description = %q{This is similar to svn:externals, except you have a local copy of the files, which you can modify at will. As long as the changes are mergeable, you should have no problems.} |
| 61 | class Hoe |
| 62 | def extra_deps |
| 63 | @extra_deps.reject { |x| Array(x).first == 'hoe' } |
| 64 | end |
| 65 | end |
| 27 | 66 | |
| 28 | | s.bindir = "bin" # Use these for applications. |
| 29 | | s.executables = ["piston"] |
| 30 | | s.default_executable = "piston" |
| 67 | # Generate all the Rake tasks |
| 68 | # Run 'rake -T' to see list of generated tasks (from gem root directory) |
| 69 | hoe = Hoe.new(GEM_NAME, VERS) do |p| |
| 70 | p.author = AUTHOR |
| 71 | p.description = DESCRIPTION |
| 72 | p.email = EMAIL |
| 73 | p.summary = DESCRIPTION |
| 74 | p.url = HOMEPATH |
| 75 | p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT |
| 76 | p.test_globs = ["test/**/test_*.rb"] |
| 77 | p.clean_globs |= CLEAN #An array of file patterns to delete on clean. |
| 78 | |
| 79 | # == Optional |
| 80 | p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") |
| 81 | #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ] |
| 82 | #p.spec_extras = {} # A hash of extra values to set in the gemspec. |
| 83 | end |
| 31 | 84 | |
| 32 | | s.files = [ "CHANGELOG", "README", "LICENSE", "Rakefile" ] + FileList["{contrib,bin,spec,lib}/**/*"].to_a |
| 85 | CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n") |
| 86 | PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}" |
| 87 | hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc') |
| 33 | 88 | |
| 34 | | s.require_path = 'lib' |
| 35 | | s.has_rdoc = false |
| 89 | desc 'Generate website files' |
| 90 | task :website_generate do |
| 91 | Dir['website/**/*.txt'].each do |txt| |
| 92 | sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} } |
| 93 | end |
| 94 | end |
| 36 | 95 | |
| 37 | | s.author = "Francois Beausoleil" |
| 38 | | s.email = "francois@teksol.info" |
| 39 | | s.homepage = "http://piston.rubyforge.org/" |
| 40 | | s.rubyforge_project = "piston" |
| 96 | desc 'Upload website files to rubyforge' |
| 97 | task :website_upload do |
| 98 | host = "#{rubyforge_username}@rubyforge.org" |
| 99 | remote_dir = "/var/www/gforge-projects/#{PATH}/" |
| 100 | local_dir = 'website' |
| 101 | sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}} |
| 41 | 102 | end |
| 42 | 103 | |
| 43 | | Rake::GemPackageTask.new(spec) do |p| |
| 44 | | p.gem_spec = spec |
| 45 | | p.need_tar = true |
| 46 | | p.need_zip = true |
| 104 | desc 'Generate and upload website files' |
| 105 | task :website => [:website_generate, :website_upload, :publish_docs] |
| 106 | |
| 107 | desc 'Release the website and new gem version' |
| 108 | task :deploy => [:check_version, :website, :release] do |
| 109 | puts "Remember to create SVN tag:" |
| 110 | puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " + |
| 111 | "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} " |
| 112 | puts "Suggested comment:" |
| 113 | puts "Tagging release #{CHANGES}" |
| 47 | 114 | end |
| 48 | 115 | |
| 49 | | desc "Publish the release files to RubyForge." |
| 50 | | task :release => [ :package ] do |
| 51 | | `rubyforge login` |
| 116 | desc 'Runs tasks website_generate and install_gem as a local deployment of the gem' |
| 117 | task :local_deploy => [:website_generate, :install_gem] |
| 52 | 118 | |
| 53 | | for ext in %w( gem tgz zip ) |
| 54 | | release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" |
| 55 | | puts release_command |
| 56 | | system(release_command) |
| 119 | task :check_version do |
| 120 | unless ENV['VERSION'] |
| 121 | puts 'Must pass a VERSION=x.y.z release version' |
| 122 | exit |
| 123 | end |
| 124 | unless ENV['VERSION'] == VERS |
| 125 | puts "Please update your version.rb to match the release version, currently #{VERS}" |
| 126 | exit |
| 57 | 127 | end |
| 58 | 128 | end |
| 59 | 129 | |
| 60 | | desc "Run all examples with RCov" |
| 61 | | Spec::Rake::SpecTask.new('specs') do |t| |
| 62 | | t.spec_files = FileList['specs/**/*.rb'] |
| 130 | desc "Run the specs under spec/" |
| 131 | Spec::Rake::SpecTask.new do |t| |
| 132 | t.libs << File.dirname(__FILE__) + "/lib" |
| 133 | t.spec_opts = ['--options', "spec/spec.opts"] |
| 134 | t.spec_files = FileList['spec/*_spec.rb'] |
| 63 | 135 | end |
| 136 | |
| 137 | desc "Default task is to run specs" |
| 138 | task :default => :spec |
| 139 | |
| toggle raw diff |
--- a/Rakefile
+++ b/Rakefile
@@ -1,63 +1,139 @@
require 'rubygems'
+require 'rake'
+require 'rake/clean'
+require 'rake/testtask'
+require 'rake/packagetask'
require 'rake/gempackagetask'
+require 'rake/rdoctask'
require 'rake/contrib/rubyforgepublisher'
-require 'spec/rake/spectask'
-require File.join(File.dirname(__FILE__), 'lib', 'piston', 'version')
+require 'fileutils'
+require 'hoe'
+begin
+ require 'spec/rake/spectask'
+rescue LoadError
+ puts 'To use rspec for testing you must install rspec gem:'
+ puts '$ sudo gem install rspec'
+ exit
+end
-PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
-PKG_NAME = 'piston'
-PKG_VERSION = Piston::VERSION::STRING + PKG_BUILD
-PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
+include FileUtils
+require File.join(File.dirname(__FILE__), 'lib', 'piston', 'version')
-RELEASE_NAME = "REL #{PKG_VERSION}"
+AUTHOR = 'Francois Beausoleil' # can also be an array of Authors
+EMAIL = "francois@teksol.info"
+DESCRIPTION = "description of gem"
+GEM_NAME = 'piston' # what ppl will type to install your gem
-RUBY_FORGE_PROJECT = "piston"
-RUBY_FORGE_USER = "fbos"
+@config_file = "~/.rubyforge/user-config.yml"
+@config = nil
+def rubyforge_username
+ unless @config
+ begin
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
+ rescue
+ puts <<-EOS
+ERROR: No rubyforge config file found: #{@config_file}"
+Run 'rubyforge setup' to prepare your env for access to Rubyforge
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
+ EOS
+ exit
+ end
+ end
+ @rubyforge_username ||= @config["username"]
+end
-task :default => :specs
+RUBYFORGE_PROJECT = 'piston' # The unix name for your project
+HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
+DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
-# Create compressed packages
-dist_dirs = [ "lib", "spec"]
+NAME = "piston"
+REV = nil
+# UNCOMMENT IF REQUIRED:
+# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
+VERS = Piston::VERSION::STRING + (REV ? ".#{REV}" : "")
+CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
+RDOC_OPTS = ['--quiet', '--title', 'piston documentation',
+ "--opname", "index.html",
+ "--line-numbers",
+ "--main", "README",
+ "--inline-source"]
-spec = Gem::Specification.new do |s|
- s.name = PKG_NAME
- s.version = PKG_VERSION
- s.summary = "Piston is a utility that enables merge tracking of remote repositories."
- s.description = %q{This is similar to svn:externals, except you have a local copy of the files, which you can modify at will. As long as the changes are mergeable, you should have no problems.}
+class Hoe
+ def extra_deps
+ @extra_deps.reject { |x| Array(x).first == 'hoe' }
+ end
+end
- s.bindir = "bin" # Use these for applications.
- s.executables = ["piston"]
- s.default_executable = "piston"
+# Generate all the Rake tasks
+# Run 'rake -T' to see list of generated tasks (from gem root directory)
+hoe = Hoe.new(GEM_NAME, VERS) do |p|
+ p.author = AUTHOR
+ p.description = DESCRIPTION
+ p.email = EMAIL
+ p.summary = DESCRIPTION
+ p.url = HOMEPATH
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
+ p.test_globs = ["test/**/test_*.rb"]
+ p.clean_globs |= CLEAN #An array of file patterns to delete on clean.
+
+ # == Optional
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
+ #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
+end
- s.files = [ "CHANGELOG", "README", "LICENSE", "Rakefile" ] + FileList["{contrib,bin,spec,lib}/**/*"].to_a
+CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
+PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
+hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
- s.require_path = 'lib'
- s.has_rdoc = false
+desc 'Generate website files'
+task :website_generate do
+ Dir['website/**/*.txt'].each do |txt|
+ sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
+ end
+end
- s.author = "Francois Beausoleil"
- s.email = "francois@teksol.info"
- s.homepage = "http://piston.rubyforge.org/"
- s.rubyforge_project = "piston"
+desc 'Upload website files to rubyforge'
+task :website_upload do
+ host = "#{rubyforge_username}@rubyforge.org"
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
+ local_dir = 'website'
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
end
-Rake::GemPackageTask.new(spec) do |p|
- p.gem_spec = spec
- p.need_tar = true
- p.need_zip = true
+desc 'Generate and upload website files'
+task :website => [:website_generate, :website_upload, :publish_docs]
+
+desc 'Release the website and new gem version'
+task :deploy => [:check_version, :website, :release] do
+ puts "Remember to create SVN tag:"
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
+ puts "Suggested comment:"
+ puts "Tagging release #{CHANGES}"
end
-desc "Publish the release files to RubyForge."
-task :release => [ :package ] do
- `rubyforge login`
+desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
+task :local_deploy => [:website_generate, :install_gem]
- for ext in %w( gem tgz zip )
- release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}"
- puts release_command
- system(release_command)
+task :check_version do
+ unless ENV['VERSION']
+ puts 'Must pass a VERSION=x.y.z release version'
+ exit
+ end
+ unless ENV['VERSION'] == VERS
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
+ exit
end
end
-desc "Run all examples with RCov"
-Spec::Rake::SpecTask.new('specs') do |t|
- t.spec_files = FileList['specs/**/*.rb']
+desc "Run the specs under spec/"
+Spec::Rake::SpecTask.new do |t|
+ t.libs << File.dirname(__FILE__) + "/lib"
+ t.spec_opts = ['--options', "spec/spec.opts"]
+ t.spec_files = FileList['spec/*_spec.rb']
end
+
+desc "Default task is to run specs"
+task :default => :spec
+ |
| |   |
| 1 | | # Copyright (c) 2006 Francois Beausoleil <francois@teksol.info> |
| 2 | | # |
| 3 | | # Permission is hereby granted, free of charge, to any person obtaining a copy |
| 4 | | # of this software and associated documentation files (the "Software"), to deal |
| 5 | | # in the Software without restriction, including without limitation the rights |
| 6 | | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 7 | | # copies of the Software, and to permit persons to whom the Software is |
| 8 | | # furnished to do so, subject to the following conditions: |
| 9 | | # |
| 10 | | # The above copyright notice and this permission notice shall be included in |
| 11 | | # all copies or substantial portions of the Software. |
| 12 | | # |
| 13 | | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 | | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 19 | | # THE SOFTWARE. |
| 20 | | |
| 21 | | # $HeadURL$ |
| 22 | | # $Id$ |
| 23 | | |
| 24 | | require 'yaml' |
| 25 | | require 'uri' |
| 26 | | require 'fileutils' |
| 27 | | |
| 28 | | PISTON_ROOT = File.dirname(__FILE__) |
| 29 | | Dir[File.join(PISTON_ROOT, 'core_ext', '*.rb')].each do |file| |
| 30 | | require file |
| 31 | | end |
| 32 | | |
| 33 | | require "piston/version" |
| 34 | | require "piston/command" |
| 35 | | require "piston/command_error" |
| 36 | | |
| 37 | | require "transat/parser" |
| 38 | | Dir[File.join(PISTON_ROOT, "piston", "commands", "*.rb")].each do |file| |
| 39 | | require file.gsub(PISTON_ROOT, "")[1..-4] |
| 40 | | end |
| 41 | | |
| 42 | 1 | module Piston |
| 43 | | ROOT = "piston:root" |
| 44 | | UUID = "piston:uuid" |
| 45 | | REMOTE_REV = "piston:remote-revision" |
| 46 | | LOCAL_REV = "piston:local-revision" |
| 47 | | LOCKED = "piston:locked" |
| 48 | 2 | end |
| 49 | 3 | |
| 50 | | PistonCommandLineProcessor = Transat::Parser.new do |
| 51 | | program_name "Piston" |
| 52 | | version [Piston::VERSION::STRING] |
| 53 | | |
| 54 | | option :verbose, :short => :v, :default => true, :message => "Show subversion commands and results as they are executed" |
| 55 | | option :quiet, :short => :q, :default => false, :message => "Do not output any messages except errors" |
| 56 | | option :revision, :short => :r, :param_name => "REVISION", :type => :int |
| 57 | | option :show_updates, :short => :u, :message => "Query the remote repository for out of dateness information" |
| 58 | | option :lock, :short => :l, :message => "Close down and lock the imported directory from further changes" |
| 59 | | option :dry_run, :message => "Does not actually execute any commands" |
| 60 | | option :force, :message => "Force the command to run, even if Piston thinks it would cause a problem" |
| 61 | | |
| 62 | | command :switch, Piston::Commands::Switch, :valid_options => %w(lock dry_run force revision quiet verbose) |
| 63 | | command :update, Piston::Commands::Update, :valid_options => %w(lock dry_run force revision quiet verbose) |
| 64 | | command :import, Piston::Commands::Import, :valid_options => %w(lock dry_run force revision quiet verbose) |
| 65 | | command :convert, Piston::Commands::Convert, :valid_options => %w(lock verbose dry_run) |
| 66 | | command :unlock, Piston::Commands::Unlock, :valid_options => %w(force dry_run verbose) |
| 67 | | command :lock, Piston::Commands::Lock, :valid_options => %w(force dry_run revision verbose) |
| 68 | | command :status, Piston::Commands::Status, :valid_options => %w(show_updates verbose) |
| 69 | | end |
| 4 | require 'piston/version' |
| toggle raw diff |
--- a/lib/piston.rb
+++ b/lib/piston.rb
@@ -1,69 +1,4 @@
-# Copyright (c) 2006 Francois Beausoleil <francois@teksol.info>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-# $HeadURL$
-# $Id$
-
-require 'yaml'
-require 'uri'
-require 'fileutils'
-
-PISTON_ROOT = File.dirname(__FILE__)
-Dir[File.join(PISTON_ROOT, 'core_ext', '*.rb')].each do |file|
- require file
-end
-
-require "piston/version"
-require "piston/command"
-require "piston/command_error"
-
-require "transat/parser"
-Dir[File.join(PISTON_ROOT, "piston", "commands", "*.rb")].each do |file|
- require file.gsub(PISTON_ROOT, "")[1..-4]
-end
-
module Piston
- ROOT = "piston:root"
- UUID = "piston:uuid"
- REMOTE_REV = "piston:remote-revision"
- LOCAL_REV = "piston:local-revision"
- LOCKED = "piston:locked"
end
-PistonCommandLineProcessor = Transat::Parser.new do
- program_name "Piston"
- version [Piston::VERSION::STRING]
-
- option :verbose, :short => :v, :default => true, :message => "Show subversion commands and results as they are executed"
- option :quiet, :short => :q, :default => false, :message => "Do not output any messages except errors"
- option :revision, :short => :r, :param_name => "REVISION", :type => :int
- option :show_updates, :short => :u, :message => "Query the remote repository for out of dateness information"
- option :lock, :short => :l, :message => "Close down and lock the imported directory from further changes"
- option :dry_run, :message => "Does not actually execute any commands"
- option :force, :message => "Force the command to run, even if Piston thinks it would cause a problem"
-
- command :switch, Piston::Commands::Switch, :valid_options => %w(lock dry_run force revision quiet verbose)
- command :update, Piston::Commands::Update, :valid_options => %w(lock dry_run force revision quiet verbose)
- command :import, Piston::Commands::Import, :valid_options => %w(lock dry_run force revision quiet verbose)
- command :convert, Piston::Commands::Convert, :valid_options => %w(lock verbose dry_run)
- command :unlock, Piston::Commands::Unlock, :valid_options => %w(force dry_run verbose)
- command :lock, Piston::Commands::Lock, :valid_options => %w(force dry_run revision verbose)
- command :status, Piston::Commands::Status, :valid_options => %w(show_updates verbose)
-end
+require 'piston/version' |