rsm 0.1.10 → 0.1.11

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/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.1.11 / October 31, 2011
2
+
3
+ * Added support for host/port or server
4
+ * Environment-depended config for thin
5
+
1
6
  # 0.1.7 / September 12, 2011
2
7
 
3
8
  * Fixed upsream name
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.10
1
+ 0.1.11
@@ -2,6 +2,8 @@ module Rsm
2
2
  module Install
3
3
  class Rails < Rsm::Base
4
4
 
5
+ attr_reader :socket, :host, :port
6
+
5
7
  class_option :user, :aliases => "-u", :default => "git", :desc => "Owners's user"
6
8
  class_option :group, :aliases => "-g", :default => "git", :desc => "Owners's group"
7
9
 
@@ -9,6 +11,10 @@ module Rsm
9
11
  class_option :tgz, :desc => "Install from TGZ (tar.gz)"
10
12
  class_option :tbz2, :desc => "Install from TBZ2 (tar.bz2)"
11
13
 
14
+ class_option :socket, :aliases => "-S", :type => :boolean, :defualt => false, :desc => "Use socket"
15
+ class_option :host, :aliases => "-h", :default => "127.0.0.1", :desc => "Application server host binding"
16
+ class_option :port, :aliases => "-p", :default => 3000, :desc => "Application server port binding"
17
+
12
18
  def download
13
19
  empty_directory "."
14
20
  inside application_root do
@@ -26,14 +32,32 @@ module Rsm
26
32
  end
27
33
  end
28
34
 
35
+ def define_vars
36
+ @socket = options[:socket]
37
+ @host = options[:host]
38
+ @port = options[:port]
39
+ end
40
+
29
41
  def unicorn_config
30
42
  template "unicorn.rb.erb", "config/unicorn.rb"
31
43
  end
32
44
  remove_task :unicorn_config
33
45
 
34
46
  def thin_config
47
+ env = options[:environment]
35
48
  inside "." do
36
- run_with_bundler "thin config -C config/thin.yml -S tmp/sockets/thin.sock -s #{options[:worker_processes]} -e #{options[:environment]}"
49
+ cmd = "thin config -C config/thin.#{env}.yml -s #{options[:worker_processes]} -e #{env} -l log/thin.#{env}.log -P tmp/pids/thin.#{env}.pid"
50
+ if socket
51
+ cmd << " -S tmp/sockets/thin.#{env}.sock"
52
+ else
53
+ if host
54
+ cmd << " -a #{host}"
55
+ end
56
+ if port
57
+ cmd << " -p #{port}"
58
+ end
59
+ end
60
+ run_with_bundler cmd
37
61
  end
38
62
  end
39
63
  remove_task :thin_config
@@ -3,7 +3,7 @@ module Rsm
3
3
  class Restart < Rsm::Base
4
4
 
5
5
  def thin_restart
6
- run_ruby_binary "thin restart -C #{application_root}/config/thin.yml"
6
+ run_with_bundler "thin restart -C #{application_root}/config/thin.#{options[:environment]}.yml"
7
7
  end
8
8
 
9
9
  end
@@ -3,7 +3,7 @@ module Rsm
3
3
  class Start < Rsm::Base
4
4
 
5
5
  def thin_start
6
- run_with_bundler "thin start -C #{application_root}/config/thin.yml"
6
+ run_with_bundler "thin start -C #{application_root}/config/thin.#{options[:environment]}.yml"
7
7
  end
8
8
 
9
9
  end
@@ -3,7 +3,7 @@ module Rsm
3
3
  class Stop < Rsm::Base
4
4
 
5
5
  def thin_stop
6
- run_with_bundler "thin stop -C #{application_root}/config/thin.yml"
6
+ run_with_bundler "thin stop -C #{application_root}/config/thin.#{options[:environment]}.yml"
7
7
  end
8
8
 
9
9
  end
@@ -27,8 +27,10 @@ working_directory "<%= application_root %>/" # available in 0.94.0+
27
27
 
28
28
  # listen on both a Unix domain socket and a TCP port,
29
29
  # we use a shorter backlog for quicker failover when busy
30
- listen "<%= application_root %>/tmp/sockets/unicorn.#{environment}.sock", :backlog => 64
31
- #listen "127.0.0.1:8080", :tcp_nopush => true
30
+
31
+ <%- if socket -%>listen "<%= application_root %>/tmp/sockets/unicorn.#{environment}.sock", :backlog => 64
32
+ <%- else -%>listen "<%= host %>:<%= port %>", :tcp_nopush => true
33
+ <%- end -%>
32
34
 
33
35
  # nuke workers after 30 seconds instead of 60 seconds (the default)
34
36
  timeout 30
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rsm
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.10
5
+ version: 0.1.11
6
6
  platform: ruby
7
7
  authors:
8
8
  - Oleksandr Ulianytskyi
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-10-27 00:00:00 +03:00
13
+ date: 2011-10-31 00:00:00 +02:00
14
14
  default_executable: rsm
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency