jqueryplugingen 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,5 @@
1
+ == 0.1.0 2009-05-30
2
+
3
+ * Generate base folder structure with main files:
4
+ * Initial release
5
+ * scaffold plugin with test
data/Manifest.txt ADDED
@@ -0,0 +1,33 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ bin/jqp
6
+ jQuery-Plugin-Generator.tmproj
7
+ lib/jqp/cli.rb
8
+ lib/jquery_plugin_gen.rb
9
+ lib/jquery_plugin_gen/generator.rb
10
+ lib/jquery_plugin_gen/quick_template.rb
11
+ lib/templates/History.txt.erb
12
+ lib/templates/Makefile.erb
13
+ lib/templates/README.txt.erb
14
+ lib/templates/Rakefile.erb
15
+ lib/templates/example.html.erb
16
+ lib/templates/src/plugin.js.erb
17
+ lib/templates/test/spec_plugin.js.erb
18
+ lib/templates/test/specs.html.erb
19
+ script/console
20
+ script/destroy
21
+ script/generate
22
+ spec/data/templates/History.txt
23
+ spec/data/templates/Manifest.txt
24
+ spec/data/templates/README.txt
25
+ spec/data/templates/Rakefile
26
+ spec/data/templates/src/email.js
27
+ spec/data/templates/test/spec_email.js
28
+ spec/data/templates/test/specs.html
29
+ spec/jqp_cli_spec.rb
30
+ spec/jquery_plugin_gen_spec.rb
31
+ spec/spec.opts
32
+ spec/spec_helper.rb
33
+ tasks/rspec.rake
data/README.rdoc ADDED
@@ -0,0 +1,75 @@
1
+ = jquery_plugin_gen
2
+
3
+ * http://github.com/toddb/jqueryplugingenerator
4
+
5
+ == DESCRIPTION:
6
+
7
+ Generate the structure of jquery plugins easily. Manage library dependencies such as other jquery libraries or packing code on either mac or windows. Get jsspec testing baked in. Use the familiar rake tasks to manage your jquery code base.
8
+
9
+
10
+ == FEATURES/PROBLEMS:
11
+
12
+ * I need to dependency manage javascript plugins (jquery, jquery-ui)
13
+ * Add option to install different versions of libraries
14
+ * be able to use the produced code on linux and windows (need jqp.bat)
15
+ * add acceptance test
16
+ * add hoe-type features for updating plugins to jquery plugin page (as rake tasks)
17
+ * be able to bundle library dependencies
18
+ * be able to switch between local and remote libraries
19
+ * be able to generate new modules and update html pages (as rake task or generator)
20
+
21
+ == SYNOPSIS:
22
+
23
+ jqp -p myplugin
24
+
25
+ This will generate:
26
+
27
+ /src
28
+ jquery.myplugin.js
29
+ /test
30
+ spec_myplugin.js
31
+ specs.html
32
+ example.html
33
+ /lib
34
+ Rakefile
35
+ Makefile
36
+
37
+ Once you have written your code:
38
+
39
+ (a) test with jsspec at test/specs.html
40
+ (b) package with make and see the results in /dist
41
+
42
+ == REQUIREMENTS:
43
+
44
+ * jquery
45
+ * jspec
46
+ * a packer (currently linux or cygwin)
47
+
48
+ == INSTALL:
49
+
50
+ * sudo gem install jquery_plugin_gen
51
+
52
+ == LICENSE:
53
+
54
+ (The MIT License)
55
+
56
+ Copyright (c) 2009 toddb
57
+
58
+ Permission is hereby granted, free of charge, to any person obtaining
59
+ a copy of this software and associated documentation files (the
60
+ 'Software'), to deal in the Software without restriction, including
61
+ without limitation the rights to use, copy, modify, merge, publish,
62
+ distribute, sublicense, and/or sell copies of the Software, and to
63
+ permit persons to whom the Software is furnished to do so, subject to
64
+ the following conditions:
65
+
66
+ The above copyright notice and this permission notice shall be
67
+ included in all copies or substantial portions of the Software.
68
+
69
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
70
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
71
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
72
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
73
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
74
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
75
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
2
+ %w[rake rake/clean fileutils newgem rubigen].each { |f| require f }
3
+ require File.dirname(__FILE__) + '/lib/jquery_plugin_gen'
4
+
5
+ # Generate all the Rake tasks
6
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
7
+ $hoe = Hoe.new('jqueryplugingen', JqueryPluginGen::VERSION) do |p|
8
+ p.developer('toddb', 'todd@8wireunlimited.com')
9
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
10
+ p.rubyforge_name = 'jqueryplugingen'
11
+ p.description = "Generate the structure of jquery plugins easily. Manage library dependencies such as other jquery libraries or packing code on either mac or windows. Get jsspec testing baked in. Use the familiar rake tasks to manage your jquery code base."
12
+ # p.extra_deps = [
13
+ # ['activesupport','>= 2.0.2'],
14
+ # ]
15
+ p.extra_dev_deps = [
16
+ ['newgem', ">= #{::Newgem::VERSION}"]
17
+ ]
18
+
19
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
20
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
21
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
22
+ p.rsync_args = '-av --delete --ignore-errors'
23
+ end
24
+
25
+ require 'newgem/tasks' # load /tasks/*.rake
26
+ Dir['tasks/**/*.rake'].each { |t| load t }
27
+
28
+ # TODO - want other tests/tasks run by default? Add them to the list
29
+ # task :default => [:spec, :features]
data/bin/jqp ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created by toddb on 2009-5-30.
4
+ # Copyright (c) 2009. All rights reserved.
5
+
6
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/jquery_plugin_gen")
7
+
8
+ require "jqp/cli"
9
+
10
+ Jqp::CLI.execute(STDOUT, ARGV)
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>documents</key>
6
+ <array>
7
+ <dict>
8
+ <key>expanded</key>
9
+ <true/>
10
+ <key>name</key>
11
+ <string>jQuery-Plugin-Generator</string>
12
+ <key>regexFolderFilter</key>
13
+ <string>!.*/(\.[^/]*|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
14
+ <key>sourceDirectory</key>
15
+ <string></string>
16
+ </dict>
17
+ </array>
18
+ <key>fileHierarchyDrawerWidth</key>
19
+ <integer>200</integer>
20
+ <key>metaData</key>
21
+ <dict/>
22
+ <key>showFileHierarchyDrawer</key>
23
+ <true/>
24
+ <key>windowFrame</key>
25
+ <string>{{203, 0}, {1149, 878}}</string>
26
+ </dict>
27
+ </plist>
data/lib/jqp/cli.rb ADDED
@@ -0,0 +1,57 @@
1
+ require 'optparse'
2
+
3
+ module Jqp
4
+ class CLI
5
+ def self.execute(stdout, arguments=[])
6
+
7
+ # NOTE: the option -p/--path= is given as an example, and should be replaced in your application.
8
+
9
+ options = {
10
+ :project => '~jq-plugin',
11
+ :version => '0.0.1'
12
+ }
13
+ mandatory_options = %w( )
14
+
15
+ parser = OptionParser.new do |opts|
16
+ opts.banner = <<-BANNER.gsub(/^ /,'')
17
+ jQuery plugin generator to help you kick start your plugin development with the following structure:
18
+
19
+ plugin
20
+ /src
21
+ /css
22
+ /images
23
+ query.plugin.js
24
+ /test
25
+ spec_plugin.js
26
+ /dist
27
+ Makefile
28
+ Rakefile
29
+ History.txt
30
+ README.txt
31
+
32
+ Usage: #{File.basename($0)} [options]
33
+
34
+ Options are:
35
+ BANNER
36
+ opts.separator ""
37
+ opts.on("-p", "--project=Name", String,
38
+ "The project name should be simple eg 'widget'",
39
+ "And it will be transformed to jquery.widget.js - there is currently no override feature on this naming convention",
40
+ "Default: ~jq-plugin") { |arg| options[:project] = arg }
41
+ opts.on("-v", "--version=x.x.x", String,
42
+ "Default: 0.0.1") { |arg| options[:version] = arg }
43
+ opts.on("-h", "--help",
44
+ "Show this help message.") { stdout.puts opts; exit }
45
+ opts.parse!(arguments)
46
+
47
+ if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
48
+ stdout.puts opts; exit
49
+ end
50
+ end
51
+
52
+ JqueryPluginGen::Generator.execute(options)
53
+
54
+ stdout.puts "To update this executable, look in lib/jqp/cli.rb"
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,65 @@
1
+ require 'fileutils'
2
+
3
+ module JqueryPluginGen
4
+ class Generator
5
+
6
+ X = 'FI' + 'X'
7
+
8
+ def self.base_dirs
9
+ %w(src lib test dist src/images src/css test/data)
10
+ end
11
+
12
+ def self.execute(args)
13
+
14
+ project = args[:project]
15
+
16
+ case project
17
+ when /_/ then
18
+ file_name = project
19
+ project = project.capitalize.gsub(/_([a-z])/) {$1.upcase}
20
+ klass = project
21
+ else
22
+ file_name = project.gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, '')
23
+ klass = project.capitalize.gsub(/_([a-z])/) {$1.upcase}
24
+ end
25
+
26
+ Dir.mkdir project
27
+ puts "creating folder: #{project}"
28
+
29
+ Dir.chdir project do
30
+
31
+ base_dirs.each do |path|
32
+ puts "creating: #{path}"
33
+ Dir.mkdir path
34
+ end
35
+
36
+ details = args
37
+ files = {
38
+ "Makefile" => QuickTemplate.erb('Makefile', details),
39
+ "History.txt" => QuickTemplate.erb('History.txt', details),
40
+ "README.txt" => QuickTemplate.erb('README.txt', details),
41
+ "src/#{file_name}.js" => QuickTemplate.erb('src/plugin.js', details),
42
+ "test/spec_#{file_name}.js" => QuickTemplate.erb('test/spec_plugin.js', details),
43
+ "Rakefile" => QuickTemplate.erb('Rakefile', details),
44
+ "src/css/screen.#{file_name}.css" => "",
45
+ "test/specs.html" => QuickTemplate.erb('test/specs.html', details),
46
+ "test/data/#{file_name}_01.json" => "",
47
+ "test/data/#{file_name}_01.js" => "",
48
+ }
49
+
50
+ files["Manifest.txt"] = files.keys.sort.join("\n")
51
+
52
+ files.each do |file, content|
53
+ puts "creating: #{file}"
54
+ File.open(file, "w") do |f|
55
+ f.write content
56
+ end
57
+ end
58
+ end
59
+ end
60
+
61
+ end
62
+ end
63
+
64
+
65
+
@@ -0,0 +1,35 @@
1
+ require "erb"
2
+
3
+ module JqueryPluginGen
4
+ class QuickTemplate
5
+ attr_reader :args, :text, :file
6
+
7
+ details = {:version => 'xxx'}
8
+
9
+ def initialize(file, path="")
10
+ @path = path.empty? ? File.dirname(__FILE__) + '/../templates/' : path
11
+ @file = @path + file + '.erb'
12
+ @text = File.read(@file)
13
+ end
14
+
15
+ def exec(b)
16
+ begin
17
+ details = b
18
+ # b = binding
19
+ template = ERB.new(@text, 0, "%<>")
20
+ result = template.result(binding)
21
+ # Chomp the trailing newline
22
+ #result.gsub(/\n$/,'')
23
+ result
24
+ rescue NameError
25
+ puts "Error found for #{@file}"
26
+ raise $!
27
+ end
28
+ end
29
+
30
+ def self.erb(file, b, path="")
31
+ QuickTemplate.new(file, path).exec(b)
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,11 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ $:.unshift(File.dirname(__FILE__) + '/jquery_plugin_gen')
5
+
6
+ require 'quick_template'
7
+ require 'generator'
8
+
9
+ module JqueryPluginGen
10
+ VERSION = '0.1.1'
11
+ end
@@ -0,0 +1,6 @@
1
+ === <%= details[:version] %> / <%= Time.new.strftime("%Y-%m-%d") %>
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
@@ -0,0 +1,76 @@
1
+ VERSION = <%= details[:version] %>
2
+
3
+ SRC_DIR = src
4
+ BUILD_DIR = build
5
+ DIST_DIR = dist/${VERSION}
6
+
7
+ JS_FILES = ${SRC_DIR}/<%= details[:project] %>.js
8
+
9
+ RELEASE_FILES = README.txt HISTORY.txt
10
+ IMAGES = ${SRC_DIR}/images/*
11
+ CSS = ${SRC_DIR}/css/*
12
+
13
+ IMAGES_DIST = ${BUILD_DIR}/images
14
+ CSS_DIST = ${BUILD_DIR}/css
15
+
16
+ WE = ${BUILD_DIR}/jquery.<%= details[:project] %>.js
17
+ WE_PACK = ${BUILD_DIR}/jquery.<%= details[:project] %>.pack.js
18
+
19
+ WE_ARCH = ${DIST_DIR}/jquery.<%= details[:project] %>.tar.gz
20
+ WE_RELEASE = ${DIST_DIR}/jquery.<%= details[:project] %>-${VERSION}.tar.gz
21
+
22
+ MERGE = sed -e '1 s/^\xEF\xBB\xBF//' ${JS_FILES} > ${WE}
23
+ PACKER = perl -I$ lib/packer lib/packer/jsPacker.pl -i ${WE} -o ${WE_PACK} -e62
24
+
25
+ all: archive
26
+
27
+ merge:
28
+
29
+ @@echo " - Cleaning Build dir " ${BUILD_DIR}
30
+ @@rm -rf ${BUILD_DIR}
31
+ @@mkdir -p ${BUILD_DIR}
32
+
33
+ @@echo "Building" ${WE}
34
+
35
+ @@echo " - Merging files"
36
+ @@${MERGE}
37
+
38
+ @@echo ${WE} "- built"
39
+ @@echo
40
+
41
+ pack: merge
42
+ @@echo " - Packing " ${WE_PACK}
43
+
44
+ @@echo "Compressing using Packer"
45
+ @@${PACKER}
46
+
47
+ @@echo
48
+
49
+ archive: pack
50
+
51
+ @@echo " - Cleaning Build dir " ${DIST_DIR}
52
+ @@rm -rf ${DIST_DIR}
53
+ @@mkdir -p ${DIST_DIR}
54
+
55
+ @@echo "- Making archive" ${WE_RELEASE}
56
+
57
+ @@echo "Making DIST dir" ${IMAGES_DIST} ${CSS_DIST}
58
+ @@mkdir -p ${IMAGES_DIST} ${CSS_DIST}
59
+
60
+ @@echo " - Coping CSS and images"
61
+ # @@cp -R -f ${IMAGES} ${IMAGES_DIST}
62
+ @@cp -R -f ${CSS} ${CSS_DIST}
63
+ @@cp -f ${RELEASE_FILES} ${BUILD_DIR}
64
+
65
+ @@echo " - Creating release"
66
+ @@tar -cjf ${WE_RELEASE} ${BUILD_DIR}
67
+
68
+ @@echo "Building" ${WE_ARCH}
69
+
70
+ @@echo " - Creating archive"
71
+ @@rm -f ${WE_ARCH}
72
+ @@tar --exclude '.DS_Store ._' -czf ${WE_ARCH} .
73
+
74
+
75
+
76
+
@@ -0,0 +1,48 @@
1
+ = <%= details[:project] %>
2
+
3
+ * FIX (url)
4
+
5
+ == DESCRIPTION:
6
+
7
+ FIX (describe your package)
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * FIX (list of features or problems)
12
+
13
+ == SYNOPSIS:
14
+
15
+ FIX (code sample of usage)
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * FIX (list of requirements)
20
+
21
+ == INSTALL:
22
+
23
+ * FIX (sudo gem install, anything else)
24
+
25
+ == LICENSE:
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2009 FIX
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ # -*- ruby -*-
2
+
3
+ require './lib/tasks/<%= details[:project] %>.rake'
@@ -0,0 +1,32 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+
5
+ <link rel="stylesheet" href="build/dist/css/email.screen.css" />
6
+
7
+ <script src="lib/jquery/jquery.js" type="text/javascript"></script>
8
+ <script src="lib/jquery/jquery.cookie.js" type="text/javascript"></script>
9
+ <script src="build/dist/jquery.<%= details[:project] %>.js" type="text/javascript"></script>
10
+
11
+ </head>
12
+ <body>
13
+
14
+ <h1 id="banner">Unit Test Results</h1>
15
+ <div id="main"><h3>Session #1</h3>
16
+
17
+ <div id="<%= details[:project] %>" class="<%= details[:project] %>" />
18
+
19
+ </div>
20
+
21
+ <script type="text/javascript">
22
+
23
+ $(function(){
24
+ $('#<%= details[:project] %>').<%= details[:project] %>();
25
+ })
26
+
27
+ </script>
28
+
29
+
30
+ </body>
31
+
32
+ </html>
@@ -0,0 +1,24 @@
1
+ ;(function($) {
2
+
3
+ $.extend($, {
4
+
5
+ <%= details[:project] %>: function(options) {
6
+
7
+ VERSION = <%= details[:version] %>
8
+ self = this
9
+
10
+ defaults = {
11
+ key: 'value'
12
+ }
13
+
14
+ $.extend(options, defaults)
15
+
16
+ return this.each( function(){
17
+
18
+ // your plugin
19
+
20
+ })
21
+ },
22
+
23
+ })
24
+ })(jQuery);
@@ -0,0 +1,13 @@
1
+ describe('', {
2
+
3
+ 'before': function() {
4
+ },
5
+
6
+ 'after': function(){
7
+ },
8
+
9
+ 'should ': function(){
10
+
11
+ },
12
+
13
+ })
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
5
+ <title>JSSpec results</title>
6
+ <link rel="stylesheet" type="text/css" href="../lib/jsspec/JSSpec.css" />
7
+
8
+ <script type="text/javascript" src="../lib/jsspec/JSSpec.js"></script>
9
+ <script type="text/javascript" src="../lib/jsspec/diff_match_patch.js"></script>
10
+
11
+ <link rel="stylesheet" href="lib/jquery-ui-1.7.1.custom/css/smoothness/jquery-ui-1.7.1.custom.css" />
12
+ <link rel="stylesheet" href="src/css/<%= details[:project] %>.screen.css" />
13
+
14
+ <script src="../lib/jquery-ui-1.7.1.custom/js/jquery-1.3.2.min.js" type="text/javascript"></script>
15
+ <script src="../lib/jquery-ui-1.7.1.custom/js/jquery-ui-1.7.1.custom.min.js" type="text/javascript"></script>
16
+
17
+ <script src="../build/dist/jquery.<%= details[:project] %>.js" type="text/javascript"></script>
18
+
19
+ <script type="text/javascript" src="test/spec_<%= details[:project] %>.js"></script>
20
+
21
+ </head>
22
+ <body>
23
+
24
+ <div id="<%= details[:project] %>" class="<%= details[:project] %>"></div>
25
+
26
+ </body>
27
+
28
+ </html>
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/jquery_plugin_gen.rb'}"
9
+ puts "Loading jquery_plugin_gen gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,6 @@
1
+ === 0.1.0 / 2009-06-01
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
@@ -0,0 +1,10 @@
1
+ History.txt
2
+ Makefile
3
+ README.txt
4
+ Rakefile
5
+ src/css/screen.email.css
6
+ src/email.js
7
+ test/data/email_01.js
8
+ test/data/email_01.json
9
+ test/spec_email.js
10
+ test/specs.html
@@ -0,0 +1,48 @@
1
+ = email
2
+
3
+ * FIX (url)
4
+
5
+ == DESCRIPTION:
6
+
7
+ FIX (describe your package)
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * FIX (list of features or problems)
12
+
13
+ == SYNOPSIS:
14
+
15
+ FIX (code sample of usage)
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * FIX (list of requirements)
20
+
21
+ == INSTALL:
22
+
23
+ * FIX (sudo gem install, anything else)
24
+
25
+ == LICENSE:
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2009 FIX
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ # -*- ruby -*-
2
+
3
+ require './lib/tasks/email.rake'
@@ -0,0 +1,24 @@
1
+ ;(function($) {
2
+
3
+ $.extend($, {
4
+
5
+ email: function(options) {
6
+
7
+ VERSION = 0.1.0
8
+ self = this
9
+
10
+ defaults = {
11
+ key: 'value'
12
+ }
13
+
14
+ $.extend(options, defaults)
15
+
16
+ return this.each( function(){
17
+
18
+ // your plugin
19
+
20
+ })
21
+ },
22
+
23
+ })
24
+ })(jQuery);
@@ -0,0 +1,13 @@
1
+ describe('', {
2
+
3
+ 'before': function() {
4
+ },
5
+
6
+ 'after': function(){
7
+ },
8
+
9
+ 'should ': function(){
10
+
11
+ },
12
+
13
+ })
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
5
+ <title>JSSpec results</title>
6
+ <link rel="stylesheet" type="text/css" href="../lib/jsspec/JSSpec.css" />
7
+
8
+ <script type="text/javascript" src="../lib/jsspec/JSSpec.js"></script>
9
+ <script type="text/javascript" src="../lib/jsspec/diff_match_patch.js"></script>
10
+
11
+ <link rel="stylesheet" href="lib/jquery-ui-1.7.1.custom/css/smoothness/jquery-ui-1.7.1.custom.css" />
12
+ <link rel="stylesheet" href="src/css/email.screen.css" />
13
+
14
+ <script src="../lib/jquery-ui-1.7.1.custom/js/jquery-1.3.2.min.js" type="text/javascript"></script>
15
+ <script src="../lib/jquery-ui-1.7.1.custom/js/jquery-ui-1.7.1.custom.min.js" type="text/javascript"></script>
16
+
17
+ <script src="../build/dist/jquery.email.js" type="text/javascript"></script>
18
+
19
+ <script type="text/javascript" src="test/spec_email.js"></script>
20
+
21
+ </head>
22
+ <body>
23
+
24
+ <div id="email" class="email"></div>
25
+
26
+ </body>
27
+
28
+ </html>
@@ -0,0 +1,38 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+ require 'jqp/cli'
3
+
4
+ describe Jqp::CLI, "execute" do
5
+ before(:each) do
6
+ @stdout_io = StringIO.new
7
+ Jqp::CLI.execute(@stdout_io, [''])
8
+ @stdout_io.rewind
9
+ @stdout = @stdout_io.read
10
+ end
11
+
12
+ after(:each) do
13
+ FileUtils.rm_rf(base_dir) if File.directory? base_dir
14
+ end
15
+
16
+ it "should print default output" do
17
+ @stdout.should =~ /To update this executable/
18
+ end
19
+
20
+ it "should be able to create base directories" do
21
+ %w(src lib test dist src/images src/css test/data).each do |dir|
22
+ File.directory?(base_dir + dir).should equal(true)
23
+ end
24
+ end
25
+
26
+ it "should be able to create base file" do
27
+ base_files.each do |file|
28
+ File.exists?(base_dir + file).should equal(true)
29
+ end
30
+
31
+ end
32
+
33
+ def base_files
34
+ %w(Makefile History.txt README.txt Rakefile Manifest.txt
35
+ src/~jq-plugin.js test/spec_~jq-plugin.js src/css/screen.~jq-plugin.css
36
+ test/specs.html test/data/~jq-plugin_01.js test/data/~jq-plugin_01.json)
37
+ end
38
+ end
@@ -0,0 +1,23 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "Base generation" do
4
+
5
+ before(:each) do
6
+ end
7
+
8
+ after(:each) do
9
+ end
10
+
11
+ %w(Makefile History.txt README.txt Rakefile).each do |file|
12
+ it "should generate the #{file}" do
13
+ JqueryPluginGen::QuickTemplate.erb(file, details).should == generated_file(file)
14
+ end
15
+ end
16
+
17
+ %w(src/email.js test/spec_email.js test/specs.html).each do |file|
18
+ it "should transform the #{file}" do
19
+ JqueryPluginGen::QuickTemplate.erb(file.gsub(/email/, 'plugin'), details).should == generated_file(file)
20
+ end
21
+ end
22
+
23
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,22 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'jquery_plugin_gen'
11
+
12
+ def base_dir
13
+ File.dirname(__FILE__) + '/../~jq-plugin/'
14
+ end
15
+
16
+ def generated_file(file)
17
+ File.read(File.dirname(__FILE__) + '/data/templates/' + file)
18
+ end
19
+
20
+ def details
21
+ {:version => '0.1.0', :project => 'email'}
22
+ end
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jqueryplugingen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - toddb
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-01 00:00:00 +12:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: newgem
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.4.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.8.0
34
+ version:
35
+ description: Generate the structure of jquery plugins easily. Manage library dependencies such as other jquery libraries or packing code on either mac or windows. Get jsspec testing baked in. Use the familiar rake tasks to manage your jquery code base.
36
+ email:
37
+ - todd@8wireunlimited.com
38
+ executables:
39
+ - jqp
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - History.txt
44
+ - Manifest.txt
45
+ - README.rdoc
46
+ - spec/data/templates/History.txt
47
+ - spec/data/templates/Manifest.txt
48
+ - spec/data/templates/README.txt
49
+ files:
50
+ - History.txt
51
+ - Manifest.txt
52
+ - README.rdoc
53
+ - Rakefile
54
+ - bin/jqp
55
+ - jQuery-Plugin-Generator.tmproj
56
+ - lib/jqp/cli.rb
57
+ - lib/jquery_plugin_gen.rb
58
+ - lib/jquery_plugin_gen/generator.rb
59
+ - lib/jquery_plugin_gen/quick_template.rb
60
+ - lib/templates/History.txt.erb
61
+ - lib/templates/Makefile.erb
62
+ - lib/templates/README.txt.erb
63
+ - lib/templates/Rakefile.erb
64
+ - lib/templates/example.html.erb
65
+ - lib/templates/src/plugin.js.erb
66
+ - lib/templates/test/spec_plugin.js.erb
67
+ - lib/templates/test/specs.html.erb
68
+ - script/console
69
+ - script/destroy
70
+ - script/generate
71
+ - spec/data/templates/History.txt
72
+ - spec/data/templates/Manifest.txt
73
+ - spec/data/templates/README.txt
74
+ - spec/data/templates/Rakefile
75
+ - spec/data/templates/src/email.js
76
+ - spec/data/templates/test/spec_email.js
77
+ - spec/data/templates/test/specs.html
78
+ - spec/jqp_cli_spec.rb
79
+ - spec/jquery_plugin_gen_spec.rb
80
+ - spec/spec.opts
81
+ - spec/spec_helper.rb
82
+ - tasks/rspec.rake
83
+ has_rdoc: true
84
+ homepage: http://github.com/toddb/jqueryplugingenerator
85
+ post_install_message:
86
+ rdoc_options:
87
+ - --main
88
+ - README.rdoc
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: "0"
96
+ version:
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: "0"
102
+ version:
103
+ requirements: []
104
+
105
+ rubyforge_project: jqueryplugingen
106
+ rubygems_version: 1.3.1
107
+ signing_key:
108
+ specification_version: 2
109
+ summary: Generate the structure of jquery plugins easily
110
+ test_files: []
111
+