autosftp 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 428468172ce0e302ef74b75f8f71d87ddb9ee188
4
- data.tar.gz: c6f729fd3a0415b5c27afd998f32eb17aa7eff7c
3
+ metadata.gz: fe5f456ba5dfdc5d206c8da6c19d4455a97d1bd4
4
+ data.tar.gz: 48acaf854be4a9ed3defedf40722249109e83d90
5
5
  SHA512:
6
- metadata.gz: 2488fb0a523612b45008f914273ac691aac01d961eaf6ea26adff6dabb9341a8c8549b34f10dd121134adefb5be5d306aa957486dc353809d508819af9d4548d
7
- data.tar.gz: c690bf0685fa41d879d4cb7d7f40d1699d7b73b62e1bfe53462cfe7262da06dba767a8b84dadca73092025152030458622edd011d38f513235681ad9e3720c62
6
+ metadata.gz: c77d7e999ab097752489aaf41ccc428f612f1aa0e728484ce94c374e8bedb2b863d1cb77c9dc883cfb35995f85ddee3648bf38f7d64b9ac436ec21e023caaae5
7
+ data.tar.gz: de21aff9a28914d331843c7d258037eb2f5204316942d228dfc9b31c776b051a24e1aeeedbf8ed700e098da03d17342a822e8030b2e8195b0e208a06868f8e8a
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Autosftp
2
2
 
3
- ローカルファイルを監視し、自動でファイルをアップします。
3
+ ローカルファイルを監視し、自動でファイルをアップします。
4
+ mac windows linuxで一応動作します。
5
+ windowsはruby 2.0系だと動作しない可能性がありますので気をつけて下さい。
4
6
 
5
7
  ## Installation
6
8
 
@@ -18,15 +20,33 @@ Or install it yourself as:
18
20
 
19
21
  ## Usage
20
22
 
21
- ### 設定ファイルを準備します。プロジェクトの直下で作成したほうが良いです。
23
+ 設定ファイルを準備します。プロジェクトの直下で作成したほうが良いです。
24
+ yaml形式で.autosftpというファイルが作成されます。
22
25
 
23
26
  $ autosftp init
24
27
 
25
- ### 設定ファイルに接続先の情報を追加します。[remote name]は自由な名称をつけて下さい。
28
+ 設定ファイルに接続先の情報を追加します。[remote name]は自由な名称をつけて下さい。
29
+ 直接.autosftpファイルを修正しても問題ありません。
26
30
 
27
31
  $ autosftp set [remote name]
28
32
 
29
- ### 自動監視をスタートします。
33
+ 自動監視をスタートします。
30
34
 
31
35
  $ autosftp start [remote name]
32
36
 
37
+ 設定したsftpの情報を確認します。
38
+
39
+ $ autosftp list
40
+
41
+ 設定したsftpを削除します。
42
+
43
+ $ autosftp delete [remote name]
44
+
45
+ ## これからの予定
46
+
47
+ - 鍵認証出来るようにする。
48
+
49
+ ## 連絡先
50
+
51
+ https://twitter.com/pikonori
52
+
data/lib/autosftp/cli.rb CHANGED
@@ -8,24 +8,34 @@ module Autosftp
8
8
  class CLI < Thor
9
9
 
10
10
  desc "start [remote name]", "Automatic monitoring start"
11
- def start(word)
11
+ def start(*word)
12
12
  if false == Autosftp::FileAccess.exist?
13
13
  puts "is not .autosftp \n $ autosftp init"
14
14
  exit
15
15
  end
16
16
 
17
17
  conf = Autosftp::FileAccess.read
18
- if !conf[word]
18
+ if !conf[word[0]]
19
19
  puts "is not setting \n $ autosftp set [remote name]"
20
20
  exit
21
+ elsif
22
+ setting = conf[word[0]]
23
+ word.delete_at(0)
21
24
  end
22
25
 
23
- Autosftp::Monitor.start conf[word]
26
+ if 0 < word.size
27
+ dir = word.map {|a| a.to_s + "**/*"}
28
+ else
29
+ dir = '**/*'
30
+ end
31
+
32
+ Autosftp::Monitor.start setting, dir
24
33
  end
25
34
 
26
35
  desc "set [remote name]", "add information to the '.autosftp'. Please put the name of any [remote name]"
27
36
  def set(word)
28
37
  ssh_hash = {}
38
+
29
39
  begin
30
40
  puts "[username@host:port]"
31
41
  ssh_str = STDIN.gets.chomp
@@ -42,20 +52,6 @@ module Autosftp
42
52
  puts "remote path:"
43
53
  ssh_hash[:remote_path] = STDIN.gets.chomp
44
54
 
45
- begin
46
- Net::SSH.start(ssh_hash[:host], ssh_hash[:user], {:password => ssh_hash[:password], :port => ssh_hash[:port]}) do |ssh|
47
- command = 'ls ' + ssh_hash[:remote_path]
48
- ssh.exec!(command) do |channel, stream, data|
49
- if stream == :stderr
50
- raise
51
- end
52
- end
53
- end
54
- rescue
55
- puts "ssh connection ERROR"
56
- exit
57
- end
58
-
59
55
  puts "local path: --If you enter a blank, the current directory is set"
60
56
  ssh_hash[:local_path] = STDIN.gets.chomp
61
57
  if '' == ssh_hash[:local_path]
@@ -61,6 +61,7 @@ module Autosftp
61
61
  sftp.remove!(remote_file)
62
62
  end
63
63
  end
64
+ rescue
64
65
  end
65
66
 
66
67
  # ディレクトリの作成
@@ -4,8 +4,8 @@ require 'autosftp/connection'
4
4
 
5
5
  module Autosftp
6
6
  class Monitor
7
- def self.start setting
8
- FSSM.monitor(setting[:local_path], '**/*') do
7
+ def self.start setting, dir
8
+ FSSM.monitor(setting[:local_path], dir) do
9
9
  puts "C: create U: update D: delete E: error"
10
10
  puts ""
11
11
  puts "Host #{setting[:host]}"
@@ -1,3 +1,3 @@
1
1
  module Autosftp
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/autosftp.rb CHANGED
@@ -1,5 +1,2 @@
1
1
  require "autosftp/version"
2
2
  require "autosftp/cli"
3
-
4
- module Autosftp
5
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autosftp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - hirabaru
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2014-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh