tcms 1.1.4.1 → 1.1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1a44f104369c5c113d48e0ff1c57efb29d66507
4
- data.tar.gz: 60c92d7d25fa15a83f79f3eea68fba9c752a4d34
3
+ metadata.gz: 00e667f22d09e4a114f813b4ae1bed03ba3f6cd1
4
+ data.tar.gz: d8ccdfc405cd98e46262a1f7e9881b68d902d496
5
5
  SHA512:
6
- metadata.gz: 6d60ded9275f6a4169ff9d9c09026b24de2b5b3313db9b85d0d03dbf0fac427fcd05f441516f4fc717788b71581a49cdc86b5474354d0dbde554ada1b6dc334a
7
- data.tar.gz: 7cb72c14d1abeaf3c7551d9784d320a7dcda294e381279c669dd6c95bf0ea8152617894f2429324c98198c8e659ddac32e541a3c7b21ffdb7b219e8b6cbfd3a4
6
+ metadata.gz: 85e3175c8b35b3104fb66eb7a2113d2d21dfeadc1cfed3c5ec9eaae8648e5f285a0bcb2f5ac709b0b3b90d90e6bd642bd9d591ae759966e9217ef0289583697e
7
+ data.tar.gz: a9f123bd02127d8e96760f581bc56f43d3de7a7c3a420af5718b4169f0bc46f598505fc075304293b28aa2ec9e401d45626f3246f5572ece12dbcbae6665aea4
@@ -1,5 +1,5 @@
1
1
  module Tcms
2
- module Helper
2
+ module Helper
3
3
  def script_for name
4
4
  if @_build_type == "dev"
5
5
  return self._script_for_local name
@@ -7,6 +7,55 @@ module Tcms
7
7
  return self._script_for_publish name
8
8
  end
9
9
  end
10
+ def link_for name
11
+ if @_build_type == "dev"
12
+ return self._css_for_local name;
13
+ else
14
+ return self._css_for_publish name;
15
+ end
16
+ end
17
+ def _css_for_local name
18
+ file_path = @_project["css"]["folder"]
19
+ link_output = '<link rel="stylesheet" href="/'+file_path+"/"+name+'.js"></href>'
20
+ return link_output
21
+ end
22
+
23
+ def _css_for_publish name
24
+ file_path = @_project["css"]["folder"]
25
+ file_content = File.read(file_path+"/#{name}.css",:encoding=>"utf-8")
26
+
27
+ publish_name = name+'.'+ @_project["version"].to_s
28
+ assets_path = @_project['assets']["folder"]
29
+
30
+ write_file = assets_path+'/'+publish_name+'.css';
31
+
32
+ if File.exist? write_file
33
+ File.delete write_file
34
+ end
35
+
36
+ concat_file = File.new(write_file,'w+')
37
+ concat_file.puts file_content
38
+ concat_file.close
39
+
40
+ puts write_file
41
+ puts '-生成素材'+publish_name+'.css'
42
+
43
+ assets = @_project["assets"]
44
+
45
+ if @_build_type == "test"
46
+ url = "/"+@_project["assets"]["folder"]
47
+ return '<link rel="stylesheet" href="'+url+"/"+publish_name+'.css?v='+Digest::MD5.hexdigest(file_content)+'"></link>'
48
+ else
49
+ site = assets["site"]
50
+ domain = 'qq.com'
51
+ remote_path = assets["remotepath"]
52
+ if site.match 'mat1' then domain = "gtimg.com/#{assets["channel"]}" end
53
+ if site.match 'pingjs' then site = 'rss' end
54
+ url = "http://#{site}.#{domain}/#{remote_path}"
55
+
56
+ return '<link rel="stylesheet" href="'+url+"/"+publish_name+'.css?v='+Digest::MD5.hexdigest(file_content)+'"></link>'
57
+ end
58
+ end
10
59
 
11
60
  def _script_for_local name
12
61
  file_path = @_project["scripts"]["folder"]
@@ -1,3 +1,3 @@
1
1
  module Tcms
2
- VERSION = "1.1.4.1"
2
+ VERSION = "1.1.4.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tcms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4.1
4
+ version: 1.1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "'bertwang'"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-28 00:00:00.000000000 Z
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra