pow-client 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -5,8 +5,8 @@ be used together with the pow package by 37signals.
5
5
 
6
6
  Here's what you can do with it:
7
7
 
8
- * pow add . [myapp] # Adds the current directory to pow.
9
- * pow remove myapp # Removes current app.
8
+ * pow add [myapp] # Adds the current directory to pow.
9
+ * pow remove [myapp] # Removes current app.
10
10
  * pow open [myapp] # Opens current app or specified app in the browser.
11
11
  * pow restart # Restarts current app.
12
12
 
@@ -15,7 +15,7 @@ Here's what you can do with it:
15
15
  gem install pow-client
16
16
 
17
17
  == Contributing to pow
18
-
18
+
19
19
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
20
20
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
21
21
  * Fork the project.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/lib/pow.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Pow
2
2
 
3
3
  USAGE = "USAGE: pow add|remove|open|restart [arguments]"
4
-
5
4
  POW_DIR = "~/.pow/"
5
+ APPNAME = `pwd`.chomp.split('/').last
6
6
 
7
7
  class Parser
8
8
  def initialize args
@@ -23,32 +23,35 @@ module Pow
23
23
  end
24
24
 
25
25
  class Add
26
- def initialize path, appname=nil
26
+ def initialize path=nil, appname=nil
27
27
  Runner.run "ln -s #{extract_dir(path)} #{Pow::POW_DIR}#{appname}"
28
28
  end
29
29
 
30
30
  private
31
31
 
32
32
  def extract_dir path
33
- path == '.' ? `pwd`.chomp : path
33
+ if !path or path == '.'
34
+ `pwd`.chomp
35
+ else
36
+ path
37
+ end
34
38
  end
35
39
  end
36
40
 
37
41
  class Remove
38
- def initialize appname
42
+ def initialize appname=APPNAME
39
43
  Runner.run "rm #{Pow::POW_DIR}#{appname}"
40
44
  end
41
45
  end
42
46
 
43
47
  class Open
44
- def initialize appname=nil
45
- appname ||= `pwd`.chomp.split('/').last
48
+ def initialize appname=APPNAME
46
49
  Runner.run "open http://#{appname}.dev"
47
50
  end
48
51
  end
49
-
52
+
50
53
  class Restart
51
- def initialize appname=nil
54
+ def initialize
52
55
  Runner.run "touch tmp/restart.txt"
53
56
  end
54
57
  end
data/pow-client.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "pow-client"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oscar Del Ben"]
12
- s.date = "2012-02-29"
12
+ s.date = "2012-04-07"
13
13
  s.description = "Wrapper for pow"
14
14
  s.email = "info@oscardelben.com"
15
15
  s.executables = ["pow"]
data/spec/pow/pow_spec.rb CHANGED
@@ -1,9 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Parser" do
3
+ describe Pow do
4
+ def current_dir
5
+ `pwd`.chomp
6
+ end
4
7
 
5
- context "adding a project" do
8
+ def default_appname
9
+ `pwd`.chomp.split('/').last
10
+ end
6
11
 
12
+ describe Pow::Parser do
7
13
  it "should call Pow::Add and pass the arguments" do
8
14
  Pow::Add.should_receive(:new).with('.', 'myapp')
9
15
  Pow::Parser .new %w{add . myapp}
@@ -23,53 +29,61 @@ describe "Parser" do
23
29
  Pow::Restart.should_receive(:new)
24
30
  Pow::Parser.new %w{restart}
25
31
  end
26
-
32
+
27
33
  it "should print USAGE if no match is found" do
28
34
  $stdout.should_receive(:puts).with(Pow::USAGE)
29
35
  Pow::Parser.new %w{sds}
30
36
  end
31
37
  end
32
38
 
33
- end
39
+ describe Pow::Add do
40
+ it "should expand the current path" do
41
+ Pow::Runner.should_receive(:run).with "ln -s #{current_dir} #{Pow::POW_DIR}"
42
+ Pow::Add.new
43
+ end
34
44
 
