server_remote 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -7,6 +7,7 @@ Currently, it provides the following commands:
7
7
  * @remote shell@ - same as ssh'ing to the server (this is the default command, so it can be called with just @remote@)
8
8
  * @remote console@ - executes a @script/console@ on the server
9
9
  * @remote logtail@ - executes @tail -f log/<environment>.log@ on the server
10
+ * @remote logtail path/to/logfile@ - executes @tail -f path/to/logfile@ on the server
10
11
  * @remote cmd <some command>@ executes command on the server, displaying the result. It @cd@'s to the remote app root first.
11
12
  * @remote scp <local_file> :<remote_file>@ provides scp. Prefix remote files with ':'
12
13
 
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 2
3
+ :minor: 3
4
4
  :patch: 0
@@ -53,8 +53,14 @@ module ServerRemote
53
53
  "cd #{config[:app_path]}"
54
54
  end
55
55
 
56
- def tail_action
57
- "tail -n #{config[:tail_initial_lines]} -f log/#{config[:environment]}.log"
56
+ def tail_action(args)
57
+ if args and !args.empty?
58
+ file = args.join(' ')
59
+ else
60
+ file = "log/#{config[:environment]}.log"
61
+ end
62
+
63
+ "tail -n #{config[:tail_initial_lines]} -f #{file}"
58
64
  end
59
65
 
60
66
  def remote_command(args)
@@ -172,7 +178,7 @@ EOH
172
178
  end
173
179
 
174
180
  def logtail(*args)
175
- execute remote_command_in_app(tail_action)
181
+ execute remote_command_in_app(tail_action(args))
176
182
  end
177
183
 
178
184
  def cmd_help
@@ -26,7 +26,11 @@ class ServerRemoteTest < Test::Unit::TestCase
26
26
  def test_logtail_action
27
27
  assert_equal "ssh -t test 'cd /mnt/app/current;tail -n 500 -f log/production.log'", run_cmd(%w{logtail})
28
28
  end
29
-
29
+
30
+ def test_logtail_action_with_other_log
31
+ assert_equal "ssh -t test 'cd /mnt/app/current;tail -n 500 -f blah'", run_cmd(%w{logtail blah})
32
+ end
33
+
30
34
  def test_cmd_action
31
35
  assert_match /^Summary:/, run_cmd(%w{cmd})
32
36
  assert_equal "ssh -t test 'cd /mnt/app/current;ls'", run_cmd(%w{cmd ls})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: server_remote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Crawley
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-01 00:00:00 -04:00
12
+ date: 2009-10-07 00:00:00 -04:00
13
13
  default_executable: server_remotify
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency