pow-client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rvmrc ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ruby-1.9.3-p0@pow"
8
+
9
+ #
10
+ # Uncomment the following lines if you want to verify rvm version per project
11
+ #
12
+ # rvmrc_rvm_version="1.10.2" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+ #
18
+
19
+ #
20
+ # Uncomment following line if you want options to be set only for given project.
21
+ #
22
+ # PROJECT_JRUBY_OPTS=( --1.9 )
23
+ #
24
+ # The variable PROJECT_JRUBY_OPTS requires the following to be run in shell:
25
+ #
26
+ # chmod +x ${rvm_path}/hooks/after_use_jruby_opts
27
+ #
28
+
29
+ #
30
+ # First we attempt to load the desired environment directly from the environment
31
+ # file. This is very fast and efficient compared to running through the entire
32
+ # CLI and selector. If you want feedback on which environment was used then
33
+ # insert the word 'use' after --create as this triggers verbose mode.
34
+ #
35
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
36
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
37
+ then
38
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
39
+
40
+ if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
41
+ then
42
+ . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
43
+ fi
44
+ else
45
+ # If the environment file has not yet been created, use the RVM CLI to select.
46
+ if ! rvm --create "$environment_id"
47
+ then
48
+ echo "Failed to create RVM environment '${environment_id}'."
49
+ return 1
50
+ fi
51
+ fi
52
+
53
+ #
54
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
55
+ # it be automatically loaded. Uncomment the following and adjust the filename if
56
+ # necessary.
57
+ #
58
+ # filename=".gems"
59
+ # if [[ -s "$filename" ]]
60
+ # then
61
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
62
+ # fi
63
+
64
+ # If you use bundler, this might be useful to you:
65
+ # if [[ -s Gemfile ]] && ! command -v bundle >/dev/null
66
+ # then
67
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
68
+ # gem install bundler
69
+ # fi
70
+ # if [[ -s Gemfile ]] && command -v bundle
71
+ # then
72
+ # bundle install
73
+ # fi
74
+
75
+ if [[ $- == *i* ]] # check for interactive shells
76
+ then
77
+ echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
78
+ else
79
+ echo "Using: $GEM_HOME" # don't use colors in interactive shells
80
+ fi
81
+
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec"
10
+ gem "rdoc", "~> 3.12"
11
+ gem "bundler", "~> 1.0.0"
12
+ gem "jeweler", "~> 1.8.3"
13
+ gem "rcov", ">= 0"
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,33 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.3)
5
+ git (1.2.5)
6
+ jeweler (1.8.3)
7
+ bundler (~> 1.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ rdoc
11
+ json (1.6.3)
12
+ rake (0.9.2.2)
13
+ rcov (0.9.11)
14
+ rdoc (3.12)
15
+ json (~> 1.4)
16
+ rspec (2.7.0)
17
+ rspec-core (~> 2.7.0)
18
+ rspec-expectations (~> 2.7.0)
19
+ rspec-mocks (~> 2.7.0)
20
+ rspec-core (2.7.1)
21
+ rspec-expectations (2.7.0)
22
+ diff-lcs (~> 1.1.2)
23
+ rspec-mocks (2.7.0)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 1.0.0)
30
+ jeweler (~> 1.8.3)
31
+ rcov
32
+ rdoc (~> 3.12)
33
+ rspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Oscar Del Ben
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,30 @@
1
+ = pow
2
+
3
+ This gem adds a pow executable to your command line. It is intended to
4
+ be used together with the pow package by 37signals.
5
+
6
+ Here's what you can do with it:
7
+
8
+ * pow add . [myapp] # Adds the current directory to pow.
9
+ * pow remove myapp # Removes current app.
10
+ * pow open [myapp] # Opens current app or specified app in the browser.
11
+
12
+ == Installation
13
+
14
+ gem install pow-client
15
+
16
+ == Contributing to pow
17
+
18
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
19
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
20
+ * Fork the project.
21
+ * Start a feature/bugfix branch.
22
+ * Commit and push until you are happy with your contribution.
23
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
24
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
25
+
26
+ == Copyright
27
+
28
+ Copyright (c) 2012 Oscar Del Ben. See LICENSE.txt for
29
+ further details.
30
+
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "pow-client"
18
+ gem.homepage = "http://github.com/oscardelben/pow-client"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Wrapper for pow}
21
+ gem.description = %Q{Wrapper for pow}
22
+ gem.email = "info@oscardelben.com"
23
+ gem.authors = ["Oscar Del Ben"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ # require 'rake/testtask'
29
+ # Rake::TestTask.new(:test) do |test|
30
+ # test.libs << 'lib' << 'test'
31
+ # test.pattern = 'test/**/test_*.rb'
32
+ # test.verbose = true
33
+ # end
34
+ #
35
+ # require 'rcov/rcovtask'
36
+ # Rcov::RcovTask.new do |test|
37
+ # test.libs << 'test'
38
+ # test.pattern = 'test/**/test_*.rb'
39
+ # test.verbose = true
40
+ # test.rcov_opts << '--exclude "gems/*"'
41
+ # end
42
+ #
43
+ # task :default => :test
44
+ #
45
+ # require 'rdoc/task'
46
+ # Rake::RDocTask.new do |rdoc|
47
+ # version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+ #
49
+ # rdoc.rdoc_dir = 'rdoc'
50
+ # rdoc.title = "pow #{version}"
51
+ # rdoc.rdoc_files.include('README*')
52
+ # rdoc.rdoc_files.include('lib/**/*.rb')
53
+ # end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/bin/pow ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.join(File.dirname(__FILE__), '../lib/pow')
4
+
5
+ Pow::Parser.new ARGV
data/lib/pow.rb ADDED
@@ -0,0 +1,57 @@
1
+ module Pow
2
+
3
+ USAGE = "USAGE: pow add|remove|open [arguments]"
4
+
5
+ POW_DIR = "~/.pow/"
6
+
7
+ class Parser
8
+ def initialize args
9
+ command = args.delete_at 0
10
+ case command
11
+ when 'add'
12
+ Add.new *args
13
+ when 'remove'
14
+ Remove.new *args
15
+ when 'open'
16
+ Open.new *args
17
+ else
18
+ puts Pow::USAGE
19
+ end
20
+ end
21
+ end
22
+
23
+ class Add
24
+ def initialize path, appname=nil
25
+ Runner.run "ln -s #{extract_dir(path)} #{Pow::POW_DIR}#{appname}"
26
+ end
27
+
28
+ private
29
+
30
+ def extract_dir path
31
+ path == '.' ? `pwd`.chomp : path
32
+ end
33
+ end
34
+
35
+ class Remove
36
+ def initialize appname
37
+ Runner.run "rm #{Pow::POW_DIR}#{appname}"
38
+ end
39
+ end
40
+
41
+ class Open
42
+ def initialize appname=nil
43
+ appname ||= `pwd`.chomp.split('/').last
44
+ Runner.run "open http://#{appname}.dev"
45
+ end
46
+ end
47
+
48
+ ## Wrapper around system for easy testing
49
+ class Runner
50
+ class << self
51
+ def run command
52
+ system command
53
+ end
54
+ end
55
+ end
56
+
57
+ end
data/pow.gemspec ADDED
@@ -0,0 +1,64 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "pow"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Oscar Del Ben"]
12
+ s.date = "2012-02-27"
13
+ s.description = "Wrapper for pow"
14
+ s.email = "info@oscardelben.com"
15
+ s.executables = ["pow"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".rvmrc",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README.rdoc",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "bin/pow",
30
+ "lib/pow.rb",
31
+ "spec/pow/pow_spec.rb",
32
+ "spec/spec_helper.rb"
33
+ ]
34
+ s.homepage = "http://github.com/oscardelben/pow"
35
+ s.licenses = ["MIT"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = "1.8.10"
38
+ s.summary = "Wrapper for pow"
39
+
40
+ if s.respond_to? :specification_version then
41
+ s.specification_version = 3
42
+
43
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_development_dependency(%q<rspec>, [">= 0"])
45
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
46
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
47
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
48
+ s.add_development_dependency(%q<rcov>, [">= 0"])
49
+ else
50
+ s.add_dependency(%q<rspec>, [">= 0"])
51
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
52
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
53
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
54
+ s.add_dependency(%q<rcov>, [">= 0"])
55
+ end
56
+ else
57
+ s.add_dependency(%q<rspec>, [">= 0"])
58
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
59
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
60
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
61
+ s.add_dependency(%q<rcov>, [">= 0"])
62
+ end
63
+ end
64
+
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Parser" do
4
+
5
+ context "adding a project" do
6
+
7
+ it "should call Pow::Add and pass the arguments" do
8
+ Pow::Add.should_receive(:new).with('.', 'myapp')
9
+ Pow::Parser .new %w{add . myapp}
10
+ end
11
+
12
+ it "should call remove and pass the arguments" do
13
+ Pow::Remove.should_receive(:new).with('google')
14
+ Pow::Parser.new %w{remove google}
15
+ end
16
+
17
+ it "should call open and pass the arguments" do
18
+ Pow::Open.should_receive(:new).with('basecamp')
19
+ Pow::Parser.new %w{open basecamp}
20
+ end
21
+
22
+ it "should print USAGE if no match is found" do
23
+ $stdout.should_receive(:puts).with(Pow::USAGE)
24
+ Pow::Parser.new %w{sds}
25
+ end
26
+ end
27
+
28
+ end
29
+
30
+ describe "Add" do
31
+ it "should expand the current path" do
32
+ current_dir = `pwd`.chomp
33
+ Pow::Runner.should_receive(:run).with "ln -s #{current_dir} #{Pow::POW_DIR}"
34
+ Pow::Add.new '.'
35
+ end
36
+
37
+ it "should use the specified path and app name" do
38
+ Pow::Runner.should_receive(:run).with "ln -s /a/path #{Pow::POW_DIR}appname"
39
+ Pow::Add.new '/a/path', 'appname'
40
+ end
41
+ end
42
+
43
+ describe "Remove" do
44
+ it "should remove the app" do
45
+ Pow::Runner.should_receive(:run).with "rm #{Pow::POW_DIR}google"
46
+ Pow::Remove.new 'google'
47
+ end
48
+ end
49
+
50
+ describe "Open" do
51
+ it "should open the app in the current directory" do
52
+ appname = `pwd`.chomp.split('/').last
53
+ Pow::Runner.should_receive(:run).with "open http://#{appname}.dev"
54
+ Pow::Open.new
55
+ end
56
+
57
+ it "should open the specified path" do
58
+ appname = 'rubyxp'
59
+ Pow::Runner.should_receive(:run).with "open http://#{appname}.dev"
60
+ Pow::Open.new appname
61
+ end
62
+ end
63
+
@@ -0,0 +1,2 @@
1
+
2
+ require_relative '../lib/pow'
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pow-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Oscar Del Ben
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70140058271880 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70140058271880
25
+ - !ruby/object:Gem::Dependency
26
+ name: rdoc
27
+ requirement: &70140058270460 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '3.12'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70140058270460
36
+ - !ruby/object:Gem::Dependency
37
+ name: bundler
38
+ requirement: &70140058267880 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.0.0
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70140058267880
47
+ - !ruby/object:Gem::Dependency
48
+ name: jeweler
49
+ requirement: &70140058266240 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.8.3
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70140058266240
58
+ - !ruby/object:Gem::Dependency
59
+ name: rcov
60
+ requirement: &70140058281140 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70140058281140
69
+ description: Wrapper for pow
70
+ email: info@oscardelben.com
71
+ executables:
72
+ - pow
73
+ extensions: []
74
+ extra_rdoc_files:
75
+ - LICENSE.txt
76
+ - README.rdoc
77
+ files:
78
+ - .document
79
+ - .rvmrc
80
+ - Gemfile
81
+ - Gemfile.lock
82
+ - LICENSE.txt
83
+ - README.rdoc
84
+ - Rakefile
85
+ - VERSION
86
+ - bin/pow
87
+ - lib/pow.rb
88
+ - pow.gemspec
89
+ - spec/pow/pow_spec.rb
90
+ - spec/spec_helper.rb
91
+ homepage: http://github.com/oscardelben/pow-client
92
+ licenses:
93
+ - MIT
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ segments:
105
+ - 0
106
+ hash: 1285141695552788997
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 1.8.10
116
+ signing_key:
117
+ specification_version: 3
118
+ summary: Wrapper for pow
119
+ test_files: []