jplugin 0.0.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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jplugin.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Yves Van Broekhoven
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Jplugin
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'jplugin'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install jplugin
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'jplugin'
3
+
4
+ Jplugin::Cli.start
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/jplugin/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Yves Van Broekhoven"]
6
+ gem.email = ["yvesvanbroekhoven@gmail.com"]
7
+ gem.description = %q{Scaffold jQuery plugin folder structure & helpers}
8
+ gem.summary = %q{Scaffold jQuery plugin folder structure & helpers}
9
+ gem.homepage = ""
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "jplugin"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Jplugin::VERSION
17
+
18
+ gem.add_runtime_dependency "thor"
19
+ end
@@ -0,0 +1,7 @@
1
+ module Jplugin
2
+ require "jplugin/version"
3
+ require "thor/base"
4
+ require "thor/group"
5
+ require "jplugin/jplugin_cli"
6
+ require "date"
7
+ end
@@ -0,0 +1,45 @@
1
+ class Jplugin::Cli < Thor::Group
2
+ include Thor::Actions
3
+
4
+ argument :name
5
+ argument :author
6
+
7
+ def self.source_root
8
+ File.dirname(__FILE__)
9
+ end
10
+
11
+ def create_gitignore_file
12
+ template( 'templates/gitignore.tt', "#{name}/.gitignore" )
13
+ end
14
+
15
+ def create_mit_license_file
16
+ template( 'templates/mit-license.tt', "#{name}/MIT-LICENSE.txt" )
17
+ end
18
+
19
+ def create_readme_file
20
+ template( 'templates/readme.tt', "#{name}/README.md" )
21
+ end
22
+
23
+ def create_plugin_file
24
+ template( 'templates/jquery-name.tt', "#{name}/#{name}.js" )
25
+ end
26
+
27
+ def create_thorfile
28
+ template( 'templates/thorfile.tt', "#{name}/Thorfile" )
29
+ end
30
+
31
+ def create_public_folder
32
+ empty_directory( "#{name}/public" )
33
+ end
34
+
35
+ def create_index_html_file
36
+ template( 'templates/index-html.tt', "#{name}/public/index.html" )
37
+ end
38
+
39
+ def init_git
40
+ run( "(cd #{name}; git init)")
41
+ run( "(cd #{name}; git add .)")
42
+ run( "(cd #{name}; git commit -m 'Initial commit')")
43
+ end
44
+
45
+ end
@@ -0,0 +1 @@
1
+ .DS_Store
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="description" content="">
6
+
7
+ <title><%= name %> demo</title>
8
+
9
+ <script src="http://www.google.com/jsapi?key="></script>
10
+ <script type="text/javascript">
11
+ google.load("jquery", "1");
12
+ </script>
13
+ <script src="<%= name %>-min.js"></script>
14
+ </head>
15
+ <body>
16
+
17
+ </body>
18
+ </html>
@@ -0,0 +1,11 @@
1
+ /*
2
+ * <%= name %>
3
+ *
4
+ * Created at: <%= Time.now %>
5
+ * Author: <%= author %>
6
+ * Version: 0.0.0
7
+ */
8
+
9
+ (function() {
10
+
11
+ }(jQuery));
@@ -0,0 +1,20 @@
1
+ Copyright (c) <%= Date.today.year %> <%= author %> and other contributors.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ # <%= name %>
2
+
3
+ TODO: write documentation
@@ -0,0 +1,89 @@
1
+ class Jplugin < Thor
2
+ include Thor::Actions
3
+
4
+ desc "compile", "Compiles js file to public/"
5
+ def compile
6
+ relative = '<%= name %>.js'
7
+ run( "closure --js #{relative} --js_output_file ./public/#{relative.gsub(".js",".min.js")}" )
8
+ end
9
+
10
+ class Release < self
11
+
12
+ desc "patch", "Release patch version"
13
+ def patch
14
+ git_status = run( '[[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && echo "dirty"', :capture => true )
15
+
16
+ unless git_status =~ /^dirty/
17
+ label = nil
18
+ version = nil
19
+ parts = nil
20
+
21
+ gsub_file( '<%= name %>.js', /Version[:].+$/) do |match|
22
+ label, version = *match.split(':', 2)
23
+ parts = version.strip.split('.')
24
+ parts[2] = parts[2].to_i + 1
25
+ "#{label}: #{parts.join('.')}"
26
+ end
27
+
28
+ run( "git add .; git commit -m '#{label}: #{parts.join('.')}';" )
29
+ run( "git tag -a v#{parts.join('.')} -m '#{label}: #{parts.join('.')}'")
30
+
31
+ else
32
+ say( 'Your git branch is not clean', :red )
33
+
34
+ end
35
+ end
36
+
37
+ desc "minor", "Release minor version"
38
+ def minor
39
+ git_status = run( '[[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && echo "dirty"', :capture => true )
40
+
41
+ unless git_status =~ /^dirty/
42
+ label = nil
43
+ version = nil
44
+ parts = nil
45
+
46
+ gsub_file( '<%= name %>.js', /Version[:].+$/) do |match|
47
+ label, version = *match.split(':', 2)
48
+ parts = version.strip.split('.')
49
+ parts[1] = parts[1].to_i + 1
50
+ "#{label}: #{parts.join('.')}"
51
+ end
52
+
53
+ run( "git add .; git commit -m '#{label}: #{parts.join('.')}';" )
54
+ run( "git tag -a v#{parts.join('.')} -m '#{label}: #{parts.join('.')}'")
55
+
56
+ else
57
+ say( 'Your git branch is not clean', :red )
58
+
59
+ end
60
+ end
61
+
62
+ desc "patch", "Release major version"
63
+ def major
64
+ git_status = run( '[[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && echo "dirty"', :capture => true )
65
+
66
+ unless git_status =~ /^dirty/
67
+ label = nil
68
+ version = nil
69
+ parts = nil
70
+
71
+ gsub_file( '<%= name %>.js', /Version[:].+$/) do |match|
72
+ label, version = *match.split(':', 2)
73
+ parts = version.strip.split('.')
74
+ parts[0] = parts[0].to_i + 1
75
+ "#{label}: #{parts.join('.')}"
76
+ end
77
+
78
+ run( "git add .; git commit -m '#{label}: #{parts.join('.')}';" )
79
+ run( "git tag -a v#{parts.join('.')} -m '#{label}: #{parts.join('.')}'")
80
+
81
+ else
82
+ git_status = run( '[[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && echo "dirty"', :capture => true )
83
+
84
+ end
85
+ end
86
+
87
+ end
88
+
89
+ end
@@ -0,0 +1,3 @@
1
+ module Jplugin
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jplugin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Yves Van Broekhoven
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: Scaffold jQuery plugin folder structure & helpers
31
+ email:
32
+ - yvesvanbroekhoven@gmail.com
33
+ executables:
34
+ - jplugin
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - .gitignore
39
+ - Gemfile
40
+ - LICENSE
41
+ - README.md
42
+ - Rakefile
43
+ - bin/jplugin
44
+ - jplugin.gemspec
45
+ - lib/jplugin.rb
46
+ - lib/jplugin/jplugin_cli.rb
47
+ - lib/jplugin/templates/gitignore.tt
48
+ - lib/jplugin/templates/index-html.tt
49
+ - lib/jplugin/templates/jquery-name.tt
50
+ - lib/jplugin/templates/mit-license.tt
51
+ - lib/jplugin/templates/readme.tt
52
+ - lib/jplugin/templates/thorfile.tt
53
+ - lib/jplugin/version.rb
54
+ homepage: ''
55
+ licenses: []
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 1.8.24
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: Scaffold jQuery plugin folder structure & helpers
78
+ test_files: []
79
+ has_rdoc: