jplugin 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,37 +9,41 @@ class Jplugin::Cli < Thor::Group
9
9
  end
10
10
 
11
11
  def create_gitignore_file
12
- template( 'templates/gitignore.tt', "#{name}/.gitignore" )
12
+ template( 'templates/gitignore.tt', "jquery-#{name}/.gitignore" )
13
13
  end
14
14
 
15
15
  def create_mit_license_file
16
- template( 'templates/mit-license.tt', "#{name}/MIT-LICENSE.txt" )
16
+ template( 'templates/mit-license.tt', "jquery-#{name}/MIT-LICENSE.txt" )
17
17
  end
18
18
 
19
19
  def create_readme_file
20
- template( 'templates/readme.tt', "#{name}/README.md" )
20
+ template( 'templates/readme.tt', "jquery-#{name}/README.md" )
21
21
  end
22
22
 
23
23
  def create_plugin_file
24
- template( 'templates/jquery-name.tt', "#{name}/#{name}.js" )
24
+ template( 'templates/jquery-name.tt', "jquery-#{name}/jquery-#{name}.js" )
25
25
  end
26
26
 
27
27
  def create_thorfile
28
- template( 'templates/thorfile.tt', "#{name}/Thorfile" )
28
+ template( 'templates/thorfile.tt', "jquery-#{name}/Thorfile" )
29
+ end
30
+
31
+ def create_jquery_plugin_manifest_file
32
+ template( 'templates/jquery-plugin-manifest.tt', "jquery-#{name}/#{name}.jquery.json" )
29
33
  end
30
34
 
31
35
  def create_public_folder
32
- empty_directory( "#{name}/public" )
36
+ empty_directory( "jquery-#{name}/public" )
33
37
  end
34
38
 
35
39
  def create_index_html_file
36
- template( 'templates/index-html.tt', "#{name}/public/index.html" )
40
+ template( 'templates/index-html.tt', "jquery-#{name}/public/index.html" )
37
41
  end
38
42
 
39
43
  def init_git
40
- run( "(cd #{name}; git init)")
41
- run( "(cd #{name}; git add .)")
42
- run( "(cd #{name}; git commit -m 'Initial commit')")
44
+ run( "(cd jquery-#{name}; git init)")
45
+ run( "(cd jquery-#{name}; git add .)")
46
+ run( "(cd jquery-#{name}; git commit -m 'Initial commit')")
43
47
  end
44
48
 
45
- end
49
+ end
@@ -1,5 +1,7 @@
1
+ /*global jQuery:false*/
2
+
1
3
  /** @preserve
2
- * <%= name %>
4
+ * jquery-<%= name %>
3
5
  *
4
6
  * Created at: <%= Time.now %>
5
7
  * Updated at: <%= Time.now %>
@@ -9,8 +11,6 @@
9
11
  *
10
12
  */
11
13
 
12
- /*global jQuery:false*/
13
-
14
14
  (function($) {
15
15
  "use strict";
16
16
  }(jQuery));
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "<%= name %>",
3
+ "title": "jQuery <%= name %>",
4
+ "description": "",
5
+ "keywords": [],
6
+ "version": "0.0.0",
7
+ "author": {
8
+ "name": "<%= author %>",
9
+ "url": ""
10
+ },
11
+ "maintainers": [
12
+ {
13
+ "name": "<%= author",
14
+ "email": "",
15
+ "url": ""
16
+ }
17
+ ],
18
+ "licenses": [
19
+ {
20
+ "type": "MIT",
21
+ "url": ""
22
+ }
23
+ ],
24
+ "bugs": "",
25
+ "homepage": "",
26
+ "docs": "",
27
+ "download": "",
28
+ "dependencies": {
29
+ "jquery": ">=1.5"
30
+ }
31
+ }
@@ -3,7 +3,7 @@ class Jplugin < Thor
3
3
 
4
4
  desc "compile", "Compiles js file to public/"
5
5
  def compile
6
- relative = '<%= name %>.js'
6
+ relative = 'jquery-<%= name %>.js'
7
7
  text = File.read(relative)
8
8
  text.gsub!(/Updated at: (.*)/) { |m| m.gsub($1, "#{Time.now}") }
9
9
  File.open( relative, "w") { |file| file.puts text }
@@ -21,13 +21,21 @@ class Jplugin < Thor
21
21
  version = nil
