stitch-plus 1.0.5 → 1.0.6

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDExZGRmNzBmNTg5NjE5ZDJjNTQ4N2QxNTU4MzVjZGFlMmU2YTQzYg==
4
+ MTdiODc5ZWVmZDgxMDIzNTA0ZTJiMDNhM2YwZmNjNmEzNzYxNzUzZQ==
5
5
  data.tar.gz: !binary |-
6
- MmQzZjYwZTgzMzk5YzJmN2I0Y2I1NDc1ODk1M2ZkOWM1YjBiYzNhYg==
6
+ ZDg3OTU0ZTAyNmNlMTM2MDQzOTZiYzc2MDNmYjZiMjdhNTk5ZjBmNw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZGI3MjFlMjNkZTJkMTQ3YzU0NWY1MGZlNTM1NDM4YjVkOGI4ZjFhOTEzZTZj
10
- MGM5MjNhYjg2MTY5M2M2YjU2MDA3NmU3Zjc2YWI1NjhmODc4ZWEwNzA3M2Fk
11
- YmY5ZTIwOTMyYTYyN2YzN2FhYjA0ZTkyNTk5ZjBiNDRiNmI0MDg=
9
+ ZGJhNWIwNjJhOWZjM2RlYzNiNWY1NmE0NTIzMDQxMTk3NzY4NDkzOTgzZGY2
10
+ ZmIxNDQ1OThiY2Y0Y2Y3NmJjZTMwYmFkZDAwYmIyYzVkZTQ0YzFlMzc0Zjlh
11
+ MmJkNTIyMDI4MGE2M2JlYTJlZmU1N2M4MGNiYjRkMGMzY2U2Yzc=
12
12
  data.tar.gz: !binary |-
13
- YTAxODhlMDYzM2U1MmNlZWM3YmQ3OWFiOTQ0ZDMxODg4NmU2YzVjM2ZiOTY3
14
- Njk1YmUyYmRjNzlkZTIyNjhmZWQyYjljMWQ3YmJjNjA1NjdlMzdjZWEzOGY4
15
- YjJlZjBkOWU5NDI1YTA0MWI3MDU3YWU5NWI3YTRiNTcwZGIzZDg=
13
+ MWJhMGUyZjQwNTQ4ODVhY2E5YzE3NjJjZjNiZWEwYjk5OGYzYjEwMWVjNzg4
14
+ NDhlZWQ4YmYxOWE5MmI3MzEzNmZjYTEyNGQ0ZmYyZGZhYjBjZTRkYjE5ODY2
15
+ OGQwMTZmNTJiNDhiYjQ3NjYxOTI1YWZjN2FjZmYzYjFjNGQ5Yzc=
data/CHANGELOG.md CHANGED
@@ -21,3 +21,7 @@
21
21
 
22
22
  ## 1.0.5
23
23
  - [instance].last_write returns the path to the last written file.
24
+
25
+ ## 1.0.6
26
+ - [instance].deleted returns an array of deleted files if stitch cleaned up files when writing.
27
+ - performance improvements for cleanup method.
data/lib/stitch-plus.rb CHANGED
@@ -4,7 +4,7 @@ require 'colorator'
4
4
  require 'yaml'
5
5
 
6
6
  class StitchPlus
7
- attr_accessor :options
7
+ attr_accessor :options, :deleted
8
8
 
9
9
  def initialize(options={})
10
10
 
@@ -18,6 +18,7 @@ class StitchPlus
18
18
  :uglify_options => {},
19
19
  :config => nil
20
20
  }
21
+ @deleted = []
21
22
 
22
23
  set_options(options)
23
24
 
@@ -154,11 +155,11 @@ class StitchPlus
154
155
 
155
156
  # Remove existing generated files with the same options[:output] name
156
157
  def cleanup(file)
157
- match = File.basename(@options[:output]).split(/(\..+)$/).map { |i| i.gsub(/\./, '\.')}
158
- Dir.glob(File.join(File.dirname(@options[:output]), '**/*')).each do |item|
159
- if File.basename(item) != File.basename(file) and File.basename(item).match /^#{match[0]}(-.+)?#{match[1]}/i
158
+ Dir.glob(@options[:output].sub(/\./, '*')).each do |item|
159
+ if File.basename(item) != File.basename(file)
160
160
  info "Stitch " + "deleted ".red + item
161
161
  FileUtils.rm(item)
162
+ @deleted << item
162
163
  end
163
164
  end
164
165
  end
@@ -1,3 +1,3 @@
1
1
  module StitchPlusVersion
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.6"
3
3
  end
data/test/test.rb CHANGED
@@ -7,4 +7,5 @@ puts "Javascripts to be compiled:"
7
7
  puts s.all_files.map { |f| " #{f}"}
8
8
 
9
9
  s.write
10
+ p s.deleted
10
11
  p s.last_write
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stitch-plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-18 00:00:00.000000000 Z
11
+ date: 2013-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stitch-rb