jbundle 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -185,7 +185,7 @@ Learn more about the JBundle command-line with
185
185
 
186
186
  The command line has a quick generator that creates stub files for your library code, an example file and tests using Qunit.
187
187
 
188
- jsbundle init my_library.js
188
+ jbundle init my_library.js
189
189
 
190
190
  create JFile
191
191
  create src
@@ -69,6 +69,8 @@ Then package your work
69
69
  method_option :tests, :default => 'qunit', :aliases => '-t'
70
70
  def init(name)
71
71
  @name = name
72
+ @klass_name = name.sub('.js', '').split(/[^a-z0-9]/i).map{|w| w.capitalize}.join
73
+
72
74
  template('templates/jfile.tt', "JFile")
73
75
  empty_directory 'src'
74
76
  template('templates/license.tt', "src/license.txt")
@@ -1,14 +1,14 @@
1
- var <%= @name.sub('.js', '').capitalize %> = (function () {
1
+ var <%= @klass_name %> = (function () {
2
2
 
3
- function klass (name) {
3
+ function <%= @klass_name %> (name) {
4
4
  this.name = name;
5
5
  }
6
6
 
7
- klass.prototype = {
7
+ <%= @klass_name %>.prototype = {
8
8
  title: function () {
9
9
  return 'Mr. ' + this.name;
10
10
  }
11
11
  }
12
12
 
13
- return klass;
13
+ return <%= @klass_name %>;
14
14
  })();
@@ -1,6 +1,6 @@
1
1
  module('General');
2
2
 
3
3
  test('it should pass test', function () {
4
- var obj = new <%= @name.sub('.js', '').capitalize %>('John Doe');
4
+ var obj = new <%= @klass_name %>('John Doe');
5
5
  equal('Mr. John Doe', obj.title())
6
6
  });
@@ -1,3 +1,3 @@
1
1
  module JBundle
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jbundle
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.11
5
+ version: 0.0.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ismael Celis