workspace 1.0.1 → 1.0.2
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 +4 -4
- data/README.md +50 -0
- data/lib/workspace/file.rb +0 -4
- data/lib/workspace/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e821d7eb0d6db9f7f7fbc53eccefc869d26ebc6
|
4
|
+
data.tar.gz: aaf8eac45192f79e60fb3c50f6e65f30aeb41fd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba0c31d40e477f6efe004a5ecf37fb5ece8d663b75f0a87d7bcfe3eab79003ff78470028f5b8056bc2eace2f9f5eb8b9114004dd9450463b7e94277c68d28c2d
|
7
|
+
data.tar.gz: e2499ed7222e7a106a950ef11d5dca0d2ee55121ff79cf91bc157af1b1892fc7a24698fd7ed4742e467f02dd94dd7729c79c073ed918dadc4636d67531973b11
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Workspace for Ruby
|
2
|
+
|
3
|
+
> Simplified Files and Directories handling
|
4
|
+
|
5
|
+
[](https://circleci.com/gh/MagLoft/workspace/tree/master)
|
6
|
+
|
7
|
+
## Description
|
8
|
+
|
9
|
+
Workspace makes it a breeze to work with files and directories.
|
10
|
+
|
11
|
+
## Synopsis
|
12
|
+
|
13
|
+
Workspace::Dir and Workspace::File are abstractions of the ruby Dir and File classes (although not extending them).
|
14
|
+
|
15
|
+
When working with files and folders, these abstractions can significantly help with keeping your code simple, consistent and easy to read.
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require "workspace"
|
19
|
+
|
20
|
+
root = Workspace.dir # initializes a workspace in the current directory
|
21
|
+
root = Workspace.tmpdir # initializes a new workspace in a temporary directory
|
22
|
+
|
23
|
+
root.file("file.txt").write("hello world") # creates the file "file.txt" with contents "hello world"
|
24
|
+
root.dir("dir").file("file.txt").create # both the file "file.txt" and its parent directory "dir"
|
25
|
+
|
26
|
+
root.dir("dir").exists? # => true
|
27
|
+
root.dir("dir").delete # deletes the physical file, but keeps the Workspace::Dir
|
28
|
+
root.dir("dir").exists? # => false
|
29
|
+
|
30
|
+
file = root.dir("dir1").file("file.txt")
|
31
|
+
file.relative_path(root.dir("dir2")) # => "../dir1/file.txt"
|
32
|
+
|
33
|
+
root.dir("build").clean # delete and re-create directory
|
34
|
+
|
35
|
+
root.files # [file1, file2, file3...]
|
36
|
+
root.directories # [dir1, dir2, dir3...]
|
37
|
+
root.children("**/*.rb") # [...] recursive matched files with .rb extension
|
38
|
+
```
|
39
|
+
|
40
|
+
## Installation
|
41
|
+
|
42
|
+
# install globally
|
43
|
+
gem install workspace
|
44
|
+
|
45
|
+
# install using bundler / Gemfile
|
46
|
+
gem "workspace"
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
workspace is available under an MIT-style license.
|
data/lib/workspace/file.rb
CHANGED
data/lib/workspace/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Strebitzer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -121,6 +121,7 @@ executables: []
|
|
121
121
|
extensions: []
|
122
122
|
extra_rdoc_files: []
|
123
123
|
files:
|
124
|
+
- README.md
|
124
125
|
- lib/workspace.rb
|
125
126
|
- lib/workspace/dir.rb
|
126
127
|
- lib/workspace/file.rb
|