35
- describe "Add" do
36
- it "should expand the current path" do
37
- current_dir = `pwd`.chomp
38
- Pow::Runner.should_receive(:run).with "ln -s #{current_dir} #{Pow::POW_DIR}"
39
- Pow::Add.new '.'
40
- end
45
+ it "should expand the current path" do
46
+ Pow::Runner.should_receive(:run).with "ln -s #{current_dir} #{Pow::POW_DIR}"
47
+ Pow::Add.new '.'
48
+ end
41
49
 
42
- it "should use the specified path and app name" do
43
- Pow::Runner.should_receive(:run).with "ln -s /a/path #{Pow::POW_DIR}appname"
44
- Pow::Add.new '/a/path', 'appname'
50
+ it "should use the specified path and app name" do
51
+ Pow::Runner.should_receive(:run).with "ln -s /a/path #{Pow::POW_DIR}appname"
52
+ Pow::Add.new '/a/path', 'appname'
53
+ end
45
54
  end
46
- end
47
55
 
48
- describe "Remove" do
49
- it "should remove the app" do
50
- Pow::Runner.should_receive(:run).with "rm #{Pow::POW_DIR}google"
51
- Pow::Remove.new 'google'
52
- end
53
- end
56
+ describe Pow::Remove do
57
+ it "should remove the app in the current directory" do
58
+ appname = default_appname
59
+ Pow::Runner.should_receive(:run).with "rm #{Pow::POW_DIR}#{appname}"
60
+ Pow::Remove.new
61
+ end
54
62
 
55
- describe "Open" do
56
- it "should open the app in the current directory" do
57
- appname = `pwd`.chomp.split('/').last
58
- Pow::Runner.should_receive(:run).with "open http://#{appname}.dev"
59
- Pow::Open.new
63
+ it "should remove the app" do
64
+ Pow::Runner.should_receive(:run).with "rm #{Pow::POW_DIR}google"
65
+ Pow::Remove.new 'google'
66
+ end
60
67
  end
61
68
 
62
- it "should open the specified path" do
63
- appname = 'rubyxp'
64
- Pow::Runner.should_receive(:run).with "open http://#{appname}.dev"
65
- Pow::Open.new appname
66
- end
67
- end
69
+ describe Pow::Open do
70
+ it "should open the app in the current directory" do
71
+ appname = default_appname
72
+ Pow::Runner.should_receive(:run).with "open http://#{appname}.dev"
73
+ Pow::Open.new
74
+ end
68
75
 
69
- describe "Restart" do
70
- it "should restart the app" do
71
- Pow::Runner.should_receive(:run).with "touch tmp/restart.txt"
72
- Pow::Restart.new
76
+ it "should open the specified path" do
77
+ appname = 'rubyxp'
78
+ Pow::Runner.should_receive(:run).with "open http://#{appname}.dev"
79
+ Pow::Open.new appname
80
+ end
73
81
  end
74
- end
75
82
 
83
+ describe Pow::Restart do
84
+ it "should restart the app" do
85
+ Pow::Runner.should_receive(:run).with "touch tmp/restart.txt"
86
+ Pow::Restart.new
87
+ end
88
+ end
89
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pow-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-29 00:00:00.000000000 Z
12
+ date: 2012-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70339967188020 !ruby/object:Gem::Requirement
16
+ requirement: &70277098765340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70339967188020
24
+ version_requirements: *70277098765340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &70339967185960 !ruby/object:Gem::Requirement
27
+ requirement: &70277098763120 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.12'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70339967185960
35
+ version_requirements: *70277098763120
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70339967184020 !ruby/object:Gem::Requirement
38
+ requirement: &70277098761400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70339967184020
46
+ version_requirements: *70277098761400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &70339967199060 !ruby/object:Gem::Requirement
49
+ requirement: &70277098776260 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.8.3
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70339967199060
57
+ version_requirements: *70277098776260
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rcov
60
- requirement: &70339967197440 !ruby/object:Gem::Requirement
60
+ requirement: &70277098774600 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70339967197440
68
+ version_requirements: *70277098774600
69
69
  description: Wrapper for pow
70
70
  email: info@oscardelben.com
71
71
  executables:
@@ -104,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  segments:
106
106
  - 0
107
- hash: 611087733253852716
107
+ hash: -872599722709955697
108
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  none: false
110
110
  requirements: