thematic 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/thematic/tasks/thematic.rake +49 -4
- data/lib/thematic/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2264f912cd0cf3e9618155d5056e5ceca3c8b1d5
|
4
|
+
data.tar.gz: 1d79ee628889032db2a8d77d6fed0e4f3c97ffa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af71e9d4764a902c71814d0020f4b05786b37b175b5ff0434c80a6436117ec321a834db9f4444e4e3d7e59ee6df2be64f8a4ced90f5071ef6199412d25091b27
|
7
|
+
data.tar.gz: a1f79fb558a6c631eee2902144787366dbbb7d0745db1d8b2f4f1f0b3aa8edd8e5e93ef00e1e98a1353a65da90bd425c29893c2be1f3610dfeeb08e5b94cd655
|
@@ -3,25 +3,70 @@ require 'fileutils'
|
|
3
3
|
namespace :thematic do
|
4
4
|
desc "descriptions of the task"
|
5
5
|
task :install, [:filepath] do |task, args|
|
6
|
+
# args[:filepath] represent the path of the theme
|
7
|
+
|
6
8
|
puts "Inspecting theme..."
|
7
9
|
|
8
10
|
puts "Installing CSS..."
|
11
|
+
|
12
|
+
# it is assumed that the theme comes with a folder called 'css'
|
9
13
|
copy_from_path = "#{args[:filepath]}/css"
|
14
|
+
theme_subfolder = "theme"
|
15
|
+
|
16
|
+
FileUtils.remove_dir "vendor/assets/stylesheets/#{theme_subfolder}"
|
17
|
+
FileUtils.mkdir "vendor/assets/stylesheets/#{theme_subfolder}"
|
10
18
|
|
11
|
-
|
19
|
+
file_to_edit = "app/assets/stylesheets/application.css"
|
20
|
+
f = File.new(file_to_edit)
|
21
|
+
|
22
|
+
tempfile = File.open("file.tmp", 'w')
|
23
|
+
f.each do |line|
|
24
|
+
break if line =~/^*= require_tree ./
|
25
|
+
tempfile << line
|
26
|
+
end
|
12
27
|
|
13
28
|
Dir.open(copy_from_path).each do |filename|
|
14
|
-
|
29
|
+
unless File.directory?("#{copy_from_path}/#{filename}") || filename[0] == "."
|
30
|
+
copy("#{copy_from_path}/#{filename}", "vendor/assets/stylesheets/#{theme_subfolder}/")
|
31
|
+
tempfile << " *= require #{filename.gsub('.css', '')}\n"
|
32
|
+
end
|
15
33
|
end
|
16
34
|
|
35
|
+
tempfile << " *= require_tree .\n"
|
36
|
+
tempfile << " *= require_self\n"
|
37
|
+
tempfile << " */\n"
|
38
|
+
FileUtils.mv("file.tmp", file_to_edit)
|
39
|
+
f.close
|
40
|
+
tempfile.close
|
41
|
+
|
17
42
|
puts "Installing JS..."
|
43
|
+
|
44
|
+
# it is assumed that the theme comes with a folder called 'js'
|
18
45
|
copy_from_path = "#{args[:filepath]}/js"
|
19
46
|
|
20
|
-
FileUtils.
|
47
|
+
FileUtils.remove_dir "vendor/assets/javascripts/#{theme_subfolder}"
|
48
|
+
FileUtils.mkdir "vendor/assets/javascripts/#{theme_subfolder}"
|
49
|
+
|
50
|
+
file_to_edit = "app/assets/javascripts/application.js"
|
51
|
+
f = File.new(file_to_edit)
|
52
|
+
|
53
|
+
tempfile = File.open("file.tmp", 'w')
|
54
|
+
f.each do |line|
|
55
|
+
break if line =~/^\/\/= require_tree ./
|
56
|
+
tempfile << line
|
57
|
+
end
|
21
58
|
|
22
59
|
Dir.open(copy_from_path).each do |filename|
|
23
|
-
|
60
|
+
unless File.directory?("#{copy_from_path}/#{filename}") || filename[0] == "."
|
61
|
+
copy("#{copy_from_path}/#{filename}", "vendor/assets/javascripts/#{theme_subfolder}/") unless File.directory?("#{copy_from_path}/#{filename}")
|
62
|
+
tempfile << "//= require #{filename.gsub('.js', '')}\n"
|
63
|
+
end
|
24
64
|
end
|
25
65
|
|
66
|
+
tempfile << "//= require_tree .\n"
|
67
|
+
FileUtils.mv("file.tmp", file_to_edit)
|
68
|
+
f.close
|
69
|
+
tempfile.close
|
70
|
+
|
26
71
|
end
|
27
72
|
end
|
data/lib/thematic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thematic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Wengrow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|