pupu 0.0.3 → 0.0.4.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/README.textile +2 -2
- data/TODO.txt +8 -3
- data/bin/pupu +16 -24
- data/examples/merb/.gitignore +7 -11
- data/examples/merb/Gemfile +27 -0
- data/examples/merb/README.textile +3 -5
- data/examples/merb/config/init.rb +7 -0
- data/examples/rails/.gitignore +7 -0
- data/examples/rails/Gemfile +28 -0
- data/examples/rails/README.textile +5 -0
- data/examples/rails/Rakefile +10 -0
- data/examples/rails/app/controllers/application_controller.rb +10 -0
- data/examples/rails/app/controllers/home_controller.rb +8 -0
- data/examples/rails/app/helpers/application_helper.rb +3 -0
- data/{spec/pupu/adapters/merb_spec.rb → examples/rails/app/views/examples/arguments.html.erb} +0 -0
- data/{spec/pupu/adapters/rango_spec.rb → examples/rails/app/views/examples/dependencies.html.erb} +0 -0
- data/examples/rails/app/views/examples/simple.html.erb +4 -0
- data/examples/rails/app/views/index.html.erb +7 -0
- data/examples/rails/app/views/layout.html.erb +12 -0
- data/examples/rails/config/boot.rb +110 -0
- data/examples/rails/config/environment.rb +55 -0
- data/examples/rails/config/environments/development.rb +17 -0
- data/examples/rails/config/environments/production.rb +28 -0
- data/examples/rails/config/environments/test.rb +28 -0
- data/examples/rails/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/rails/config/initializers/inflections.rb +10 -0
- data/examples/rails/config/initializers/mime_types.rb +5 -0
- data/examples/rails/config/initializers/new_rails_defaults.rb +21 -0
- data/examples/rails/config/initializers/session_store.rb +15 -0
- data/examples/rails/config/routes.rb +43 -0
- data/examples/rails/db/seeds.rb +7 -0
- data/examples/rails/public/404.html +30 -0
- data/examples/rails/public/422.html +30 -0
- data/examples/rails/public/500.html +30 -0
- data/examples/rails/public/favicon.ico +0 -0
- data/examples/rails/public/robots.txt +5 -0
- data/examples/rails/script/about +4 -0
- data/examples/rails/script/console +3 -0
- data/examples/rails/script/dbconsole +3 -0
- data/examples/rails/script/destroy +3 -0
- data/examples/rails/script/generate +3 -0
- data/examples/rails/script/performance/benchmarker +3 -0
- data/examples/rails/script/performance/profiler +3 -0
- data/examples/rails/script/plugin +3 -0
- data/examples/rails/script/runner +3 -0
- data/examples/rails/script/server +3 -0
- data/examples/rails/spec/application_spec.rb +37 -0
- data/examples/rails/spec/spec_helper.rb +0 -0
- data/examples/rango/.gitignore +4 -0
- data/examples/rango/Gemfile +56 -0
- data/examples/rango/README.textile +4 -6
- data/examples/rango/init.rb +7 -0
- data/gems/cache/media-path-0.1.2.gem +0 -0
- data/gems/cache/nake-0.0.8.gem +0 -0
- data/gems/cache/rspec-1.3.0.gem +0 -0
- data/gems/cache/term-ansicolor-1.0.4.gem +0 -0
- data/lib/pupu.rb +2 -1
- data/lib/pupu/adapters/merb.rb +2 -0
- data/lib/pupu/adapters/rails.rb +2 -0
- data/lib/pupu/adapters/rango.rb +2 -0
- data/lib/pupu/cli.rb +2 -0
- data/lib/pupu/dsl.rb +2 -0
- data/lib/pupu/exceptions.rb +2 -0
- data/lib/pupu/github.rb +2 -0
- data/lib/pupu/helpers.rb +2 -0
- data/lib/pupu/metadata.rb +2 -0
- data/lib/pupu/parser.rb +2 -0
- data/lib/pupu/pupu.rb +2 -0
- data/lib/pupu/version.rb +5 -0
- data/pupu.gemspec +2 -1
- data/spec/data/public/pupu/autocompleter/config.rb +2 -0
- data/spec/pupu/dsl_spec.rb +3 -0
- data/spec/pupu/exceptions_spec.rb +3 -0
- data/spec/pupu/github_spec.rb +3 -0
- data/spec/pupu/helpers_spec.rb +4 -1
- data/spec/pupu/metadata_spec.rb +3 -0
- data/spec/pupu/parser_spec.rb +3 -0
- data/spec/pupu/pupu_spec.rb +3 -0
- data/tasks.rb +3 -2
- metadata +53 -9
data/CHANGELOG
CHANGED
data/README.textile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
h1. About Pupu
|
2
2
|
|
3
|
-
"Pupu":http://github.com/botanicus/pupu is a framework-agnostic plugin system for
|
3
|
+
"Pupu":http://github.com/botanicus/pupu is a framework-agnostic plugin system for assets like JS/CSS frameworks and its plugins, icon sets etc. You can "search GitHub":http://github.com/search?type=Repositories&language=&q=pupu&repo=&langOverride=&x=9&y=24&start_value=1 for more examples. It provides CLI interface for searching, installing and updating pupus from GitHub and it also provides a helper for including static files from pupu into your HTML page. Both CLI and helper can handle dependencies.
|
4
4
|
|
5
5
|
CLI example:
|
6
6
|
|
@@ -91,4 +91,4 @@ h1. Links
|
|
91
91
|
- "Wiki":http://wiki.github.com/botanicus/pupu
|
92
92
|
- "Source Code":http://github.com/botanicus/pupu
|
93
93
|
- "API Documentation":http://rdoc.info/projects/botanicus/pupu
|
94
|
-
- Examples: "Rango":http://github.com/botanicus/pupu/tree/master/examples/rango, "Merb":http://github.com/botanicus/pupu/tree/master/examples/merb
|
94
|
+
- Examples: "Rango":http://github.com/botanicus/pupu/tree/master/examples/rango, "Merb":http://github.com/botanicus/pupu/tree/master/examples/merb and "Rails":http://github.com/botanicus/pupu/tree/master/examples/rails
|
data/TODO.txt
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
+
Examples:
|
2
|
+
- recreate the rango app AFTER I release Rango 0.3 & bundle it
|
3
|
+
- ensure all the examples has the same functionality include specs
|
4
|
+
- ensure all the examples work
|
5
|
+
|
1
6
|
=== Version 0.1 ===
|
2
7
|
- Pupu.framework_root: "."
|
3
8
|
- Pupu.media_root: "media"
|
4
9
|
- Pupu.root: "media/pupu"
|
5
10
|
- @pupu.root: "media/pupu/mootools"
|
6
11
|
|
7
|
-
- rango & merb apps: both with same functionality include specs
|
8
|
-
|
9
12
|
- THERE SHOULD BE A CONVETION TO NAME PUPU WITH PUPU-FRAMEWORK-PLUGIN, FOR EXAMPLE PUPU-MOOTOOLS-FLASH because of search
|
10
13
|
- install each dependency just once
|
11
14
|
- how to handle metadata if we have it as submodules? (suggestions: media/pupu/metadata.yml for all) or on the fly from .git/config & config.rb etc
|
@@ -13,8 +16,10 @@
|
|
13
16
|
- media support (.swf): media helper
|
14
17
|
- media vs. root vs. custom
|
15
18
|
- how to handle metadata? Generate metadata.yml from config.rb (dependencies) or generate it through merb-gen and write it by hand?
|
16
|
-
- what about ruby helpers such as flash :notice, :error for flash <divs
|
19
|
+
- what about ruby helpers such as flash :notice, :error for flash <divs>
|
17
20
|
- add array with loaded plugins, do not load plugin which is already loaded
|
21
|
+
- hooks for minify etc
|
22
|
+
- don't touch file system in production mode (don't use File.exist?) -> just load manifest
|
18
23
|
|
19
24
|
=== Version 0.2 ===
|
20
25
|
|
data/bin/pupu
CHANGED
@@ -1,56 +1,46 @@
|
|
1
|
-
#!/usr/bin/env
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
|
+
# follow symlink
|
4
5
|
base = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
|
5
6
|
libdir = File.expand_path(File.join(File.dirname(base), "..", "lib"))
|
6
7
|
|
7
|
-
vendor = File.join(File.dirname(__FILE__), "..", "vendor")
|
8
|
-
if File.directory?(vendor)
|
9
|
-
Dir["#{vendor}/*"].each do |path|
|
10
|
-
if File.directory?(path) && Dir["#{path}/*"].empty?
|
11
|
-
warn "Dependency #{File.basename(path)} in vendor seems to be empty. Run git submodule init && git submodule update to checkout it."
|
12
|
-
elsif File.directory?(path) && File.directory?(File.join(path, "lib"))
|
13
|
-
$:.unshift(File.join(path, "lib"))
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
8
|
# because of system installation, there is bin/../lib, but not bin/../lib/pupu
|
19
9
|
if File.directory?(File.join(libdir, "pupu"))
|
20
10
|
$:.unshift(libdir) unless $:.include?(libdir)
|
21
11
|
end
|
22
12
|
|
23
|
-
|
24
|
-
|
13
|
+
require "pupu/cli"
|
14
|
+
|
15
|
+
# helpers
|
25
16
|
def usage
|
26
17
|
<<-HELP
|
27
18
|
=== Usage ===
|
28
|
-
|
29
|
-
pupu
|
19
|
+
pupu install [pupu]
|
20
|
+
pupu uninstall [pupu]
|
21
|
+
pupu update [pupu|all]
|
22
|
+
pupu list
|
23
|
+
pupu check
|
24
|
+
pupu search [pattern]
|
25
|
+
pupu create [name]
|
26
|
+
--media-root=media
|
30
27
|
HELP
|
31
28
|
end
|
32
29
|
|
30
|
+
# main loop
|
33
31
|
begin
|
34
32
|
case ARGV.shift
|
35
|
-
when nil
|
36
|
-
abort usage
|
37
33
|
when "install"
|
38
|
-
require "pupu/cli"
|
39
34
|
Pupu::CLI.new(ARGV).install
|
40
35
|
when "uninstall", "remove"
|
41
|
-
require "pupu/cli"
|
42
36
|
Pupu::CLI.new(ARGV).uninstall
|
43
37
|
when "update"
|
44
|
-
require "pupu/cli"
|
45
38
|
Pupu::CLI.new(ARGV).update
|
46
39
|
when "list" # list all pupus
|
47
|
-
require "pupu/cli"
|
48
40
|
Pupu::CLI.new(ARGV).list
|
49
41
|
when "check" # check setup & if you are in the right directory
|
50
|
-
require "pupu/cli"
|
51
42
|
Pupu::CLI.new(ARGV).check || abort("File config/pupu.rb doesn't exist or can't be loaded")
|
52
43
|
when "search"
|
53
|
-
require "pupu/cli"
|
54
44
|
Pupu::CLI.new(ARGV).search(ARGV.first)
|
55
45
|
when "create"
|
56
46
|
begin
|
@@ -69,5 +59,7 @@ begin
|
|
69
59
|
rescue Exception => exception
|
70
60
|
abort "Exception #{exception.inspect} occured during running generator #{generator.inspect}\n#{exception.backtrace.join("\n")}"
|
71
61
|
end
|
62
|
+
else
|
63
|
+
abort usage
|
72
64
|
end
|
73
65
|
end
|
data/examples/merb/.gitignore
CHANGED
@@ -1,21 +1,17 @@
|
|
1
|
-
|
1
|
+
# You usually don't want to ignore gems/cache, but examples are
|
2
|
+
# part of the pupu gem and we want to keep it as small as possible
|
3
|
+
gems/*
|
4
|
+
bin/*
|
5
|
+
|
2
6
|
log/*
|
3
7
|
tmp/*
|
4
|
-
|
5
|
-
*~
|
6
|
-
.#*
|
8
|
+
|
7
9
|
schema/schema.rb
|
8
10
|
schema/*_structure.sql
|
9
11
|
schema/*.sqlite3
|
10
12
|
schema/*.sqlite
|
11
13
|
schema/*.db
|
14
|
+
|
12
15
|
*.sqlite
|
13
16
|
*.sqlite3
|
14
17
|
*.db
|
15
|
-
src/*
|
16
|
-
.hgignore
|
17
|
-
.hg/*
|
18
|
-
.svn/*
|
19
|
-
gems/gems/*
|
20
|
-
gems/specifications/*
|
21
|
-
merb_profile_results
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# === Usage === #
|
4
|
+
# Run gem bundle for installation. You have to have bundler gem installed.
|
5
|
+
|
6
|
+
# http://github.com/wycats/bundler
|
7
|
+
# http://litanyagainstfear.com/blog/2009/10/14/gem-bundler-is-the-future
|
8
|
+
# http://yehudakatz.com/2009/11/03/using-the-new-gem-bundler-today
|
9
|
+
# http://www.engineyard.com/blog/2009/using-the-rubygems-bundler-for-your-app
|
10
|
+
|
11
|
+
gem "merb-core" # git: "git://github.com/merb/merb.git"
|
12
|
+
gem "media-path" # git: "git://github.com/botanicus/media-path.git"
|
13
|
+
gem "rspec", only: :test # git: "git://github.com/dchelimsky/rspec.git"
|
14
|
+
|
15
|
+
# === Bundler Setup === #
|
16
|
+
# Specify where the bundled gems should be stashed. This directory will
|
17
|
+
# be a gem repository where all gems are downloaded to and installed to.
|
18
|
+
#
|
19
|
+
# This is an optional setting.
|
20
|
+
# The default is: vendor/gems
|
21
|
+
bundle_path "gems"
|
22
|
+
|
23
|
+
# Specify where gem executables should be copied to.
|
24
|
+
#
|
25
|
+
# This is an optional setting.
|
26
|
+
# The default is: bin
|
27
|
+
bin_path "bin"
|
@@ -1,7 +1,5 @@
|
|
1
1
|
h1. Merb Example
|
2
2
|
|
3
|
-
*
|
4
|
-
* Run with
|
5
|
-
|
6
|
-
* Dependencies for testing: @rspec@, @webrat@
|
7
|
-
* Specs: @spec spec/application_spec.rb --colour@
|
3
|
+
* @gem bundle@ (you have to have bundler 0.7.2 installed)
|
4
|
+
* Run with @./bin/merb -a webrick@ (will start at @http://localhost:4000@)
|
5
|
+
* Specs: @./bin/spec spec/application_spec.rb --colour@
|
@@ -1,5 +1,12 @@
|
|
1
1
|
# Go to http://wiki.merbivore.com/pages/init-rb
|
2
2
|
|
3
|
+
# bundler
|
4
|
+
begin
|
5
|
+
require_relative "../gems/environment.rb"
|
6
|
+
rescue LoadError => exception
|
7
|
+
abort "LoadError during loading gems/environment: #{exception.message}\nRun gem bundle to fix it."
|
8
|
+
end
|
9
|
+
|
3
10
|
# setup $:
|
4
11
|
pupu_libdir = File.expand_path("../../lib")
|
5
12
|
raise Errno::ENOENT, "#{pupu_libdir} doesn't exist" unless File.directory?(pupu_libdir)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# === Usage === #
|
4
|
+
# Run gem bundle for installation. You have to have bundler gem installed.
|
5
|
+
|
6
|
+
# http://github.com/wycats/bundler
|
7
|
+
# http://litanyagainstfear.com/blog/2009/10/14/gem-bundler-is-the-future
|
8
|
+
# http://yehudakatz.com/2009/11/03/using-the-new-gem-bundler-today
|
9
|
+
# http://www.engineyard.com/blog/2009/using-the-rubygems-bundler-for-your-app
|
10
|
+
|
11
|
+
gem "rails" # git: "git://github.com/rails/rails.git"
|
12
|
+
gem "media-path" # git: "git://github.com/botanicus/media-path.git"
|
13
|
+
gem "rspec", only: :test # git: "git://github.com/dchelimsky/rspec.git"
|
14
|
+
gem "rspec-rails", only: :test # git: "git://github.com/dchelimsky/rspec-rails.git"
|
15
|
+
|
16
|
+
# === Bundler Setup === #
|
17
|
+
# Specify where the bundled gems should be stashed. This directory will
|
18
|
+
# be a gem repository where all gems are downloaded to and installed to.
|
19
|
+
#
|
20
|
+
# This is an optional setting.
|
21
|
+
# The default is: vendor/gems
|
22
|
+
bundle_path "gems"
|
23
|
+
|
24
|
+
# Specify where gem executables should be copied to.
|
25
|
+
#
|
26
|
+
# This is an optional setting.
|
27
|
+
# The default is: bin
|
28
|
+
bin_path "bin"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
require 'rake/rdoctask'
|
9
|
+
|
10
|
+
require 'tasks/rails'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Filters added to this controller apply to all controllers in the application.
|
2
|
+
# Likewise, all the methods added will be available for all controllers.
|
3
|
+
|
4
|
+
class ApplicationController < ActionController::Base
|
5
|
+
helper :all # include all helpers, all the time
|
6
|
+
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
7
|
+
|
8
|
+
# Scrub sensitive parameters from your log
|
9
|
+
# filter_parameter_logging :password
|
10
|
+
end
|
data/{spec/pupu/adapters/merb_spec.rb → examples/rails/app/views/examples/arguments.html.erb}
RENAMED
File without changes
|
data/{spec/pupu/adapters/rango_spec.rb → examples/rails/app/views/examples/dependencies.html.erb}
RENAMED
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
<head>
|
4
|
+
<title><%= yield :title %></title>
|
5
|
+
<%= yield :head %>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<h1><%= yield :title %></h1>
|
9
|
+
<%= yield :layout %>
|
10
|
+
<pre><%= yield :head %></pre>
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# Don't change this file!
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
+
|
4
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
class << self
|
8
|
+
def boot!
|
9
|
+
unless booted?
|
10
|
+
preinitialize
|
11
|
+
pick_boot.run
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def booted?
|
16
|
+
defined? Rails::Initializer
|
17
|
+
end
|
18
|
+
|
19
|
+
def pick_boot
|
20
|
+
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
+
end
|
22
|
+
|
23
|
+
def vendor_rails?
|
24
|
+
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
+
end
|
26
|
+
|
27
|
+
def preinitialize
|
28
|
+
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def preinitializer_path
|
32
|
+
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Boot
|
37
|
+
def run
|
38
|
+
load_initializer
|
39
|
+
Rails::Initializer.run(:set_load_path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class VendorBoot < Boot
|
44
|
+
def load_initializer
|
45
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
+
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
+
Rails::GemDependency.add_frozen_gem_path
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class GemBoot < Boot
|
52
|
+
def load_initializer
|
53
|
+
self.class.load_rubygems
|
54
|
+
load_rails_gem
|
55
|
+
require 'initializer'
|
56
|
+
end
|
57
|
+
|
58
|
+
def load_rails_gem
|
59
|
+
if version = self.class.gem_version
|
60
|
+
gem 'rails', version
|
61
|
+
else
|
62
|
+
gem 'rails'
|
63
|
+
end
|
64
|
+
rescue Gem::LoadError => load_error
|
65
|
+
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
66
|
+
exit 1
|
67
|
+
end
|
68
|
+
|
69
|
+
class << self
|
70
|
+
def rubygems_version
|
71
|
+
Gem::RubyGemsVersion rescue nil
|
72
|
+
end
|
73
|
+
|
74
|
+
def gem_version
|
75
|
+
if defined? RAILS_GEM_VERSION
|
76
|
+
RAILS_GEM_VERSION
|
77
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
78
|
+
ENV['RAILS_GEM_VERSION']
|
79
|
+
else
|
80
|
+
parse_gem_version(read_environment_rb)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def load_rubygems
|
85
|
+
min_version = '1.3.2'
|
86
|
+
require 'rubygems'
|
87
|
+
unless rubygems_version >= min_version
|
88
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
89
|
+
exit 1
|
90
|
+
end
|
91
|
+
|
92
|
+
rescue LoadError
|
93
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
94
|
+
exit 1
|
95
|
+
end
|
96
|
+
|
97
|
+
def parse_gem_version(text)
|
98
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
def read_environment_rb
|
103
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# All that for this:
|
110
|
+
Rails.boot!
|