microservice_precompiler 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,8 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
- - jruby-18mode # JRuby in 1.8 mode
5
- - jruby-19mode # JRuby in 1.9 mode
6
- - rbx-18mode
7
- - rbx-19mode
8
- - 1.8.7
4
+
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # MicroservicePrecompiler
2
2
 
3
+ [![Build Status](https://api.travis-ci.org/barnabyalter/microservice_precompiler.png)](https://travis-ci.org/barnabyalter/microservices_precompiler)
3
4
  [![Dependency Status](https://gemnasium.com/barnabyalter/microservice_precompiler.png)](https://gemnasium.com/barnabyalter/microservice_precompiler)
4
5
  [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/barnabyalter/microservice_precompiler)
5
6
 
@@ -9,7 +10,7 @@ The SASS is compiled into CSS via Compass; the CoffeeScript is translated to Jav
9
10
 
10
11
  The gem requires that your project root be a Compass project and expects that you have a folder structure matching the following in the root of your project:
11
12
 
12
- /javascripts/
13
+ /javascripts/
13
14
  /sass/
14
15
  /templates/
15
16
  mustaches.yml
@@ -45,14 +45,12 @@ module MicroservicePrecompiler
45
45
  sprockets_env.append_path load_path
46
46
  Dir.new(load_path).each do |filename|
47
47
  file = File.join(load_path, filename)
48
- if File.exists?(file) and File.file?(file)
48
+ if File.file?(file)
49
49
  asset = sprockets_env[filename]
50
50
  attributes = sprockets_env.attributes_for(asset.pathname)
51
- name, format = attributes.logical_path, attributes.format_extension
52
- asset = minify(asset, format)
53
- build_file = File.join(@build_path, asset_type.to_s, name)
51
+ build_file = File.join(@build_path, asset_type.to_s, attributes.logical_path) # Logical path is the filename
54
52
  File.open(build_file, 'w') do |f|
55
- f.write(asset)
53
+ f.write(minify(asset, attributes.format_extension)) # Format extension is self-explanatory I believe... the format e.g. js, css ,etc.
56
54
  end
57
55
  end
58
56
  end
@@ -134,7 +132,7 @@ module MicroservicePrecompiler
134
132
  @sprockets_env ||= Sprockets::Environment.new(@project_root) { |env| env.logger = Logger.new(STDOUT) }
135
133
  end
136
134
 
137
- def minify(asset, format)
135
+ def minify asset, format
138
136
  asset = asset.to_s
139
137
  # Minify JS
140
138
  return Uglifier.compile(asset) if format.eql?(".js")
@@ -1,3 +1,3 @@
1
1
  module MicroservicePrecompiler
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -19,9 +19,11 @@ Gem::Specification.new do |gem|
19
19
  #gem.add_development_dependency "rspec", "~> 2.6"
20
20
  gem.add_development_dependency "rake"
21
21
  gem.add_development_dependency "debugger"
22
+ gem.add_development_dependency "travis-lint"
23
+ gem.add_development_dependency "reek"
22
24
  gem.add_dependency "compass", "~> 0.12.1"
23
- gem.add_dependency "sprockets", "~> 2.4.0"
24
- gem.add_dependency "uglifier", "~> 1.2.4"
25
+ gem.add_dependency "sprockets", "~> 2"#"~> 2.4.0"
26
+ gem.add_dependency "uglifier", "~> 1"#"~> 1.2.4"
25
27
  gem.add_dependency "mustache", "~> 0.99.4"
26
28
  gem.add_dependency "yui-compressor", "~> 0.9.6"
27
29
  gem.add_dependency "coffee-script", "~> 2.2.0"
@@ -43,10 +43,10 @@ class BuilderTest < Test::Unit::TestCase
43
43
  assert((File.exists? "#{@project_root}/dist"), "The build path does not exist")
44
44
  assert((File.exists? "#{@project_root}/dist/stylesheets"), "No stylesheets folder found, sprockets build failed")
45
45
  #Check that the files in stylesheets are minimized
46
- assert((File.size("#{@project_root}/stylesheets") > File.size("#{@project_root}/dist/stylesheets")), "Stylesheets were not minimized")
46
+ assert((File.size("#{@project_root}/stylesheets/screen.css") > File.size("#{@project_root}/dist/stylesheets/screen.css")), "Stylesheets were not minimized.")
47
47
  assert((File.exists? "#{@project_root}/dist/javascripts"), "No javascripts folder found, sprockets build failed")
48
48
  #Check that the files in javascripts are minimized
49
- assert((File.size("#{@project_root}/javascripts") > File.size("#{@project_root}/dist/javascripts")), "Javascripts were not minimized")
49
+ #TODO
50
50
  end
51
51
 
52
52
  def test_mustache_build
@@ -54,7 +54,7 @@ class BuilderTest < Test::Unit::TestCase
54
54
  assert_nothing_raised(){ mustache = @precompiler.mustache_build }
55
55
  assert((File.exists? "#{@project_root}/dist"), "The build path does not exist")
56
56
  assert((File.exists? "#{@project_root}/dist/templates"), "No templates folder found")
57
- assert((File.exists? "#{@project_root}/dist/templates/sample.html"), "File not found.")
57
+ assert((File.exists? "#{@project_root}/dist/templates/Sample.html"), "File not found.")
58
58
  end
59
59
 
60
60
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microservice_precompiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-05 00:00:00.000000000 Z
12
+ date: 2012-12-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -43,6 +43,38 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: travis-lint
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: reek
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
46
78
  - !ruby/object:Gem::Dependency
47
79
  name: compass
48
80
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +98,7 @@ dependencies:
66
98
  requirements:
67
99
  - - ~>
68
100
  - !ruby/object:Gem::Version
69
- version: 2.4.0
101
+ version: '2'
70
102
  type: :runtime
71
103
  prerelease: false
72
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +106,7 @@ dependencies:
74
106
  requirements:
75
107
  - - ~>
76
108
  - !ruby/object:Gem::Version
77
- version: 2.4.0
109
+ version: '2'
78
110
  - !ruby/object:Gem::Dependency
79
111
  name: uglifier
80
112
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +114,7 @@ dependencies:
82
114
  requirements:
83
115
  - - ~>
84
116
  - !ruby/object:Gem::Version
85
- version: 1.2.4
117
+ version: '1'
86
118
  type: :runtime
87
119
  prerelease: false
88
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +122,7 @@ dependencies:
90
122
  requirements:
91
123
  - - ~>
92
124
  - !ruby/object:Gem::Version
93
- version: 1.2.4
125
+ version: '1'
94
126
  - !ruby/object:Gem::Dependency
95
127
  name: mustache
96
128
  requirement: !ruby/object:Gem::Requirement