Titania 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Titania.gemspec +2 -1
- data/lib/Titania.rb +94 -1
- data/lib/Titania/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67fdba9a45737843a03420bc799e23764d8868d3
|
4
|
+
data.tar.gz: e3ebde3d8fea78c717d6b24b1274a7cfc406d08d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba089c66ab14411d87419065652f2c024c60cae09f7842507f47c916e6fc7858c6bd2510e55dbb5c315bcd66c10b03aae388c50c589701c53d927c3b151d7a0c
|
7
|
+
data.tar.gz: 422a79bfb443e76cef5a4b1b8fa6f52caa10151ac61ee9f835bb1fc92ce4f080041efbcccea357bec80cd84e2911ec80f9c64dac865382353a4679fd832fdc4e
|
data/Titania.gemspec
CHANGED
@@ -10,8 +10,9 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["iamcodegrab@gmail.com"]
|
11
11
|
spec.description = %q{FTP Connection & Management Gem}
|
12
12
|
spec.summary = %q{Ruby FTP Connection & Management Gem}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/sedatciftci/Titania"
|
14
14
|
spec.license = "MIT"
|
15
|
+
spec.rdoc_options << '--main' << 'README'
|
15
16
|
|
16
17
|
spec.files = `git ls-files`.split($/)
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
data/lib/Titania.rb
CHANGED
@@ -1,4 +1,97 @@
|
|
1
1
|
require "net/ftp"
|
2
2
|
require "Titania/version"
|
3
|
-
|
3
|
+
|
4
|
+
|
5
|
+
module Titania
|
6
|
+
class Connection
|
7
|
+
attr_accessor :connect
|
8
|
+
|
9
|
+
@@host
|
10
|
+
@@username
|
11
|
+
@@password
|
12
|
+
|
13
|
+
def initialize(host,username,password)
|
14
|
+
@@host = host
|
15
|
+
@@username = username
|
16
|
+
@@password = password
|
17
|
+
end
|
18
|
+
|
19
|
+
def connect
|
20
|
+
con = self.connect = Net::FTP::new(@@host, @@username, @@password)
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_list(path = '/')
|
24
|
+
|
25
|
+
# File List / Return Array
|
26
|
+
|
27
|
+
result = self.connect.list(path)
|
28
|
+
end
|
29
|
+
|
30
|
+
def current_dir
|
31
|
+
# get current dir
|
32
|
+
self.connect.pwd
|
33
|
+
end
|
34
|
+
|
35
|
+
def change_dir(path)
|
36
|
+
# Change dir
|
37
|
+
self.connect.chdir(path)
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
def delete_file(path, file_name)
|
42
|
+
# Delete file
|
43
|
+
self.connect.delete(path + "/" + file_name)
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def create_dir(path, dir_name)
|
48
|
+
# Create dir
|
49
|
+
|
50
|
+
self.connect.mkdir(path + "/" + dir_name)
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def help(argv = nil)
|
55
|
+
# Help
|
56
|
+
cmd = "HELP"
|
57
|
+
if argv
|
58
|
+
cmd = cmd + " " + argv
|
59
|
+
end
|
60
|
+
|
61
|
+
self.connect.sendcmd(cmd)
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
def change_name(f_name, c_name)
|
66
|
+
# Change file or directory name
|
67
|
+
self.connect.rename(f_name, c_name)
|
68
|
+
end
|
69
|
+
|
70
|
+
def remove_dir(dir)
|
71
|
+
# Remove dir
|
72
|
+
self.connect.rmdir(dir)
|
73
|
+
end
|
74
|
+
|
75
|
+
def file_size(file)
|
76
|
+
# Get File Size
|
77
|
+
self.connect.size(file)
|
78
|
+
end
|
79
|
+
|
80
|
+
def connection_status
|
81
|
+
# Connection status
|
82
|
+
if self.connect.closed?
|
83
|
+
puts "Connection is closed !"
|
84
|
+
else
|
85
|
+
puts "Connection is active !"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def close
|
90
|
+
# close connection
|
91
|
+
self.connect.close
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
4
97
|
|
data/lib/Titania/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Titania
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sedat Ciftci
|
@@ -53,12 +53,14 @@ files:
|
|
53
53
|
- Titania.gemspec
|
54
54
|
- lib/Titania.rb
|
55
55
|
- lib/Titania/version.rb
|
56
|
-
homepage:
|
56
|
+
homepage: https://github.com/sedatciftci/Titania
|
57
57
|
licenses:
|
58
58
|
- MIT
|
59
59
|
metadata: {}
|
60
60
|
post_install_message:
|
61
|
-
rdoc_options:
|
61
|
+
rdoc_options:
|
62
|
+
- --main
|
63
|
+
- README
|
62
64
|
require_paths:
|
63
65
|
- lib
|
64
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|