scccp 0.0.2 → 0.0.3

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scccp (0.0.1)
4
+ scccp (0.0.2)
5
5
  net-scp
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
1
  scccp
2
2
  =====
3
3
 
4
- automatically scp files in a specified folder
4
+ automatically scp files in a specified folder with some features
5
+
6
+ * double process check.(should not run multiple process for same purpose)
7
+ * create and send ok file.
8
+ * mv files to proper folder which moving process done.
data/example/sample.rb CHANGED
@@ -12,6 +12,7 @@ REMOTE_USER_PASSWORD = nil
12
12
  WORK_SPACE = '/tmp/test/scccp_sample/'
13
13
  REMOTE_PATH = WORK_SPACE + 'remote/'
14
14
  QUEUE_FOLDER = WORK_SPACE + 'from/'
15
+ LOCKFILE = WORK_SPACE + '.scccp.lock'
15
16
  OK_FOLDER = WORK_SPACE + 'ok'
16
17
  NG_FOLDER = WORK_SPACE + 'ng'
17
18
 
@@ -33,6 +34,7 @@ execute do
33
34
  scccp.remote_user_password = REMOTE_USER_PASSWORD
34
35
  scccp.remote_path = REMOTE_PATH
35
36
  scccp.queue_folder = QUEUE_FOLDER
37
+ scccp.lockfile = LOCKFILE
36
38
  scccp.ok_folder = OK_FOLDER
37
39
  scccp.ng_folder = NG_FOLDER
38
40
  scccp.proceed
data/lib/scccp/scp.rb CHANGED
@@ -10,6 +10,7 @@ module Scccp
10
10
  :remote_user_name,
11
11
  :remote_user_password,
12
12
  :remote_path,
13
+ :remote_port,
13
14
  :queue_folder,
14
15
  :ok_folder,
15
16
  :ng_folder,
@@ -26,6 +27,7 @@ module Scccp
26
27
  opts.each do |k, v|
27
28
  send("#{k}=", v)
28
29
  end
30
+ self.remote_port ||= 22
29
31
  end
30
32
 
31
33
  def attrs_ok?
@@ -57,6 +59,7 @@ module Scccp
57
59
  SIGNALS.each { |sig| trap(sig){receive_signal(sig)} }
58
60
 
59
61
  opt = {}
62
+ opt[:port] = remote_port
60
63
  if remote_user_password
61
64
  opt[:password] = remote_user_password
62
65
  end
@@ -82,7 +85,7 @@ module Scccp
82
85
  end
83
86
 
84
87
  logger.info("queue_folder is #{queue_folder}")
85
- logger.info("target is #{remote_host}:#{remote_path}")
88
+ logger.info("target is #{remote_host}:#{remote_port}:#{remote_path}")
86
89
  #logger.info(files.inspect)
87
90
  uploaded_count = 0
88
91
 
data/lib/scccp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scccp
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/test/test.rb CHANGED
@@ -3,7 +3,6 @@
3
3
  $: << File.dirname(__FILE__)
4
4
  require 'test_helper'
5
5
  require 'test/unit'
6
- require 'Fileutils'
7
6
 
8
7
  require 'scccp'
9
8
 
@@ -14,6 +13,7 @@ class TestScccp < Test::Unit::TestCase
14
13
  OK_FOLDER = "#{SCCCP_WORKING_DIR}done/"
15
14
  NG_FOLDER = "#{SCCCP_WORKING_DIR}error/"
16
15
  REMOTE_PATH = "#{SCCCP_WORKING_DIR}remote/"
16
+ REMOTE_PORT = 22
17
17
  LOCK_FILE = "#{SCCCP_WORKING_DIR}test.lock"
18
18
  REMOTE_USER_NAME = 'paco'
19
19
  REMOTE_USER_PASSWORD = nil
@@ -162,4 +162,28 @@ class TestScccp < Test::Unit::TestCase
162
162
  assert_true File.exists?(@l_file_tmp)
163
163
  assert_true File.exists?(@l_file_ok)
164
164
  end
165
+
166
+ def test_scccp_with_port
167
+ assert_true File.exists?(@l_file)
168
+ assert_true File.exists?(@l_file1)
169
+ scccp = Scccp::Scp.new()
170
+ scccp.logger = Logger.new('/dev/null')
171
+ scccp.remote_host = REMOTE_HOST
172
+ # ここが増えただけ
173
+ scccp.remote_port = REMOTE_PORT
174
+ scccp.remote_user_name = REMOTE_USER_NAME
175
+ scccp.remote_user_password = REMOTE_USER_PASSWORD
176
+ scccp.remote_path = REMOTE_PATH
177
+ scccp.queue_folder = 'hohogege'
178
+ scccp.ok_folder = OK_FOLDER
179
+ scccp.ng_folder = NG_FOLDER
180
+ scccp.queue_folder = QUEUE_FOLDER
181
+ scccp.proceed
182
+
183
+ assert_true File.exists?(REMOTE_PATH + "testfile2")
184
+ assert_true File.exists?(REMOTE_PATH + "testfile2.ok")
185
+
186
+ assert_true File.exists?(@l_file_tmp)
187
+ assert_true File.exists?(@l_file_ok)
188
+ end
165
189
  end
data/test/test_helper.rb CHANGED
@@ -1,3 +1,8 @@
1
+
2
+ require 'bundler'
3
+ Bundler.setup
4
+ Bundler.require(:test)
5
+
1
6
  $: << File.dirname(__FILE__) + '/../lib'
2
7
 
3
8
  require 'scccp'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scccp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-11 00:00:00.000000000 Z
12
+ date: 2013-01-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-scp