makeme 0.1.0 → 0.2.0
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 +2 -1
- data/exe/makeme +1 -1
- data/lib/makeme/fill.rb +2 -0
- data/lib/makeme/fill_helpers.rb +6 -8
- data/lib/makeme/version.rb +1 -1
- data/lib/makeme.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8479e0344a32cad5430ce2bebce1834c4254568
|
4
|
+
data.tar.gz: aa6b64c6aba557c9cb8bcd150f9ec23bec982c23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e976f7425702af1cf65a39d774fa8747f9eeda8d9d9e22e7cbc0a59653856fa42308f26da21db93e6f0bf42824a6d1284448780d5598423222abeac45285984
|
7
|
+
data.tar.gz: a6e02cb8c0388bbd431309062839e69ff2a147fb6038869511bdd31c357a5dc7b8cd8483eef93cafa0a6fd6edc1cefe78117fdab04d6a4c90da704f0163fdbba
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# Makeme
|
1
|
+
# Makeme [](https://travis-ci.org/beneills/makeme) [](http://doge.mit-license.org)
|
2
|
+
|
2
3
|
Create a new file by guessing contents from filename
|
3
4
|
|
4
5
|
## Usage
|
data/exe/makeme
CHANGED
data/lib/makeme/fill.rb
CHANGED
data/lib/makeme/fill_helpers.rb
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
module Internal
|
2
|
-
def placeholder(text)
|
3
|
-
text.upcase
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
1
|
class FillHelpers
|
8
2
|
def initialize(working_directory, absolute_file_path, guess_data)
|
9
3
|
@working_directory = working_directory
|
@@ -15,6 +9,10 @@ class FillHelpers
|
|
15
9
|
binding
|
16
10
|
end
|
17
11
|
|
12
|
+
def placeholder(text)
|
13
|
+
text.upcase
|
14
|
+
end
|
15
|
+
|
18
16
|
def parent_directory
|
19
17
|
parent = Pathname.new(@absolute_file_path).parent.basename
|
20
18
|
|
@@ -33,6 +31,6 @@ class FillHelpers
|
|
33
31
|
Etc.getlogin
|
34
32
|
end
|
35
33
|
|
36
|
-
def project; heuristic_project ||
|
37
|
-
def username; heuristic_username ||
|
34
|
+
def project; heuristic_project || placeholder("myproject"); end
|
35
|
+
def username; heuristic_username || placeholder("username"); end
|
38
36
|
end
|
data/lib/makeme/version.rb
CHANGED
data/lib/makeme.rb
CHANGED
@@ -13,11 +13,11 @@ module Makeme
|
|
13
13
|
! absolute_file_path.end_with?('/') || founder('File is a directory!')
|
14
14
|
|
15
15
|
# Guess which template is right, or nil
|
16
|
-
guess_data, template_contents = Guess
|
16
|
+
guess_data, template_contents = Guess.guess(working_directory, absolute_file_path, options)
|
17
17
|
! template_contents.nil? || founder('Couldn\'t guess a template for that file!')
|
18
18
|
|
19
19
|
# Fill in template
|
20
|
-
contents = Fill
|
20
|
+
contents = Fill.fill(working_directory, absolute_file_path, guess_data, template_contents, options)
|
21
21
|
|
22
22
|
# Write to file
|
23
23
|
open(absolute_file_path, 'w') do |f|
|