rails_remote_console 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 845be9884f52019f42f25551c1fb72c53ca765cb
4
- data.tar.gz: a65ca2220819f8f3269f33f05f8e7c5bac389137
3
+ metadata.gz: 7923d1b8b2b794b9fa10e8d4860bad5fc878112a
4
+ data.tar.gz: 720ab81ea26c0bd675b9c540af1d86e24c00a00c
5
5
  SHA512:
6
- metadata.gz: e29315953f53f4621a26beafb2aaec572b5cbed28d94a85df14b6546586f646f76e5d1913f12fc60e45918eca1646f256b00c2170fe67bbda6615f0c633862e6
7
- data.tar.gz: 80bb4dbd3eeb10ddde0917b549ee080e52d45b992dba2c5f1b51443084a4b3a6c5f568e756bb48d9a3209761bb89ad020f3a2145d6046bf931b0d71ae4331c10
6
+ metadata.gz: 592752918df8d33caae7bbee5c4f221607205eed2445afca46c61eaf1c7a51fc11ae8d13e376e7792c5b495603b6886487c5c101358193a86062ff4590723876
7
+ data.tar.gz: c8fe7bdc192319f2908780eb24f47b5d7fac77e6871c16ae5b2ba12a162ccfe34483f9be00bad124ae8ad010b0e6f85475d1df26fd0d8896923a6585291404a1
@@ -1,3 +1,3 @@
1
1
  module RailsRemoteConsole
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
@@ -11,16 +11,25 @@ end
11
11
  class RailsRemoteConsoleTask
12
12
  def call(in_env)
13
13
  env = in_env || 'staging'
14
+ eval File.read("#{Rails.root}/config/deploy.rb")
14
15
  eval File.read("#{Rails.root}/config/deploy/#{env}.rb")
15
16
 
16
17
  @port ||= 22
17
18
 
18
- exec "ssh -l #{@server_user} #{@server_ip} -p#{@port} -t \
19
+ cmd = "ssh -l #{@server_user} #{@server_ip} -p#{@port} -t \
19
20
  'source ~/.bashrc && cd #{@deploy_to}/current && \
20
21
  /home/#{@server_user}/.rbenv/shims/ruby bin/rails c #{env}'"
22
+
23
+ exec cmd
21
24
  end
22
25
 
23
26
  def method_missing(name, *args, &block)
27
+ if name == :fetch
28
+ if %w[application stage deploy_user full_app_name].index(args[0].to_s)
29
+ return instance_variable_get("@#{args[0]}")
30
+ end
31
+ end
32
+
24
33
  return self unless %I[server set].include?(name)
25
34
  @server_ip ||= if name == :server
26
35
  args[0]
@@ -28,7 +37,17 @@ class RailsRemoteConsoleTask
28
37
  args[1]
29
38
  end
30
39
  @server_user ||= args[1] if name == :set && args[0] == :user
40
+ if name == :set && args[0] == :deploy_user
41
+ @deploy_user ||= args[1]
42
+ @server_user = @deploy_user
43
+ end
44
+
31
45
  @deploy_to ||= args[1] if name == :set && args[0] == :deploy_to
32
46
  @port ||= args[1] if name == :set && args[0] == :port
47
+
48
+ @application ||= args[1] if name == :set && args[0].to_s == 'application'
49
+ @stage ||= args[1] if name == :set && args[0].to_s == 'stage'
50
+ @full_app_name ||= args[1] \
51
+ if name == :set && args[0].to_s == 'full_app_name'
33
52
  end
34
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_remote_console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Huynh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-02 00:00:00.000000000 Z
11
+ date: 2017-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler