stupid_file_writer 0.1.0 → 0.1.1
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 +7 -5
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/lib/stupid_file_writer.rb +5 -1
- data/lib/stupid_file_writer/version.rb +1 -1
- data/my_file.rb +1 -0
- 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: 93c7691b034d94a2ba56cfa709c8a6c454f65b4a
|
|
4
|
+
data.tar.gz: fd78ddd0acbffb1e7141ca2d3aa8ccf71326b358
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c26816d06dd6ebff51bbbf1571a1ee733d64ec65cec884fd60ef5920ed81e66c94b38c53ab89946bb4b4ce834c86efbff2f5c57388ac50ae65e2f526263c5395
|
|
7
|
+
data.tar.gz: 2b4b6ad0de5684b8cbffc0b8bc2526c9c43fe32d8abc3becbaf38aae04684a636e25b5f62387e3bd99ef2ba156a0982b8bca7cd78cf37438753b1f0f33d4c7c5
|
data/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# StupidFileWriter
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
|
3
|
+
This gem has one simple task. It should create a file with the given content. It creates the path if it's not existent.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
@@ -22,11 +20,15 @@ Or install it yourself as:
|
|
|
22
20
|
|
|
23
21
|
## Usage
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
```ruby
|
|
24
|
+
require 'stupid_file_writer'
|
|
25
|
+
|
|
26
|
+
StupidFileWriter.write('path/to/file.txt', 'This is my content')
|
|
27
|
+
```
|
|
26
28
|
|
|
27
29
|
## Development
|
|
28
30
|
|
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake
|
|
31
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
32
|
|
|
31
33
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
34
|
|
data/bin/console
CHANGED
|
File without changes
|
data/bin/setup
CHANGED
|
File without changes
|
data/lib/stupid_file_writer.rb
CHANGED
|
@@ -3,7 +3,7 @@ require 'fileutils'
|
|
|
3
3
|
|
|
4
4
|
module StupidFileWriter
|
|
5
5
|
def self.write(path, content)
|
|
6
|
-
create(path)
|
|
6
|
+
create(path) if is_path?(path) && !File.exist?(path)
|
|
7
7
|
file = File.open(path, 'w')
|
|
8
8
|
file.print content
|
|
9
9
|
file.close
|
|
@@ -13,4 +13,8 @@ module StupidFileWriter
|
|
|
13
13
|
path = path.split('/')[0..-2].join('/')
|
|
14
14
|
FileUtils.mkdir_p(path)
|
|
15
15
|
end
|
|
16
|
+
|
|
17
|
+
def self.is_path?(path)
|
|
18
|
+
path.include?('/')
|
|
19
|
+
end
|
|
16
20
|
end
|
data/my_file.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
New content in file!
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stupid_file_writer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maurice Kock
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-10-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -70,6 +70,7 @@ files:
|
|
|
70
70
|
- bin/setup
|
|
71
71
|
- lib/stupid_file_writer.rb
|
|
72
72
|
- lib/stupid_file_writer/version.rb
|
|
73
|
+
- my_file.rb
|
|
73
74
|
- stupid_file_writer.gemspec
|
|
74
75
|
homepage: https://github.com/onlinetocode/stupid_file_writer
|
|
75
76
|
licenses:
|