22
22
  parts = nil
23
23
 
24
- gsub_file( '<%= name %>.js', /Version[:].+$/) do |match|
24
+ gsub_file( '<%= name %>.jquery.json', /"version"[:].+$/) do |match|
25
+ label, version = *match.split(':', 2)
26
+ parts = version.strip.split('.')
27
+ parts[2] = parts[2].to_i + 1
28
+ "#{label}: #{parts.join('.')}\","
29
+ end
30
+
31
+ gsub_file( 'jquery-<%= name %>.js', /Version[:].+$/) do |match|
25
32
  label, version = *match.split(':', 2)
26
33
  parts = version.strip.split('.')
27
34
  parts[2] = parts[2].to_i + 1
28
35
  "#{label}: #{parts.join('.')}"
29
36
  end
30
37
 
38
+ run( "thor jplugin:compile")
31
39
  run( "git add .; git commit -m '#{label}: #{parts.join('.')}';" )
32
40
  run( "git tag -a v#{parts.join('.')} -m '#{label}: #{parts.join('.')}'")
33
41
 
@@ -46,7 +54,15 @@ class Jplugin < Thor
46
54
  version = nil
47
55
  parts = nil
48
56
 
49
- gsub_file( '<%= name %>.js', /Version[:].+$/) do |match|
57
+ gsub_file( '<%= name %>.jquery.json', /"version"[:].+$/) do |match|
58
+ label, version = *match.split(':', 2)
59
+ parts = version.strip.split('.')
60
+ parts[1] = parts[1].to_i + 1
61
+ parts[2] = 0
62
+ "#{label}: #{parts.join('.')}\","
63
+ end
64
+
65
+ gsub_file( 'jquery-<%= name %>.js', /Version[:].+$/) do |match|
50
66
  label, version = *match.split(':', 2)
51
67
  parts = version.strip.split('.')
52
68
  parts[1] = parts[1].to_i + 1
@@ -54,6 +70,7 @@ class Jplugin < Thor
54
70
  "#{label}: #{parts.join('.')}"
55
71
  end
56
72
 
73
+ run( "thor jplugin:compile")
57
74
  run( "git add .; git commit -m '#{label}: #{parts.join('.')}';" )
58
75
  run( "git tag -a v#{parts.join('.')} -m '#{label}: #{parts.join('.')}'")
59
76
 
@@ -72,7 +89,16 @@ class Jplugin < Thor
72
89
  version = nil
73
90
  parts = nil
74
91
 
75
- gsub_file( '<%= name %>.js', /Version[:].+$/) do |match|
92
+ gsub_file( '<%= name %>.jquery.json', /"version"[:].+$/) do |match|
93
+ label, version = *match.split(':', 2)
94
+ parts = version.strip.split('.')
95
+ parts[0] = parts[0].gsub(/\"/,'').to_i + 1
96
+ parts[1] = 0
97
+ parts[2] = 0
98
+ "#{label}: \"#{parts.join('.')}\","
99
+ end
100
+
101
+ gsub_file( 'jquery-<%= name %>.js', /Version[:].+$/) do |match|
76
102
  label, version = *match.split(':', 2)
77
103
  parts = version.strip.split('.')
78
104
  parts[0] = parts[0].to_i + 1
@@ -81,6 +107,7 @@ class Jplugin < Thor
81
107
  "#{label}: #{parts.join('.')}"
82
108
  end
83
109
 
110
+ run( "thor jplugin:compile")
84
111
  run( "git add .; git commit -m '#{label}: #{parts.join('.')}';" )
85
112
  run( "git tag -a v#{parts.join('.')} -m '#{label}: #{parts.join('.')}'")
86
113
 
@@ -1,3 +1,3 @@
1
1
  module Jplugin
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jplugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
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-10-23 00:00:00.000000000 Z
12
+ date: 2013-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -47,6 +47,7 @@ files:
47
47
  - lib/jplugin/templates/gitignore.tt
48
48
  - lib/jplugin/templates/index-html.tt
49
49
  - lib/jplugin/templates/jquery-name.tt
50
+ - lib/jplugin/templates/jquery-plugin-manifest.tt
50
51
  - lib/jplugin/templates/mit-license.tt
51
52
  - lib/jplugin/templates/readme.tt
52
53
  - lib/jplugin/templates/thorfile.tt