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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50eafbda490c18a3b7d65e4065ac947afa816e83
4
- data.tar.gz: aacaf73771c9a848e9c7fca1a280779a28b4ae9d
3
+ metadata.gz: 93c7691b034d94a2ba56cfa709c8a6c454f65b4a
4
+ data.tar.gz: fd78ddd0acbffb1e7141ca2d3aa8ccf71326b358
5
5
  SHA512:
6
- metadata.gz: 1feb29b876e35f0702e0954834c63fa1808e79e4c23d42cb6511ef5bf99e02c4ae0386f8418a5e71f6ce470f6dc4724411b87d25d4e302a44b304cb35da19c59
7
- data.tar.gz: 782deff8a3faa7dbf53eb914a888de2cbaa696ddb268ef3e62a7de90a65857580b6dbda92914f863bde0b2f17ae36dfc2dc3d88a00b97b2992c1a7e851ff4246
6
+ metadata.gz: c26816d06dd6ebff51bbbf1571a1ee733d64ec65cec884fd60ef5920ed81e66c94b38c53ab89946bb4b4ce834c86efbff2f5c57388ac50ae65e2f526263c5395
7
+ data.tar.gz: 2b4b6ad0de5684b8cbffc0b8bc2526c9c43fe32d8abc3becbaf38aae04684a636e25b5f62387e3bd99ef2ba156a0982b8bca7cd78cf37438753b1f0f33d4c7c5
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # StupidFileWriter
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/stupid_file_writer`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Write usage instructions here
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 false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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
@@ -3,7 +3,7 @@ require 'fileutils'
3
3
 
4
4
  module StupidFileWriter
5
5
  def self.write(path, content)
6
- create(path) unless File.exist?(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
@@ -1,3 +1,3 @@
1
1
  module StupidFileWriter
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  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.0
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-09-26 00:00:00.000000000 Z
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: