passify 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -37,6 +37,10 @@ A list of all applications served with `passify` can be viewed by running
37
37
 
38
38
  passify list
39
39
 
40
+ Open the configuration file for the current application if $EDITOR is set, otherwise show the path to the file.
41
+
42
+ passify conf
43
+
40
44
  Last but not least, `passify` can be removed from Apache by running
41
45
 
42
46
  passify uninstall
@@ -51,6 +55,11 @@ It makes sense to create a wrapper for `passify` if you are using multiple versi
51
55
  rvm wrapper 1.8.7 --no-prefix passify
52
56
 
53
57
  ## Changelog
58
+ ### 0.2.2 (25-11-2011)
59
+ * added conf command to which opens the configuration file if $EDITOR is set, and shows the path otherwise
60
+ * fixed small bug with `list`-command showing truncated paths for legacy apps
61
+ * added well known shortcuts for several commands
62
+
54
63
  ### 0.2.1 (25-11-2011)
55
64
  * fix crash when environment command is called on legacy app
56
65
 
@@ -6,8 +6,12 @@ module Passify
6
6
  class CLI < Thor
7
7
  include Thor::Actions
8
8
 
9
- map '-h' => 'help'
10
- map '-v' => 'version'
9
+ map '-h' => 'help'
10
+ map '-v' => 'version'
11
+ map 'rm' => 'remove'
12
+ map 'env' => 'environment'
13
+ map 'rr' => 'restart'
14
+ map 'ls' => 'list'
11
15
 
12
16
  APACHE_CONF = '/etc/apache2/httpd.conf'
13
17
  VHOSTS_DIR = '/private/etc/apache2/passenger_pane_vhosts'
@@ -15,7 +19,7 @@ module Passify
15
19
  desc "add", "Creates an application from the current working directory."
16
20
  def add(name = nil)
17
21
  check_for_passify
18
- error("This directory can not be served with Passenger. Please create a `config.ru`-file.") unless is_valid_app?
22
+ error("This directory can not be served with passify. It has to be either a Rack application, a Rails 2.x application or a legacy (PHP/HTML) application.") unless is_valid_app?
19
23
  name = File.basename(pwd) if name.nil? || name.empty?
20
24
  name = urlify(name)
21
25
  host = "#{name}.local"
@@ -47,8 +51,8 @@ module Passify
47
51
  say "The application was successfully removed."
48
52
  end
49
53
 
50
- desc "env", "Change the environment of the current app"
51
- def env(env = nil)
54
+ desc "environment", "Change the environment of the current app"
55
+ def environment(env = nil)
52
56
  check_for_passify
53
57
  notice("This application is a legacy application. The environment can not be changed.") if !is_rack_app? && !is_rails2_app?
54
58
  host = find_host
@@ -123,6 +127,22 @@ module Passify
123
127
  system("open http://#{host}")
124
128
  end
125
129
 
130
+ desc "conf", "Opens the configuration file if $EDITOR is set, otherwise shows the path."
131
+ def conf
132
+ check_for_passify
133
+ host = find_host
134
+
135
+ success = false
136
+ if ENV['EDITOR']
137
+ Dir.chdir(VHOSTS_DIR) do
138
+ success = system("#{ENV['EDITOR']} #{vhost_file(host)}")
139
+ end
140
+ end
141
+ if !success
142
+ say vhost_file(host)
143
+ end
144
+ end
145
+
126
146
  desc "version", "Shows the version"
127
147
  def version
128
148
  say "passify #{Passify::VERSION}"
@@ -175,16 +195,16 @@ module Passify
175
195
  end
176
196
  end
177
197
 
178
- def is_rack_app?
179
- File.exists?('config.ru')
198
+ def is_rack_app?(path = pwd)
199
+ File.exists?("#{path}/config.ru")
180
200
  end
181
201
 
182
- def is_rails2_app?
183
- system("grep 'RAILS_GEM_VERSION' config/environment.rb > /dev/null 2>&1")
202
+ def is_rails2_app?(path = pwd)
203
+ system("grep 'RAILS_GEM_VERSION' #{path}/config/environment.rb > /dev/null 2>&1")
184
204
  end
185
205
 
186
- def is_legacy_app?
187
- File.exists?('index.html') || File.exists?('index.php')
206
+ def is_legacy_app?(path = pwd)
207
+ File.exists?("#{path}/index.html") || File.exists?("#{path}/index.php")
188
208
  end
189
209
 
190
210
  def find_host
@@ -208,7 +228,8 @@ module Passify
208
228
  end
209
229
 
210
230
  def directory_for_host(host)
211
- `grep 'DocumentRoot' #{vhost_file(host)}`.scan(/"([^"]*)"/).flatten[0][0..-8]
231
+ dir = `grep 'DocumentRoot' #{vhost_file(host)}`.scan(/"([^"]*)"/).flatten[0]
232
+ is_legacy_app?(dir) ? dir : dir[0..-8]
212
233
  end
213
234
 
214
235
  def find_line_in_conf(pattern)
@@ -1,3 +1,3 @@
1
1
  module Passify
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &2151877780 !ruby/object:Gem::Requirement
16
+ requirement: &2156002500 !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: :runtime
23
23
  prerelease: false
24
- version_requirements: *2151877780
24
+ version_requirements: *2156002500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &2151876700 !ruby/object:Gem::Requirement
27
+ requirement: &2156001520 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2151876700
35
+ version_requirements: *2156001520
36
36
  description: passify is a command line interface (CLI) for Phusion Passenger, equivalent
37
37
  to what powder and powify are for pow. passify is compatible with PassengerPane.
38
38
  email:
@@ -65,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
65
  version: '0'
66
66
  segments:
67
67
  - 0
68
- hash: 408163153943326134
68
+ hash: 4385306381277198046
69
69
  required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  none: false
71
71
  requirements:
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  segments:
76
76
  - 0
77
- hash: 408163153943326134
77
+ hash: 4385306381277198046
78
78
  requirements: []
79
79
  rubyforge_project: passify
80
80
  rubygems_version: 1.8.11