thematic 0.0.2 → 0.0.3

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: 29b8eb8b1d905e4527b06169af17677fd8498dae
4
- data.tar.gz: 6baeafe7b034cb407a9665115aef3ec40d460259
3
+ metadata.gz: 2264f912cd0cf3e9618155d5056e5ceca3c8b1d5
4
+ data.tar.gz: 1d79ee628889032db2a8d77d6fed0e4f3c97ffa4
5
5
  SHA512:
6
- metadata.gz: e832771b9513cab3930193e97980a6665c6c596dfaa722d8458525d878a7327da70a110120deddfd88da4a42669f8f0e13ffca4c9275064b92ee6936c7ce5747
7
- data.tar.gz: 636ab87545ef540769fb62cc04e8aa7cd8a2839e0530c422b105bc106e675ce8ee4a4c49d8c71402326134777696f7274bffdc0f9eb50ca57691fca5b3b3079d
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
- FileUtils.mkdir 'vendor/assets/stylesheets/theme'
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
- copy("#{copy_from_path}/#{filename}", "vendor/assets/stylesheets/theme/") unless File.directory?("#{copy_from_path}/#{filename}")
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.mkdir 'vendor/assets/javascripts/theme'
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
- copy("#{copy_from_path}/#{filename}", "vendor/assets/javascripts/theme/") unless File.directory?("#{copy_from_path}/#{filename}")
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
@@ -1,3 +1,3 @@
1
1
  module Thematic
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-27 00:00:00.000000000 Z
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler