From 8dac49548c18c9edd52e29ce75247e8c97edb00c Mon Sep 17 00:00:00 2001 From: Jeremy Cook Date: Sun, 5 Jan 2014 14:27:52 -0500 Subject: [PATCH 1/4] Added command to display current version of homesick. --- Rakefile | 3 ++- lib/homesick.rb | 10 ++++++++++ lib/homesick/version.rb | 10 ++++++++++ spec/homesick_spec.rb | 7 +++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 lib/homesick/version.rb diff --git a/Rakefile b/Rakefile index 996e98e..b55731d 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,6 @@ require 'rubygems' require 'bundler' +require_relative 'lib/homesick/version' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e @@ -23,7 +24,7 @@ Jeweler::Tasks.new do |gem| gem.email = ["josh@technicalpickles.com", "info@muratayusuke.com"] gem.homepage = "http://github.com/technicalpickles/homesick" gem.authors = ["Joshua Nichols", "Yusuke Murata"] - gem.version = "0.9.7" + gem.version = Homesick::Version::STRING gem.license = "MIT" # Have dependencies? Add them to Gemfile diff --git a/lib/homesick.rb b/lib/homesick.rb index eb19073..039de4a 100644 --- a/lib/homesick.rb +++ b/lib/homesick.rb @@ -4,9 +4,11 @@ require 'thor' class Homesick < Thor autoload :Shell, 'homesick/shell' autoload :Actions, 'homesick/actions' + autoload :Version, 'homesick/version' include Thor::Actions include Homesick::Actions + include Homesick::Version add_runtime_options! @@ -15,6 +17,9 @@ class Homesick < Thor DEFAULT_CASTLE_NAME = 'dotfiles' + map '-v' => :version + map '--version' => :version + def initialize(args = [], options = {}, config = {}) super self.shell = Homesick::Shell.new @@ -264,6 +269,11 @@ class Homesick < Thor end end + desc 'version', 'Display the current version of homesick' + def version + say Homesick::Version::STRING + end + protected def home_dir diff --git a/lib/homesick/version.rb b/lib/homesick/version.rb new file mode 100644 index 0000000..8e372a2 --- /dev/null +++ b/lib/homesick/version.rb @@ -0,0 +1,10 @@ +# -*- encoding : utf-8 -*- +class Homesick + module Version + MAJOR = 0 + MINOR = 9 + PATCH = 8 + + STRING = "#{MAJOR}.#{MINOR}.#{PATCH}" + end +end diff --git a/spec/homesick_spec.rb b/spec/homesick_spec.rb index 830f2ca..cd23742 100644 --- a/spec/homesick_spec.rb +++ b/spec/homesick_spec.rb @@ -565,4 +565,11 @@ describe 'homesick' do expect { homesick.open "castle_repo" }.to raise_error(SystemExit) end end + + describe 'version' do + it 'should print the current version of homesick' do + text = Capture.stdout { homesick.version } + text.chomp.should =~ /\d+\.\d+\.\d+/ + end + end end From 6f216cd916cc42859145c82184f3862e327f7a6d Mon Sep 17 00:00:00 2001 From: Nicolas McCurdy Date: Mon, 6 Jan 2014 21:20:01 -0500 Subject: [PATCH 2/4] Add gem version, dependency status, and code quality badges to the readme --- README.markdown | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.markdown b/README.markdown index 48c8000..6aad8d0 100644 --- a/README.markdown +++ b/README.markdown @@ -1,6 +1,9 @@ # homesick +[![Gem Version](https://badge.fury.io/rb/homesick.png)](http://badge.fury.io/rb/homesick) [![Build Status](https://travis-ci.org/technicalpickles/homesick.png?branch=master)](https://travis-ci.org/technicalpickles/homesick) +[![Dependency Status](https://gemnasium.com/technicalpickles/homesick.png)](https://gemnasium.com/technicalpickles/homesick) +[![Code Climate](https://codeclimate.com/github/technicalpickles/homesick.png)](https://codeclimate.com/github/technicalpickles/homesick) Your home directory is your castle. Don't leave your dotfiles behind. From af159f5b97473bf4a130078800a91b1eebbcde35 Mon Sep 17 00:00:00 2001 From: Jeremy Cook Date: Thu, 9 Jan 2014 17:45:05 -0500 Subject: [PATCH 3/4] Added libnotify Gem on *nix systems in case people want to use it for Guard notifications. --- Gemfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index c4e733d..8a90e4c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ +require 'rbconfig' source 'https://rubygems.org' # Add dependencies required to use your gem here. @@ -16,6 +17,9 @@ group :development do gem "simplecov", :platforms => :mri_19 gem "test-construct" gem "capture-output", "~> 1.0.0" + if RbConfig::CONFIG['host_os'] =~ /linux|freebsd|openbsd|sunos|solaris/ + gem 'libnotify' + end if RUBY_VERSION >= '1.9.2' gem "rubocop" end From 6050a9a7acd23f04ad627d44f0c4076b6d8150ed Mon Sep 17 00:00:00 2001 From: Jeremy Cook Date: Thu, 9 Jan 2014 22:38:47 -0500 Subject: [PATCH 4/4] Updated README for .homesickrc. --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 6aad8d0..1069de3 100644 --- a/README.markdown +++ b/README.markdown @@ -34,11 +34,11 @@ You can remove symlinks anytime when you don't need them anymore homesick unlink pickled-vim -If you need to add further configuration steps you can add these in a file called '.homesickrc' in the root of a castle. Once you've cloned a castle with one of these files apply these steps with: +If you need to add further configuration steps you can add these in a file called '.homesickrc' in the root of a castle. Once you've cloned a castle with a .homesickrc run the configuration with: homesick rc CASTLE -The contents of the .homesickrc file must be valid Ruby code as the file will be executed with Ruby's eval construct. +The contents of the .homesickrc file must be valid Ruby code as the file will be executed with Ruby's eval construct. The .homesickrc is also passed the current homesick object during its execution and this is available within the .homesickrc file as the 'self' variable. If you're not sure what castles you have around, you can easily list them: