workspace 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1148c1880a945f55539467fe3a1eb6a15da253a
4
- data.tar.gz: 93151cd507c31bf8b692cf79c20b477ccb52aadd
3
+ metadata.gz: 4e821d7eb0d6db9f7f7fbc53eccefc869d26ebc6
4
+ data.tar.gz: aaf8eac45192f79e60fb3c50f6e65f30aeb41fd7
5
5
  SHA512:
6
- metadata.gz: 1b8b8b79ba5208a1e01e9dcacb817b29bccf2b7b24f4ad537dd144289e8ff965d3b7b8a5c5303afb894a3b2d6295dae809f82ab7a0e228d70f30fcd363e4b3ee
7
- data.tar.gz: 834680ebf3c0787ebbbc5f66d85a5279acd3bf2dd465b18a8fb023f33d2d06c8808125e3f532b3dbf6a634d5a4d0016358a6b17b54ea467256bbcc6efa8704b9
6
+ metadata.gz: ba0c31d40e477f6efe004a5ecf37fb5ece8d663b75f0a87d7bcfe3eab79003ff78470028f5b8056bc2eace2f9f5eb8b9114004dd9450463b7e94277c68d28c2d
7
+ data.tar.gz: e2499ed7222e7a106a950ef11d5dca0d2ee55121ff79cf91bc157af1b1892fc7a24698fd7ed4742e467f02dd94dd7729c79c073ed918dadc4636d67531973b11
@@ -0,0 +1,50 @@
1
+ # Workspace for Ruby
2
+
3
+ > Simplified Files and Directories handling
4
+
5
+ [![CircleCI](https://circleci.com/gh/MagLoft/workspace/tree/master.svg?style=svg)](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.
@@ -58,10 +58,6 @@ module Workspace
58
58
  @contents ||= ::File.open(to_s).read
59
59
  end
60
60
 
61
- def read_json
62
- JSON.parse(read)
63
- end
64
-
65
61
  def set(data)
66
62
  @contents = data
67
63
  self
@@ -1,3 +1,3 @@
1
1
  module Workspace
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
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.1
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-08-10 00:00:00.000000000 Z
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