file_system_project 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/file_system_project.rb +7 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 506bced7ccc737e56ee95885ef05342228603f7d
|
4
|
+
data.tar.gz: e6f1040ea2f473287efeafe9f366b532bcaec716
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d08f419e453efb92fcdc2b12472f2ec0ae8ace91c25faedf35fab2eeb642710720fb50fa471b1cc788ddefb669cb9341efcd576e32b3d4250f616d89d8ef3ad
|
7
|
+
data.tar.gz: 57cee51b5427ea0d48b7316ea52ab1c397007fc5454faab207e952318744948e8accc6289edba8920cac7c639d7e3062370b968bd6610708d30f0374d85a9c7e
|
data/lib/file_system_project.rb
CHANGED
@@ -93,7 +93,7 @@ class FileSystemProject
|
|
93
93
|
def get_files(dir)
|
94
94
|
type = @file_system[:dirs][dir][:type]
|
95
95
|
locations = Dir.glob(File.join(dir_path(dir), '/**/*')).reject { |d| File.directory?(d) }
|
96
|
-
locations.map do |d|
|
96
|
+
locations.map do |d|
|
97
97
|
opts = @file_system[:dirs][dir][:versions] ? {version: get_version(d)} : {}
|
98
98
|
file_struct(type).new(d, opts)
|
99
99
|
end
|
@@ -104,11 +104,13 @@ class FileSystemProject
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def add_file(dir, *args)
|
107
|
-
fail ArgumentError unless valid_adder_args?(args)
|
107
|
+
fail ArgumentError, "Wrong number or type of file arguments." unless valid_adder_args?(args)
|
108
108
|
outdir = File.join(@root, dir)
|
109
109
|
ensure_dir_exists(outdir)
|
110
|
-
|
111
|
-
|
110
|
+
content = args[0]
|
111
|
+
options = args[1]
|
112
|
+
outfile = File.join(outdir, options[:name])
|
113
|
+
write_and_sync(outfile, content)
|
112
114
|
end
|
113
115
|
|
114
116
|
def write_and_sync(file, content)
|
@@ -122,7 +124,7 @@ class FileSystemProject
|
|
122
124
|
end
|
123
125
|
|
124
126
|
def valid_adder_args?(args)
|
125
|
-
args.size
|
127
|
+
args.size == 2 and args[1].is_a?(Hash)
|
126
128
|
end
|
127
129
|
end
|
128
130
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: file_system_project
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Corrigan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|