orion 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/orion/delete.rb +2 -3
- data/lib/orion/info.rb +35 -0
- data/lib/orion/orion_objects/array.rb +11 -0
- data/lib/orion/orion_objects/hash.rb +7 -0
- data/lib/orion/orion_objects/nil.rb +7 -0
- data/lib/orion/orion_support/i18n.rb +3 -0
- data/lib/orion/search.rb +3 -6
- data/lib/orion/version.rb +2 -2
- data/lib/orion.rb +9 -1
- metadata +12 -22
- data/lib/orion/result.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 142f0738a84b14879a801534a2a582b442078d27
|
4
|
+
data.tar.gz: f2bf18e3513faa642b8529d9645bbed978f63861
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03df67ff4fb3b9d79a6047f0e8cfebc2509fff6326d3a47ebe15aca4eb08facf64da5e04ead7e700f0f652fcf8c9f9fa03c5b2b2da877b19427a520466657f9b
|
7
|
+
data.tar.gz: 4f9a11da2b86a0cf54360e42cee99a6f6d3b1300ac33c1a18c1238dbc579d174fc36cb9cb3800b16af0e86f8f5cede0f883cdcc52dabbe04e76dcd9991f51d3b
|
data/lib/orion/delete.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require
|
2
|
-
include Orion::Result
|
1
|
+
require "orion/orion_objects/array"
|
3
2
|
|
4
3
|
module Orion
|
5
4
|
module Delete
|
@@ -8,7 +7,7 @@ module Orion
|
|
8
7
|
end
|
9
8
|
|
10
9
|
def self.with_response(files)
|
11
|
-
|
10
|
+
delete_files(files).to_orion
|
12
11
|
end
|
13
12
|
|
14
13
|
private
|
data/lib/orion/info.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require "orion/orion_objects/hash"
|
2
|
+
require "orion/orion_support/i18n"
|
3
|
+
|
4
|
+
module Orion
|
5
|
+
class Info
|
6
|
+
def initialize(path)
|
7
|
+
@path ||= path
|
8
|
+
end
|
9
|
+
|
10
|
+
def info(*methods)
|
11
|
+
methods = Info.available_methods & methods
|
12
|
+
if methods.empty?
|
13
|
+
raise I18n.t("errors.get_info.no_correct_methods", methods: Info.available_methods.join(", "))
|
14
|
+
else
|
15
|
+
methods.one? ? single_method(methods.first) : find_info_from(methods).to_orion
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def find_info_from(methods)
|
22
|
+
Hash[methods.map { |method| [method, File.send(method, @path)] }]
|
23
|
+
end
|
24
|
+
|
25
|
+
def single_method(method)
|
26
|
+
File.send(method, @path)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.available_methods
|
30
|
+
[:atime, :ctime, :mtime, :ftype, :size, :absolute_path, :basename,
|
31
|
+
:directory?, :dirname, :executable?, :exists?, :extname, :file?,
|
32
|
+
:readable?, :socket?, :symlink?, :writable?, :zero?]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/orion/search.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'find'
|
2
|
-
require
|
3
|
-
|
4
|
-
include Orion::Result
|
2
|
+
require "orion/orion_objects/array"
|
3
|
+
require "orion/orion_objects/nil"
|
5
4
|
|
6
5
|
module Orion
|
7
6
|
class Search
|
@@ -16,7 +15,7 @@ module Orion
|
|
16
15
|
end
|
17
16
|
|
18
17
|
def with_response(query)
|
19
|
-
|
18
|
+
find(query).to_orion
|
20
19
|
end
|
21
20
|
|
22
21
|
private
|
@@ -31,7 +30,5 @@ module Orion
|
|
31
30
|
end
|
32
31
|
results
|
33
32
|
end
|
34
|
-
|
35
33
|
end
|
36
|
-
|
37
34
|
end
|
data/lib/orion/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Orion
|
2
|
-
VERSION = "0.0
|
3
|
-
end
|
2
|
+
VERSION = "0.1.0"
|
3
|
+
end
|
data/lib/orion.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
+
require "orion/orion_support/i18n"
|
1
2
|
require "orion/version"
|
2
3
|
require "orion/search"
|
3
4
|
require "orion/delete"
|
5
|
+
require "orion/info"
|
4
6
|
|
5
7
|
module Orion
|
6
8
|
def self.search(root_path, query)
|
7
|
-
Orion::Search.new(root_path).with_response(query)
|
9
|
+
method_call = Orion::Search.new(root_path).with_response(query)
|
10
|
+
block_given? ? yield(method_call) : method_call
|
8
11
|
end
|
9
12
|
|
10
13
|
def self.delete(root_path, query)
|
@@ -15,4 +18,9 @@ module Orion
|
|
15
18
|
Orion::Delete.delete(found_files)
|
16
19
|
end
|
17
20
|
end
|
21
|
+
|
22
|
+
def self.get_info(path, *methods)
|
23
|
+
method_call = Orion::Info.new(path).info(*methods)
|
24
|
+
block_given? ? yield(method_call) : method_call
|
25
|
+
end
|
18
26
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bismark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: i18n
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.6.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.6.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,21 +66,7 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
-
|
70
|
-
name: factory_girl
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '>='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
description: Orion allows you to search and delete files in your system.
|
69
|
+
description: Orion allows you to perform some file-related tasks in the filesystem.
|
84
70
|
email:
|
85
71
|
- bismark64@gmail.com
|
86
72
|
executables: []
|
@@ -90,10 +76,14 @@ files:
|
|
90
76
|
- lib/boyer_moore/rich_hash.rb
|
91
77
|
- lib/boyer_moore/boyer_moore.rb
|
92
78
|
- lib/orion.rb
|
79
|
+
- lib/orion/orion_support/i18n.rb
|
80
|
+
- lib/orion/orion_objects/array.rb
|
81
|
+
- lib/orion/orion_objects/nil.rb
|
82
|
+
- lib/orion/orion_objects/hash.rb
|
93
83
|
- lib/orion/version.rb
|
94
84
|
- lib/orion/delete.rb
|
95
|
-
- lib/orion/result.rb
|
96
85
|
- lib/orion/search.rb
|
86
|
+
- lib/orion/info.rb
|
97
87
|
homepage: https://github.com/bismark64/orion
|
98
88
|
licenses:
|
99
89
|
- MIT
|
@@ -117,5 +107,5 @@ rubyforge_project:
|
|
117
107
|
rubygems_version: 2.0.3
|
118
108
|
signing_key:
|
119
109
|
specification_version: 4
|
120
|
-
summary: Orion allows you to
|
110
|
+
summary: Orion allows you to perform some file-related tasks in the filesystem
|
121
111
|
test_files: []
|
data/lib/orion/result.rb
DELETED