Skip to content

Commit

Permalink
Merge pull request #1 from customink-webops/master
Browse files Browse the repository at this point in the history
tmux config + travis support
  • Loading branch information
Joshua Timberman committed Aug 18, 2012
2 parents 0c9ef9a + 51b2dd4 commit eb9e2dc
Show file tree
Hide file tree
Showing 12 changed files with 219 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .chef/knife.rb
@@ -0,0 +1,2 @@
cache_type 'BasicFile'
cache_options(:path => "#{ENV['HOME']}/.chef/checksums")
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
tmp
7 changes: 7 additions & 0 deletions .travis.yml
@@ -0,0 +1,7 @@
language: ruby
rvm:
- 1.9.2
- 1.9.3
script:
- bundle exec rake knife
- bundle exec rake foodcritic
12 changes: 12 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,12 @@
Changelog
=========

v1.0.0
------
* Initial Release

v1.0.1
------
* Added default template
* Added TravisCI support
* Added CentOS support (compile from source)
5 changes: 5 additions & 0 deletions Gemfile
@@ -0,0 +1,5 @@
source 'http://rubygems.org'

gem 'chef', '~> 0.10.10'
gem 'foodcritic', :platforms => :ruby_19
gem 'rake'
95 changes: 95 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,95 @@
GEM
remote: http://rubygems.org/
specs:
bunny (0.7.9)
chef (0.10.10)
bunny (>= 0.6.0)
erubis
highline (>= 1.6.9)
json (>= 1.4.4, <= 1.6.1)
mixlib-authentication (>= 1.1.0)
mixlib-cli (>= 1.1.0)
mixlib-config (>= 1.1.2)
mixlib-log (>= 1.3.0)
mixlib-shellout (~> 1.0.0.rc)
moneta
net-ssh (~> 2.2.2)
net-ssh-multi (~> 1.1.0)
ohai (>= 0.6.0)
rest-client (>= 1.0.4, < 1.7.0)
treetop (~> 1.4.9)
uuidtools
yajl-ruby (>= 1.1.0)
coderay (0.9.8)
erubis (2.7.0)
foodcritic (1.3.0)
gherkin (~> 2.8.0)
gist (~> 2.0.4)
nokogiri (~> 1.5.0, != 1.5.2, != 1.5.1)
pry (~> 0.9.7.4)
pry-doc (~> 0.3.0)
rak (~> 1.4)
treetop (~> 1.4.10)
yajl-ruby (~> 1.1.0)
gherkin (2.8.0)
json (>= 1.4.6)
gist (2.0.4)
highline (1.6.12)
ipaddress (0.8.0)
json (1.6.1)
method_source (0.6.7)
ruby_parser (>= 2.3.1)
mime-types (1.18)
mixlib-authentication (1.1.4)
mixlib-log
mixlib-cli (1.2.2)
mixlib-config (1.1.2)
mixlib-log (1.3.0)
mixlib-shellout (1.0.0)
moneta (0.6.0)
net-ssh (2.2.2)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
net-ssh-multi (1.1)
net-ssh (>= 2.1.4)
net-ssh-gateway (>= 0.99.0)
nokogiri (1.5.0)
ohai (0.6.12)
ipaddress
mixlib-cli
mixlib-config
mixlib-log
systemu
yajl-ruby
polyglot (0.3.3)
pry (0.9.7.4)
coderay (~> 0.9.8)
method_source (~> 0.6.7)
ruby_parser (>= 2.3.1)
slop (~> 2.1.0)
pry-doc (0.3.0)
pry (>= 0.9.0)
yard (>= 0.6.4)
rak (1.4)
rake (0.9.2.2)
rest-client (1.6.7)
mime-types (>= 1.16)
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
sexp_processor (3.2.0)
slop (2.1.0)
systemu (2.5.0)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
uuidtools (2.1.2)
yajl-ruby (1.1.0)
yard (0.8.1)

PLATFORMS
ruby

DEPENDENCIES
chef (~> 0.10.10)
foodcritic
rake
14 changes: 8 additions & 6 deletions README.md
@@ -1,15 +1,17 @@
DESCRIPTION
===========
[![Build Status](https://secure.travis-ci.org/opscode-cookbooks/tmux.png?branch=master)](http://travis-ci.org/opscode-cookbooks/tmux)

tmux
====

Installs tmux, a terminal multiplexer.

REQUIREMENTS
============
Requirements
------------

Platform with a package named 'tmux'.

LICENSE AND AUTHOR
==================
License and Author
------------------

Author:: Joshua Timberman (<joshua@opscode.com>)

Expand Down
34 changes: 34 additions & 0 deletions Rakefile
@@ -0,0 +1,34 @@
#!/usr/bin/env rake

task :default => 'foodcritic'

desc "Runs foodcritic linter"
task :foodcritic do
Rake::Task[:prepare_sandbox].execute

if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup)
sh "foodcritic -f any #{sandbox_path}"
else
puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2."
end
end

desc "Runs knife cookbook test"
task :knife do
Rake::Task[:prepare_sandbox].execute

sh "bundle exec knife cookbook test cookbook -o #{sandbox_path}/../"
end

task :prepare_sandbox do
files = %w{*.md *.rb attributes definitions files providers recipes resources templates}

rm_rf sandbox_path
mkdir_p sandbox_path
cp_r Dir.glob("{#{files.join(',')}}"), sandbox_path
end

private
def sandbox_path
File.join(File.dirname(__FILE__), %w(tmp cookbooks cookbook))
end
2 changes: 2 additions & 0 deletions attributes/default.rb
@@ -0,0 +1,2 @@
default['tmux']['version'] = '1.6'
default['tmxu']['checksum'] = '8756f6bcecb18102b87e5d6f5952ba2541f68ed3'
2 changes: 1 addition & 1 deletion metadata.rb
Expand Up @@ -3,4 +3,4 @@
license "Apache 2.0"
description "Installs tmux"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.0"
version "1.0.1"
32 changes: 29 additions & 3 deletions recipes/default.rb
Expand Up @@ -14,8 +14,34 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
#
#

if node['platform'] == 'centos'
Chef::Log.info('There is not a tmux package for CentOS. Compiling from source...')
package 'libevent-devel'
package 'ncurses-devel'

tar_name = "tmux-#{node['tmux']['version']}"
remote_file "#{Chef::Config['file_cache_path']}/#{tar_name}.tar.gz" do
source "http://downloads.sourceforge.net/tmux/#{tar_name}.tar.gz"
checksum node['tmux']['checksum']
notifies :run, 'bash[install_tmux]', :immediately
end

bash 'install_tmux' do
user 'root'
cwd Chef::Config['file_cache_path']
code <<-EOH
tar -zxf #{tar_name}.tar.gz
(cd #{tar_name} && ./configure && make && make install)
EOH
action :nothing
end
else
package 'tmux'
end

package "tmux" do
action :install
template '/etc/tmux.conf' do
source 'tmux.conf'
mode 0644
end
23 changes: 23 additions & 0 deletions templates/default/tmux.conf
@@ -0,0 +1,23 @@
# Use a better prefix:
set -g prefix C-a
unbind C-b

# Change the default delay:
set -sg escape-time 1

# Set the window and panes index
set -g base-index 1
setw -g pane-base-index 1

# Send prefix to ohter apps:
bind C-a send-prefix

# Split windows with more logical keys
bind | split-window -h
bind - split-window -v

# Remap movement keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

0 comments on commit eb9e2dc

Please sign in to comment.