wp-fire 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wp_fire/compiler.rb +13 -11
- data/lib/wp_fire/main_command.rb +5 -3
- metadata +2 -1
data/lib/wp_fire/compiler.rb
CHANGED
@@ -4,7 +4,7 @@ require 'sass'
|
|
4
4
|
module WpFire
|
5
5
|
class Compiler
|
6
6
|
|
7
|
-
def self.compile(filename, build_path)
|
7
|
+
def self.compile(filename, build_path, root_path)
|
8
8
|
extname = File.extname(filename)
|
9
9
|
basename = File.basename(filename, extname)
|
10
10
|
if not basename[0].eql?"_" and extname.eql?".scss"
|
@@ -16,7 +16,7 @@ module WpFire
|
|
16
16
|
parents_filename = []
|
17
17
|
find_scss_parents(filename,parents_filename)
|
18
18
|
parents_filename.uniq.each do |parent|
|
19
|
-
compile parent, build_path
|
19
|
+
compile parent, build_path, root_path
|
20
20
|
end
|
21
21
|
elsif extname.eql?".css"
|
22
22
|
FileUtils.cp filename, File.join(build_path, File.basename(filename))
|
@@ -28,16 +28,18 @@ module WpFire
|
|
28
28
|
FileUtils.cp filename, File.join(build_path, File.basename(filename))
|
29
29
|
elsif extname.eql?".php"
|
30
30
|
FileUtils.cp filename, File.join(build_path, File.basename(filename))
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
FileUtils.
|
31
|
+
else
|
32
|
+
dir = File.dirname(filename)
|
33
|
+
dir = dir.sub(File.join(root_path,"source"),'')
|
34
|
+
#unwrap from assets path for backward compatibility
|
35
|
+
dir = dir.sub("assets",'')
|
36
|
+
FileUtils.mkdir_p File.join(build_path, dir) unless File.directory?(File.join(build_path, dir))
|
37
|
+
FileUtils.cp filename, File.join(build_path, dir, File.basename(filename))
|
37
38
|
end
|
39
|
+
|
38
40
|
end
|
39
41
|
|
40
|
-
def self.compile_all(filenames, build_path)
|
42
|
+
def self.compile_all(filenames, build_path, root_path)
|
41
43
|
files = []
|
42
44
|
filenames.each do |filename|
|
43
45
|
if(File.directory?(filename))
|
@@ -48,7 +50,7 @@ module WpFire
|
|
48
50
|
end
|
49
51
|
end
|
50
52
|
files.each do |f|
|
51
|
-
compile f, build_path
|
53
|
+
compile f, build_path, root_path
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
@@ -66,7 +68,7 @@ module WpFire
|
|
66
68
|
find_scss_parents(f,parents_array)
|
67
69
|
elsif not File.basename(f)[0].eql?"_"
|
68
70
|
parents_array << f
|
69
|
-
end
|
71
|
+
end
|
70
72
|
end
|
71
73
|
end
|
72
74
|
end
|
data/lib/wp_fire/main_command.rb
CHANGED
@@ -24,10 +24,11 @@ module WpFire
|
|
24
24
|
@functions_path = File.join(dir,"source","functions")
|
25
25
|
|
26
26
|
@build_path = File.join(dir,"build")
|
27
|
+
@root_path = dir
|
27
28
|
FileUtils.rm_rf(@build_path) if File.directory?(@build_path)
|
28
29
|
Dir.mkdir @build_path
|
29
30
|
watch_directories = [@assets_path,@templates_path,@functions_path]
|
30
|
-
WpFire::Compiler.compile_all watch_directories, @build_path
|
31
|
+
WpFire::Compiler.compile_all watch_directories, @build_path, @root_path
|
31
32
|
end
|
32
33
|
|
33
34
|
end
|
@@ -47,6 +48,7 @@ module WpFire
|
|
47
48
|
else
|
48
49
|
@build_path = dir
|
49
50
|
end
|
51
|
+
@root_path = dir
|
50
52
|
|
51
53
|
Dir[File.join(dir,"*")].each do |f|
|
52
54
|
unless File.directory?(f)
|
@@ -56,10 +58,10 @@ module WpFire
|
|
56
58
|
end
|
57
59
|
end
|
58
60
|
watch_directories = [@assets_path,@templates_path,@functions_path]
|
59
|
-
WpFire::Compiler.compile_all watch_directories, @build_path
|
61
|
+
WpFire::Compiler.compile_all watch_directories, @build_path, @root_path
|
60
62
|
|
61
63
|
FileWatcher.new(watch_directories,"Watching files:").watch do |filename|
|
62
|
-
WpFire::Compiler.compile filename, @build_path
|
64
|
+
WpFire::Compiler.compile filename, @build_path, @root_path
|
63
65
|
end
|
64
66
|
end
|
65
67
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wp-fire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -147,3 +147,4 @@ signing_key:
|
|
147
147
|
specification_version: 3
|
148
148
|
summary: Wordpress theme generator with Coffee Script and Sass support
|
149
149
|
test_files: []
|
150
|
+
has_rdoc: false
|