charleston 0.1.1 → 0.1.2
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.
- data/VERSION +1 -1
- data/charleston.gemspec +2 -2
- data/lib/charleston/transform.rb +19 -6
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/charleston.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{charleston}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Bryce Kerley"]
|
data/lib/charleston/transform.rb
CHANGED
@@ -26,19 +26,15 @@ module Charleston
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def target_destinations
|
29
|
-
src_extension = find_extension_in_pattern(@source_pat)
|
30
|
-
dest_extension = find_extension_in_pattern(@dest_pat)
|
31
29
|
@destinations = @sources.map do |s|
|
32
|
-
File.expand_path(
|
33
|
-
s.sub(@source_dir, File.join('output', @dest_dir)).
|
34
|
-
sub(src_extension, dest_extension))
|
30
|
+
File.expand_path(turn_source_into_destination s)
|
35
31
|
end
|
36
32
|
end
|
37
33
|
|
38
34
|
def write_rules
|
39
35
|
@sources.zip(@destinations) do |p|
|
40
36
|
input, output = p
|
41
|
-
file output => [input, 'output',
|
37
|
+
file output => [input, 'output', output_directory] do
|
42
38
|
@transformation.call input, output
|
43
39
|
end
|
44
40
|
end
|
@@ -47,5 +43,22 @@ module Charleston
|
|
47
43
|
def find_extension_in_pattern(pattern)
|
48
44
|
pattern.sub(/\*\./, '')
|
49
45
|
end
|
46
|
+
|
47
|
+
def source_extension
|
48
|
+
find_extension_in_pattern @source_pat
|
49
|
+
end
|
50
|
+
|
51
|
+
def destination_extension
|
52
|
+
find_extension_in_pattern @dest_pat
|
53
|
+
end
|
54
|
+
|
55
|
+
def output_directory
|
56
|
+
File.join('output', @dest_dir)
|
57
|
+
end
|
58
|
+
|
59
|
+
def turn_source_into_destination(source_file)
|
60
|
+
source_file.sub(@source_dir, output_directory).
|
61
|
+
sub(source_extension, destination_extension)
|
62
|
+
end
|
50
63
|
end
|
51
64
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: charleston
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bryce Kerley
|