toland / app_version
- Source
- Commits
- Network (4)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
4528cd3
app_version / README
| e6909bf9 » | ptoland | 2007-03-26 | 1 | = App Version | |
| 2 | |||||
| 3 | This is a simple plugin that makes it easy to manage the version number of your | ||||
| 4 | Rails application. The version numbers supported by this plugin look like | ||||
| 3ddb0a38 » | jschank | 2008-10-27 | 5 | '2.0.1 M4 (600) of branch by coder on 2008-10-27'. | |
| 3f415850 » | ptoland | 2007-03-31 | 6 | ||
| 3ddb0a38 » | jschank | 2008-10-27 | 7 | The components of the version number are: | |
| 8 | |||||
| 9 | 2 => major | ||||
| 10 | 0 => minor | ||||
| 11 | 1 => patch | ||||
| 12 | M4 => milestone | ||||
| 13 | (600) => build number (usually Subversion revision) | ||||
| 14 | branch => the name of the branch this version is from. | ||||
| 15 | coder => the name of the user that made the release | ||||
| 16 | 2008-10-27 => the date of the release | ||||
| 3f415850 » | ptoland | 2007-03-31 | 17 | ||
| 18 | Only the major and minor numbers are required. The rest can be omitted and the | ||||
| 19 | plugin will attempt to do the right thing. | ||||
| 20 | |||||
| 21 | == Usage | ||||
| e6909bf9 » | ptoland | 2007-03-26 | 22 | ||
| 23 | To use, simply place a file in RAILS_ROOT/config called version.yml with the | ||||
| 24 | following format: | ||||
| 25 | |||||
| 26 | major: 2 | ||||
| 27 | minor: 0 | ||||
| 3f415850 » | ptoland | 2007-03-31 | 28 | patch: 1 | |
| 29 | milestone: 4 | ||||
| c0f9da8f » | toland | 2008-08-14 | 30 | build: git-revcount | |
| 3ddb0a38 » | jschank | 2008-10-27 | 31 | branch: master | |
| 32 | committer: coder | ||||
| 33 | build_date: 2008-10-27 | ||||
| e6909bf9 » | ptoland | 2007-03-26 | 34 | ||
| 3f415850 » | ptoland | 2007-03-31 | 35 | If the milestone or patch fields are less than 0 then they will not show up | |
| c0f9da8f » | toland | 2008-08-14 | 36 | in the version string. The build field can be a build number or one of the | |
| 37 | following strings: svn, git-hash or git-revcount. If it is a number then that | ||||
| 38 | number will be used as the build number, if it is one of the special strings | ||||
| 39 | then the plugin will attempt to query the source control system for the build | ||||
| 40 | number. | ||||
| 41 | |||||
| 42 | Using 'svn' for the build number will cause the plugin to query Subversion for | ||||
| 43 | the current revision number. Since Git doesn't have a numbered revision we have | ||||
| 44 | to fake it. 'git-revcount' will count the number of commits to the repository | ||||
| 45 | and use that as the build number whereas 'git-hash' will use the first 6 digits | ||||
| 46 | of the current HEAD's hash. | ||||
| e6909bf9 » | ptoland | 2007-03-26 | 47 | ||
| 48 | The plugin creates a constant APP_VERSION that contains the version number of | ||||
| 49 | the application. Calling the +to_s+ method on APP_VERSION will result in a | ||||
| 50 | properly formatted version number. APP_VERSION also has +major+, +minor+, | ||||
| e436bea2 » | jschank | 2008-10-28 | 51 | +patch+, +milestone+, +build+, +branch+, +committer+, and +build_date+ | |
| 52 | methods to retrieve the individual components of the version number. | ||||
| 1f05342d » | toland | 2008-08-10 | 53 | ||
| 3ddb0a38 » | jschank | 2008-10-27 | 54 | == Capistrano Usage | |
| 55 | |||||
| 56 | When the app_version plugin is installed, it copies a templated edition of the | ||||
| e436bea2 » | jschank | 2008-10-28 | 57 | version.yml file into /lib/templates/version.yml.erb, the initial file shows a | |
| 3ddb0a38 » | jschank | 2008-10-27 | 58 | tag for retrieving the revision count with git. It also shows displaying the | |
| e436bea2 » | jschank | 2008-10-28 | 59 | branch as specified with "set :branch" in your capistrano deploy.rb, see the | |
| 60 | comments in the erb file for more nifty tricks. | ||||
| 3ddb0a38 » | jschank | 2008-10-27 | 61 | ||
| 62 | When you do a cap deploy, there is a capistrano recipe built-in to the app_version | ||||
| 63 | plugin, which will render the templated version.yml into the standard location as | ||||
| 64 | mentioned above. This happens automatically after the deploy is done. | ||||
| 65 | |||||
| 66 | Both the standard and extended capistrano usage can co-exist in the same project | ||||
| 67 | the dynamic rendering of the version.yml only happens when using capistrano to | ||||
| 68 | deploy your app. | ||||
| 69 | |||||
| e436bea2 » | jschank | 2008-10-28 | 70 | == Rake tasks | |
| 71 | |||||
| 72 | This plugin includes 4 new rake tasks: | ||||
| 73 | |||||
| 74 | rake app:install - will copy the version.yml and version.yml.erb into more user | ||||
| 75 | accessible locations (/config, and /lib/templates) | ||||
| 76 | |||||
| 77 | rake app:uninstall - will remove the files copied in the install task | ||||
| 78 | |||||
| 79 | rake app:render - will render the erb template into /config/version.yml | ||||
| 80 | in case you want to have dynamic values updated via a rake task. | ||||
| 81 | Note: certain examples expect the app to be in a git working directory. | ||||
| 82 | |||||
| 83 | rake app:version - will output the version number of the current rails | ||||
| 84 | application. | ||||
| 85 | |||||
| 3ddb0a38 » | jschank | 2008-10-27 | 86 | = License | |
| 87 | |||||
| 1f05342d » | toland | 2008-08-10 | 88 | This plugin is released under the terms of the Ruby license. See | |
| 89 | http://www.ruby-lang.org/en/LICENSE.txt. | ||||
