learn_writer 0.0.4 → 0.0.5

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: 4f54bb10df3efea623e1e1d40cc86243fb37075d
4
- data.tar.gz: 187e6765cceb9a3f3c230c9cdce1326c395a8d2c
3
+ metadata.gz: 3fd4af31185de495f5443cfb8ff3766f3a7b7a73
4
+ data.tar.gz: 246d1abc79873ef5574a5ef6f975dcfc8ee0bc22
5
5
  SHA512:
6
- metadata.gz: 7e6ca5c506eb0e3c2fa9c83e32ffcba1b5755863bd6d3f74d73b4fcfdbe62d6f68375abf70469a2a05586aca7d9a1023fe7ba26664517617760f4c19ac78d4e9
7
- data.tar.gz: b3f0fb740664f4f471ef96b322e7b505d6c01aabd9b42f309d167df1a70c79e62b8d5a71cffafcb1e87a5a13c450746a7986ce8d55d97f7f617d542cbc6608fd
6
+ metadata.gz: 5ab32ccebda63a057bb9fa25f0a715fdbdb454d387e05d0589f3afb19a8252dc8104c4e58e2c6f005b78e260f74cf3b8fe1bfacb497ae14b9d82291b86ebf336
7
+ data.tar.gz: 59de14fc15993528248224e9c415e644ce68775540736f9b6f3680e9a68d3f7c6755d5c4666b29e9be4dd3dff28b30703e2b626d9a8e0cbe5700c33f06e69749
data/bin/learn-write CHANGED
File without changes
data/lib/learn_writer.rb CHANGED
@@ -2,12 +2,13 @@ require 'fileutils'
2
2
  require 'pry'
3
3
 
4
4
  class LearnWriter
5
-
5
+ VALID_DOT_EDITORCONFIG = File.open(File.expand_path(File.dirname(__FILE__)) + '/learn_writer/valid_dot_editorconfig')
6
+ VALID_DOT_GITIGNORE = File.open(File.expand_path(File.dirname(__FILE__)) + '/learn_writer/valid_dot_gitignore')
6
7
  VALID_DOT_LEARN = File.open(File.expand_path(File.dirname(__FILE__)) + '/learn_writer/valid_dot_learn.yml')
7
8
  VALID_CONTRIBUTING = File.open(File.expand_path(File.dirname(__FILE__)) + '/learn_writer/valid_contributing.md')
8
9
  VALID_LICENSE = File.open(File.expand_path(File.dirname(__FILE__)) + '/learn_writer/valid_license.md')
9
10
 
10
-
11
+
11
12
  attr_accessor :filepath
12
13
 
13
14
  def initialize(filepath)
@@ -15,15 +16,23 @@ class LearnWriter
15
16
  end
16
17
 
17
18
  def write_metadata
19
+ write_dot_editorconfig
20
+ write_dot_gitignore
18
21
  write_dot_learn
19
22
  write_contributing
20
23
  write_license
21
24
  end
22
25
 
26
+ def write_dot_editorconfig
27
+ create_and_write_file('.editorconfig', VALID_DOT_EDITORCONFIG, false)
28
+ end
29
+
30
+ def write_dot_gitignore
31
+ create_and_write_file('.gitignore', VALID_DOT_GITIGNORE, false)
32
+ end
33
+
23
34
  def write_dot_learn
24
- unless Dir.entries(filepath).include?('.learn')
25
- create_and_write_file(".learn", VALID_DOT_LEARN)
26
- end
35
+ create_and_write_file(".learn", VALID_DOT_LEARN, false)
27
36
  end
28
37
 
29
38
  def write_contributing
@@ -34,10 +43,12 @@ class LearnWriter
34
43
  create_and_write_file("LICENSE.md", VALID_LICENSE)
35
44
  end
36
45
 
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) }
46
+ def create_and_write_file(file_name, file_content, overwrite=true)
47
+ if overwrite || !Dir.entries(filepath).include?(file_name)
48
+ file_name = "#{filepath}/#{file_name}"
49
+ file_content = File.read(file_content)
50
+ file = FileUtils.touch(file_name)[0]
51
+ File.open(file, 'w') { |f| f.write(file_content) }
52
+ end
42
53
  end
43
- end
54
+ end
@@ -1,6 +1,6 @@
1
1
  # Contributing to Learn.co Curriculum
2
2
 
3
- We're really exited that you're about to contribute to the [open curriculum](https://learn.co/content-license) on [Learn.co](https://learn.co). If this is your first time contributing, please continue reading to learn how to make the most meaningful and useful impact possible.
3
+ We're really excited that you're about to contribute to the [open curriculum](https://learn.co/content-license) on [Learn.co](https://learn.co). If this is your first time contributing, please continue reading to learn how to make the most meaningful and useful impact possible.
4
4
 
5
5
  ## Raising an Issue to Encourage a Contribution
6
6
 
@@ -1,3 +1,3 @@
1
1
  class LearnWriter
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
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.4
4
+ version: 0.0.5
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-20 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler