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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a52f9fbab9419ca7e5be28c87a0963581ee5b195
4
- data.tar.gz: 9712f49ccfe02de19e49685ae4c707bb5849bfdd
3
+ metadata.gz: afe2f42c9590339bfbaaec0eacf6589142d06328
4
+ data.tar.gz: e997f01b1ae47182531cf8358dfc7f391bdb1ab4
5
5
  SHA512:
6
- metadata.gz: c12dfeb1142dcb8254cfd0debf50ba93205d7fa61188d0d6933c56a07db85382a594e60acb3662fd0bf72f70e263f211fc681f4aad8aa86675445fd19ad45815
7
- data.tar.gz: 2c3666afb225703332ea8fc6622638f5255db3bd13b957876301753407c85c0539f8e28b720a65c1bc254714032f48e8bacf8ec3c26ce180bae4de2f6d582df0
6
+ metadata.gz: c10a6b9ac56adc91300818bddcc0a3af01a75b0230406b7649ff0ce7b189298da4215753f86c9497eeecf6d04eb3c60965adfc5dac0ea2548b5b1a6bab755484
7
+ data.tar.gz: f47bd284b19253c6d6f3920b8c7fa607a9501843d09b02435635d5dd60a4e04f8de4e5715b6a5653741beca3cb7b3368341a580d5fe10d5e0fafdbfa469fed54
@@ -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 = File.join(New::TEMP_DIR, Time.now.to_i.to_s)
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
@@ -4,7 +4,6 @@ class New
4
4
  VERSION = '0.0.1'
5
5
  DEFAULT_DIR = File.expand_path('../..', __FILE__)
6
6
  CUSTOM_DIR = File.expand_path('~/.new')
7
- TEMP_DIR = File.expand_path('../../.tmp', __FILE__)
8
7
  TASKS_DIR_NAME = 'tasks'
9
8
  TEMPLATES_DIR_NAME = 'templates'
10
9
  CONFIG_FILE = '.new'
data/new_project/.new ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ ...
@@ -0,0 +1,3 @@
1
+ tasks:
2
+ foo_task:
3
+ custom_bar_task:
@@ -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(New::TEMP_DIR, 'custom_bar_template') }
6
- let(:project_dir){ File.join(New::TEMP_DIR, 'new_project') }
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.chdir New::TEMP_DIR
12
- FileUtils.cp_r root('spec', 'fixtures', 'custom', 'templates', 'custom_bar_template'), New::TEMP_DIR
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
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-15 00:00:00.000000000 Z
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