microservice_precompiler 0.1.0 → 0.1.1

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.
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
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
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # MicroservicePrecompiler
2
2
 
3
+ [![Dependency Status](https://gemnasium.com/barnabyalter/microservice_precompiler.png)](https://gemnasium.com/barnabyalter/microservice_precompiler)
4
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/barnabyalter/microservice_precompiler)
5
+
3
6
  The microservice precompiler uses a handful of technologies to compile Javascripts and Stylesheets and create HTML pages from templates into a distribution folder ready for deployment. The microservices used are CoffeeScript, SASS and Mustache, compiling and minifying (where possible) into Javascript, CSS and HTML, respectively.
4
7
 
5
8
  The SASS is compiled into CSS via Compass; the CoffeeScript is translated to Javascript via Sprockets; both CSS and JS have their dependency trees included in-file by Sprockets; CSS and JS are then minified and compressed via YUICompressor and Uglifier, respectively.
@@ -105,22 +105,22 @@ module MicroservicePrecompiler
105
105
  output_file = logic_file #Output file should match the syntax of the mustaches config
106
106
  logic_file = camelcase_to_underscore(logic_file)
107
107
  # Require logic file, used to generate content from template
108
- require File.join(@project_root, dir, logic_file)
108
+ require File.join(@project_root, camelcase_to_underscore(dir), logic_file)
109
109
  # Create relevant directory path
110
110
  FileUtils.mkdir_p File.join(@build_path, dir.to_s)
111
111
  # Instantiate class from required file
112
112
  mustache = Kernel.const_get(logic_class_name).new
113
- # Set the template file
114
- mustache.template_file = File.join(@project_root, dir, template_file) + ".html.mustache"
113
+ # Set the template fil
114
+ mustache.template_file = File.join(@project_root, camelcase_to_underscore(dir), template_file) + ".html.mustache"
115
115
  # Get the name of the file we will write to after it's template is processed
116
116
  build_file = File.join(@build_path, dir, "#{output_file}.html")
117
117
  File.open(build_file, 'w') do |f|
118
118
  f.write(mustache.render)
119
- end
119
+ end
120
120
  end
121
121
 
122
122
  def camelcase_to_underscore camelcase_string
123
- camelcase_string.gsub(/(.)([A-Z])/,'\1_\2').downcase
123
+ return camelcase_string.gsub(/([A-Za-z0-9])([A-Z])/,'\1_\2').downcase
124
124
  end
125
125
 
126
126
  def underscore_to_camelcase underscore_string
@@ -1,3 +1,3 @@
1
1
  module MicroservicePrecompiler
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  #gem.add_development_dependency "rspec", "~> 2.6"
20
20
  gem.add_development_dependency "rake"
21
+ gem.add_development_dependency "debugger"
21
22
  gem.add_dependency "compass", "~> 0.12.1"
22
23
  gem.add_dependency "sprockets", "~> 2.4.0"
23
24
  gem.add_dependency "uglifier", "~> 1.2.4"
@@ -1,3 +1,5 @@
1
+ require 'rubygems'
2
+ require 'ruby-debug'
1
3
  require 'test_helper'
2
4
 
3
5
  class BuilderTest < Test::Unit::TestCase
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.0
4
+ version: 0.1.1
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-06-21 00:00:00.000000000 Z
12
+ date: 2012-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: debugger
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: compass
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -134,6 +150,7 @@ extensions: []
134
150
  extra_rdoc_files: []
135
151
  files:
136
152
  - .gitignore
153
+ - .travis.yml
137
154
  - Gemfile
138
155
  - LICENSE
139
156
  - README.md