youpy-newextension 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.
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ == 0.0.1 2007-09-27
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
data/License.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2007 youpy
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.
data/Manifest.txt ADDED
@@ -0,0 +1,24 @@
1
+ History.txt
2
+ License.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ bin/newextension
7
+ config/hoe.rb
8
+ config/requirements.rb
9
+ lib/newextension.rb
10
+ lib/newextension/version.rb
11
+ script/destroy
12
+ script/generate
13
+ setup.rb
14
+ tasks/deployment.rake
15
+ tasks/environment.rake
16
+ tasks/website.rake
17
+ templates/chrome/content/__extension__.js
18
+ templates/chrome/content/overlay.xul
19
+ templates/chrome/skin
20
+ templates/chrome.manifest
21
+ templates/install.rdf
22
+ templates/Rakefile
23
+ test/test_helper.rb
24
+ test/test_newextension.rb
data/README.txt ADDED
@@ -0,0 +1,43 @@
1
+
2
+ = newextension
3
+
4
+ == Description
5
+ creates a Firefox extension skeleton
6
+
7
+ == Installation
8
+
9
+ === Archive Installation
10
+
11
+ rake install
12
+
13
+ === Gem Installation
14
+
15
+ gem install newextension
16
+
17
+
18
+ == Features/Problems
19
+
20
+
21
+ == Synopsis
22
+
23
+ === Create Extension
24
+
25
+ newextension -a yourname foo
26
+
27
+ === Create xpi
28
+
29
+ rake create_extension_xpi
30
+
31
+ === Symlink In Your Local Profile
32
+
33
+ rake install
34
+
35
+ === Unlink From Your Local Profile
36
+
37
+ rake uninstall
38
+
39
+ == Copyright
40
+
41
+ Author:: youpy <youpy@buycheapviagraonlinenow.com>
42
+ Copyright:: Copyright (c) 2008 youpy
43
+ License:: The MIT License
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'config/requirements'
2
+ require 'config/hoe' # setup Hoe + all gem configuration
3
+
4
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
data/bin/newextension ADDED
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created on 2007-9-27.
4
+ # Copyright (c) 2007. All rights reserved.
5
+
6
+ begin
7
+ require 'rubygems'
8
+ rescue LoadError
9
+ # no rubygems to load, so we fail silently
10
+ end
11
+
12
+ require 'optparse'
13
+ require 'pathname'
14
+ require 'fileutils'
15
+ require 'uuidtools'
16
+ require 'erb'
17
+
18
+ include FileUtils
19
+
20
+ def camelize(lower_case_and_underscored_word)
21
+ lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
22
+ end
23
+
24
+ OPTIONS = {
25
+ :author => 'somebody',
26
+ :version => '0.1',
27
+ }
28
+ MANDATORY_OPTIONS = %w( )
29
+
30
+ extension_dir = nil
31
+
32
+ parser = OptionParser.new do |opts|
33
+ opts.banner = <<BANNER
34
+ #{File.basename($0)}: create a Firefox extension skeleton
35
+
36
+ Usage: #{File.basename($0)} [options] extension_dir
37
+
38
+ Options are:
39
+ BANNER
40
+ opts.separator ""
41
+ opts.on("-a", "--author=AUTHOR", String,
42
+ "The author of new extension",
43
+ "Default: #{OPTIONS[:author]}") { |OPTIONS[:author]| }
44
+ opts.on("-V", "--version=VERSION", String,
45
+ "The version of new extension",
46
+ "Default: #{OPTIONS[:version]}") { |OPTIONS[:version]| }
47
+ opts.on("-h", "--help",
48
+ "Show this help message.") { puts opts; exit }
49
+ opts.parse!(ARGV)
50
+
51
+ extension_dir = Pathname.new(ARGV.shift).expand_path
52
+
53
+ if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
54
+ puts opts; exit
55
+ end
56
+ end
57
+
58
+ author = OPTIONS[:author]
59
+ version = OPTIONS[:version]
60
+ uuid = UUID.random_create.to_s
61
+
62
+ templates = Pathname.new(File.dirname(__FILE__)).realpath + '../templates'
63
+ extension_name = extension_dir.basename.to_s
64
+ package_name = extension_name.downcase.gsub(/[^a-z]/, '')
65
+
66
+ cd templates do
67
+ Pathname.glob('**/*').each do |filename|
68
+ target = Pathname.new([extension_dir, filename].join('/')).expand_path
69
+
70
+ if File.directory?(filename)
71
+ mkdir_p target
72
+ puts "create directory:\n\t#{target}"
73
+ else
74
+ open(target.to_s.gsub(/__extension__/, camelize(extension_name)), 'w') do |dst|
75
+ dst.write(ERB.new(filename.read, $SAFE, '-').result(binding))
76
+ puts "create: #{dst.path}"
77
+ end
78
+ end
79
+ end
80
+ end
data/config/hoe.rb ADDED
@@ -0,0 +1,71 @@
1
+ require 'newextension/version'
2
+
3
+ AUTHOR = 'youpy' # can also be an array of Authors
4
+ EMAIL = "youpy@buycheapviagraonlinenow.com"
5
+ DESCRIPTION = "Create a Firefox extension skeleton"
6
+ GEM_NAME = 'newextension' # what ppl will type to install your gem
7
+ RUBYFORGE_PROJECT = 'newextension' # The unix name for your project
8
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
+ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
+
11
+ @config_file = "~/.rubyforge/user-config.yml"
12
+ @config = nil
13
+ RUBYFORGE_USERNAME = "unknown"
14
+ def rubyforge_username
15
+ unless @config
16
+ begin
17
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
18
+ rescue
19
+ puts <<-EOS
20
+ ERROR: No rubyforge config file found: #{@config_file}
21
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
22
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
23
+ EOS
24
+ exit
25
+ end
26
+ end
27
+ RUBYFORGE_USERNAME.replace @config["username"]
28
+ end
29
+
30
+
31
+ REV = nil
32
+ # UNCOMMENT IF REQUIRED:
33
+ # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
34
+ VERS = Newextension::VERSION::STRING + (REV ? ".#{REV}" : "")
35
+ RDOC_OPTS = ['--quiet', '--title', 'newextension documentation',
36
+ "--opname", "index.html",
37
+ "--line-numbers",
38
+ "--main", "README",
39
+ "--inline-source"]
40
+
41
+ class Hoe
42
+ def extra_deps
43
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
44
+ @extra_deps
45
+ end
46
+ end
47
+
48
+ # Generate all the Rake tasks
49
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
50
+ hoe = Hoe.new(GEM_NAME, VERS) do |p|
51
+ p.author = AUTHOR
52
+ p.description = DESCRIPTION
53
+ p.email = EMAIL
54
+ p.summary = DESCRIPTION
55
+ p.url = HOMEPATH
56
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
57
+ p.extra_deps << ['uuidtools']
58
+ p.test_globs = ["test/**/test_*.rb"]
59
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
60
+
61
+ # == Optional
62
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\\n\\n")
63
+ #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
64
+
65
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
66
+
67
+ end
68
+
69
+ CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
70
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
71
+ hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
@@ -0,0 +1,17 @@
1
+ require 'fileutils'
2
+ include FileUtils
3
+
4
+ require 'rubygems'
5
+ %w[rake hoe newgem rubigen].each do |req_gem|
6
+ begin
7
+ require req_gem
8
+ rescue LoadError
9
+ puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
+ puts "Installation: gem install #{req_gem} -y"
11
+ exit
12
+ end
13
+ end
14
+
15
+ $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
16
+
17
+ require 'newextension'
@@ -0,0 +1,9 @@
1
+ module Newextension #:nodoc:
2
+ module VERSION #:nodoc:
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ TINY = 1
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ module Newextension
4
+
5
+ end
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = 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]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = 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]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)