learn_writer 0.0.3 → 0.0.4

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: 7c470604d5c0f391505898ea0b027db4d992ac19
4
- data.tar.gz: bc2cc3876c650ebbaffd92d2f9dcbeb5791e4c7e
3
+ metadata.gz: 4f54bb10df3efea623e1e1d40cc86243fb37075d
4
+ data.tar.gz: 187e6765cceb9a3f3c230c9cdce1326c395a8d2c
5
5
  SHA512:
6
- metadata.gz: 5677e095f8959bd68bb985d99dca2049c2e640cc8a16b5a091a488e4298bb8f27c63f0e96674dac6696d688a982b54b14cccec929436c0775d5058fc5e97d68a
7
- data.tar.gz: 7cb3eabb258de78895699b0897a9fe4eee56aa82a2872b0573def559cbaca33fb5d1a977c596498892bea92c71c71f967fd8bf1bfe8fc7fd4a1924422385ebcf
6
+ metadata.gz: 7e6ca5c506eb0e3c2fa9c83e32ffcba1b5755863bd6d3f74d73b4fcfdbe62d6f68375abf70469a2a05586aca7d9a1023fe7ba26664517617760f4c19ac78d4e9
7
+ data.tar.gz: b3f0fb740664f4f471ef96b322e7b505d6c01aabd9b42f309d167df1a70c79e62b8d5a71cffafcb1e87a5a13c450746a7986ce8d55d97f7f617d542cbc6608fd
@@ -1,7 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative '../lib/learn_writer.rb'
3
3
 
4
-
5
- dir = Dir.pwd
6
- LearnWriter.new(dir).write_metadata
4
+ if ARGV.length == 0
5
+ dir = Dir.pwd
6
+ LearnWriter.new(dir).write_metadata
7
+ elsif ARGV.length == 1
8
+ LearnWriter.new(ARGV[0]).write_metadata
9
+ else
10
+ puts 'please use learn-write <directory name> or run learn-write from within the directory you want to add metadata to because you just cannot even'
11
+ end
7
12
 
@@ -1,4 +1,5 @@
1
1
  require 'fileutils'
2
+ require 'pry'
2
3
 
3
4
  class LearnWriter
4
5
 
@@ -20,24 +21,23 @@ class LearnWriter
20
21
  end
21
22
 
22
23
  def write_dot_learn
23
- dot_learn = "#{filepath}/.learn"
24
- dot_learn_content = File.read(VALID_DOT_LEARN)
25
- file = FileUtils.touch(dot_learn)[0]
26
- File.open(file, 'w') { |file| file.write(dot_learn_content) }
24
+ unless Dir.entries(filepath).include?('.learn')
25
+ create_and_write_file(".learn", VALID_DOT_LEARN)
26
+ end
27
27
  end
28
28
 
29
29
  def write_contributing
30
- contributing = "#{filepath}/CONTRIBUTING.md"
31
- contributing_content = File.read(VALID_CONTRIBUTING)
32
- file = FileUtils.touch(contributing)[0]
33
- File.open(file, 'w') { |file| file.write(contributing_content) }
30
+ create_and_write_file("CONTRIBUTING.md", VALID_CONTRIBUTING)
34
31
  end
35
32
 
36
33
  def write_license
37
- license = "#{filepath}/LICENSE.md"
38
- license_content = File.read(VALID_LICENSE)
39
- file = FileUtils.touch(license)[0]
40
- File.open(file, 'w') { |file| file.write(license_content) }
34
+ create_and_write_file("LICENSE.md", VALID_LICENSE)
35
+ end
41
36
 
37
+ def create_and_write_file(file_name, file_content)
38
+ file_name = "#{filepath}/#{file_name}"
39
+ file_content = File.read(file_content)
40
+ file = FileUtils.touch(file_name)[0]
41
+ File.open(file, 'w') { |file| file.write(file_content) }
42
42
  end
43
43
  end
@@ -1,3 +1,3 @@
1
1
  class LearnWriter
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: learn_writer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sophie DeBenedetto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-18 00:00:00.000000000 Z
11
+ date: 2015-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler