Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rodreegez committed Apr 8, 2011
0 parents commit 73f6387
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
*.gem
.bundle
Gemfile.lock
pkg/*
tmp
4 changes: 4 additions & 0 deletions Gemfile
@@ -0,0 +1,4 @@
source "http://rubygems.org"

# Specify your gem's dependencies in powder.gemspec
gemspec
2 changes: 2 additions & 0 deletions Rakefile
@@ -0,0 +1,2 @@
require 'bundler'
Bundler::GemHelper.install_tasks
53 changes: 53 additions & 0 deletions bin/pow
@@ -0,0 +1,53 @@
#!/usr/bin/ruby

require 'rubygems'
require 'thor'
require 'fileutils'

class Pow < Thor
default_task :link

map '-r' => 'restart'
map '-l' => 'list'
map '-L' => 'link'

POWPATH = "/Users/#{`whoami`.chomp}/.pow"

desc "link", "link a pow"
def link(name=nil)
return unless is_powable?
current_path = %x{pwd}.chomp
symink_path = "#{POWPATH}/#{name || File.basename(current_path)}"
FileUtils.ln_s(current_path, symink_path, :verbose => true) unless File.exists?(symink_path)
end

desc "restart", "restart current pow"
def restart
return unless is_powable?
FileUtils.mkdir_p('tmp')
%x{touch tmp/restart.txt}
end

desc "list", "list current pows"
def list
Dir[POWPATH + "/*"].map { |a| p File.basename(a) }
end

desc "remove", "remove a pow"
def remove(name=nil)
return unless is_powable?
FileUtils.rm POWPATH + '/' + (name || File.basename(%x{pwd}.chomp))
end

private

def is_powable?
if File.exists? 'config.ru'
true
else
$stdout.puts "This does not appear to be a rack app, there is no config.ru."
false
end
end
end
Pow.start
5 changes: 5 additions & 0 deletions lib/powder.rb
@@ -0,0 +1,5 @@
module Pow
module Gem
# Your code goes here...
end
end
5 changes: 5 additions & 0 deletions lib/powder/version.rb
@@ -0,0 +1,5 @@
module Pow
module Gem
VERSION = "0.0.1"
end
end
23 changes: 23 additions & 0 deletions powder.gemspec
@@ -0,0 +1,23 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "powder/version"

Gem::Specification.new do |s|
s.name = "powder"
s.version = Pow::Gem::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Phil Nash", "Adam Rogers"]
s.email = ["no"]
s.homepage = "http://github.com/Rodreegez/pow-gem"
s.summary = %q{Makes Pow even easier}
s.description = %q{seriously, it's easy.}

s.rubyforge_project = "powder"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = ["pow"]
s.require_paths = ["lib"]

s.add_dependency 'thor', '>=0.14.6'
end

0 comments on commit 73f6387

Please sign in to comment.