new 0.0.4 → 0.0.5
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/lib/new/interpolate.rb +1 -4
- data/lib/new.rb +0 -1
- data/new_project/.new +2 -0
- data/new_project/custom_bar_template/.new +3 -0
- data/spec/lib/new/interpolate_spec.rb +4 -4
- data/spec/lib/new/project_spec.rb +7 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afe2f42c9590339bfbaaec0eacf6589142d06328
|
4
|
+
data.tar.gz: e997f01b1ae47182531cf8358dfc7f391bdb1ab4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c10a6b9ac56adc91300818bddcc0a3af01a75b0230406b7649ff0ce7b189298da4215753f86c9497eeecf6d04eb3c60965adfc5dac0ea2548b5b1a6bab755484
|
7
|
+
data.tar.gz: f47bd284b19253c6d6f3920b8c7fa607a9501843d09b02435635d5dd60a4e04f8de4e5715b6a5653741beca3cb7b3368341a580d5fe10d5e0fafdbfa469fed54
|
data/lib/new/interpolate.rb
CHANGED
@@ -34,10 +34,7 @@ private
|
|
34
34
|
|
35
35
|
def copy_to_tmp
|
36
36
|
# Create a unique temporary path to store the processed files
|
37
|
-
@dest_path =
|
38
|
-
|
39
|
-
# Create a directory if an individual file is being processed
|
40
|
-
FileUtils.mkdir_p @dest_path if File.file? @src_path
|
37
|
+
@dest_path = Dir.mktmpdir
|
41
38
|
|
42
39
|
# Copy to tmp
|
43
40
|
FileUtils.cp_r @src_path, @dest_path
|
data/lib/new.rb
CHANGED
data/new_project/.new
ADDED
@@ -23,12 +23,12 @@ describe New::Interpolate do
|
|
23
23
|
|
24
24
|
it 'should process and rename .erb files' do
|
25
25
|
# check that files exist
|
26
|
-
expect(File.exists?(File.join(@obj.dir, 'baz.txt'))).to eq true
|
27
|
-
expect(File.exists?(File.join(@obj.dir, 'nested_baz', 'foo.txt'))).to eq true
|
26
|
+
expect(File.exists?(File.join(@obj.dir, 'foo_template', 'baz.txt'))).to eq true
|
27
|
+
expect(File.exists?(File.join(@obj.dir, 'foo_template', 'nested_baz', 'foo.txt'))).to eq true
|
28
28
|
|
29
29
|
# check their content has been processed
|
30
|
-
expect(File.open(File.join(@obj.dir, 'baz.txt')).read).to include 'foo baz'
|
31
|
-
expect(File.open(File.join(@obj.dir, 'nested_baz', 'foo.txt')).read).to include 'foo baz'
|
30
|
+
expect(File.open(File.join(@obj.dir, 'foo_template', 'baz.txt')).read).to include 'foo baz'
|
31
|
+
expect(File.open(File.join(@obj.dir, 'foo_template', 'nested_baz', 'foo.txt')).read).to include 'foo baz'
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should create dot notation accessible options' do
|
@@ -2,15 +2,18 @@ require 'spec_helper'
|
|
2
2
|
require 'recursive-open-struct'
|
3
3
|
|
4
4
|
describe New::Project do
|
5
|
-
let(:template_dir){ File.join(
|
6
|
-
let(:project_dir){ File.join(
|
5
|
+
let(:template_dir){ File.join(@tmp_dir, 'custom_bar_template') }
|
6
|
+
let(:project_dir){ File.join(@tmp_dir, 'new_project') }
|
7
7
|
let(:project){ New::Project.new(:custom_bar_template, :new_project) }
|
8
8
|
let(:project_config) { YAML.load(File.open(File.join(project_dir, New::CONFIG_FILE))).deep_symbolize_keys! }
|
9
9
|
|
10
10
|
before do
|
11
|
-
Dir.
|
12
|
-
FileUtils.cp_r root('spec', 'fixtures', 'custom', 'templates', 'custom_bar_template'),
|
11
|
+
@tmp_dir = Dir.mktmpdir
|
12
|
+
FileUtils.cp_r root('spec', 'fixtures', 'custom', 'templates', 'custom_bar_template'), @tmp_dir
|
13
13
|
New::Template.stub(:new).and_return(RecursiveOpenStruct.new({ options: {}, dir: template_dir }))
|
14
|
+
|
15
|
+
# change directory before creating a project since it uses pwd
|
16
|
+
Dir.chdir @tmp_dir
|
14
17
|
project
|
15
18
|
end
|
16
19
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: new
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Brewster
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: brewster1134@gmail.com
|
@@ -34,6 +34,8 @@ files:
|
|
34
34
|
- lib/new/task.rb
|
35
35
|
- lib/new/template.rb
|
36
36
|
- lib/new/version.rb
|
37
|
+
- new_project/.new
|
38
|
+
- new_project/custom_bar_template/.new
|
37
39
|
- spec/fixtures/custom/.new
|
38
40
|
- spec/fixtures/custom/tasks/custom_bar_task/custom_bar_task.rb
|
39
41
|
- spec/fixtures/custom/templates/custom_bar_template/.new
|