pupu 0.0.4.pre → 0.0.5
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/CHANGELOG +8 -0
- data/bin/pupu +4 -1
- data/lib/pupu/adapters/merb.rb +10 -0
- data/lib/pupu/adapters/rails.rb +10 -0
- data/lib/pupu/adapters/rango.rb +10 -0
- data/lib/pupu/cli.rb +7 -7
- data/lib/pupu/dsl.rb +7 -0
- data/lib/pupu/github.rb +14 -8
- data/lib/pupu/pupu.rb +12 -0
- data/lib/pupu/version.rb +1 -1
- data/stubs/pupu/content/%name%.gemspec.rbt +47 -0
- data/stubs/pupu/content/%name%.pre.gemspec.rbt +8 -0
- data/stubs/pupu/content/.gitignore +5 -2
- data/stubs/pupu/content/deps.rip +5 -0
- data/stubs/pupu/content/init.rb.rbt +17 -0
- data/stubs/pupu/content/lib/%name%.rb.rbt +4 -0
- data/stubs/pupu/content/lib/%name%/adapters/rails.rb +0 -0
- data/stubs/pupu/content/lib/%name%/adapters/rango.rb +0 -0
- data/stubs/pupu/content/spec/%name%/.gitignore +0 -0
- data/stubs/pupu/content/spec/%name%_spec.rb.rbt +10 -0
- data/stubs/pupu/content/spec/spec.opts +5 -0
- data/stubs/pupu/content/spec/spec_helper.rb.rbt +7 -0
- data/stubs/pupu/postprocess.rb +8 -0
- data/stubs/pupu/setup.rb +4 -0
- data/tasks.rb +5 -6
- metadata +16 -5
data/CHANGELOG
CHANGED
@@ -18,3 +18,11 @@
|
|
18
18
|
|
19
19
|
= Version 0.0.4
|
20
20
|
* Added Rails example app
|
21
|
+
* pupu reinstall & pupu install --force
|
22
|
+
* Added Pupu.framework
|
23
|
+
* Added Pupu.logger
|
24
|
+
* Added Pupu.environment & Pupu.environment?
|
25
|
+
* Added --ruby & --no-ruby options to the generator
|
26
|
+
|
27
|
+
= Version 0.0.5
|
28
|
+
* Added if option to javascript/stylesheet, so you can use styleshett "ie", if: "lt IE 8"
|
data/bin/pupu
CHANGED
@@ -16,8 +16,9 @@ require "pupu/cli"
|
|
16
16
|
def usage
|
17
17
|
<<-HELP
|
18
18
|
=== Usage ===
|
19
|
-
pupu install [pupu]
|
19
|
+
pupu install [pupu] [-f|--force]
|
20
20
|
pupu uninstall [pupu]
|
21
|
+
pupu reinstall [pupu]
|
21
22
|
pupu update [pupu|all]
|
22
23
|
pupu list
|
23
24
|
pupu check
|
@@ -34,6 +35,8 @@ begin
|
|
34
35
|
Pupu::CLI.new(ARGV).install
|
35
36
|
when "uninstall", "remove"
|
36
37
|
Pupu::CLI.new(ARGV).uninstall
|
38
|
+
when "reinstall"
|
39
|
+
Pupu::CLI.new(ARGV, force: true).install
|
37
40
|
when "update"
|
38
41
|
Pupu::CLI.new(ARGV).update
|
39
42
|
when "list" # list all pupus
|
data/lib/pupu/adapters/merb.rb
CHANGED
@@ -3,6 +3,16 @@
|
|
3
3
|
require "pupu"
|
4
4
|
require "pupu/helpers"
|
5
5
|
|
6
|
+
Pupu.framework = :merb
|
7
|
+
|
8
|
+
def Pupu.environment
|
9
|
+
Merb.environment
|
10
|
+
end
|
11
|
+
|
12
|
+
def Pupu.logger
|
13
|
+
Merb.logger
|
14
|
+
end
|
15
|
+
|
6
16
|
Merb::BootLoader.before_app_loads do
|
7
17
|
Pupu.root = Merb.root
|
8
18
|
Pupu.media_root = File.join(Merb.root, "public")
|
data/lib/pupu/adapters/rails.rb
CHANGED
@@ -3,6 +3,16 @@
|
|
3
3
|
require "pupu"
|
4
4
|
require "pupu/helpers"
|
5
5
|
|
6
|
+
Pupu.framework = :rails
|
7
|
+
|
8
|
+
def Pupu.environment
|
9
|
+
Rails.environment
|
10
|
+
end
|
11
|
+
|
12
|
+
def Pupu.logger
|
13
|
+
Rails.logger
|
14
|
+
end
|
15
|
+
|
6
16
|
Pupu.root = Rails.root
|
7
17
|
Pupu.media_root = File.join(Rails.root, "public")
|
8
18
|
ActionView::Base.send(:include, Pupu::Helpers)
|
data/lib/pupu/adapters/rango.rb
CHANGED
@@ -3,6 +3,16 @@
|
|
3
3
|
require "pupu"
|
4
4
|
require "pupu/helpers"
|
5
5
|
|
6
|
+
Pupu.framework = :rango
|
7
|
+
|
8
|
+
def Pupu.environment
|
9
|
+
Rango.environment
|
10
|
+
end
|
11
|
+
|
12
|
+
def Pupu.logger
|
13
|
+
Rango.logger
|
14
|
+
end
|
15
|
+
|
6
16
|
Rango.after_boot(:register_pupu) do
|
7
17
|
Pupu.root = Rango.root
|
8
18
|
#Pupu.media_prefix = Project.settings.media_prefix
|
data/lib/pupu/cli.rb
CHANGED
@@ -9,7 +9,7 @@ require "pupu/pupu"
|
|
9
9
|
require "pupu/github"
|
10
10
|
|
11
11
|
# copyied from merb.thor, this part is actually my code as well :)
|
12
|
-
module
|
12
|
+
module Kernel
|
13
13
|
# red
|
14
14
|
def error(*messages)
|
15
15
|
puts messages.map { |msg| "\033[1;31m#{msg}\033[0m" }
|
@@ -40,10 +40,9 @@ end
|
|
40
40
|
|
41
41
|
module Pupu
|
42
42
|
class CLI
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
@args = args
|
43
|
+
attr_reader :args, :options
|
44
|
+
def initialize(args, options = Hash.new)
|
45
|
+
@args, @options = args, options
|
47
46
|
self.detect
|
48
47
|
self.load_config
|
49
48
|
self.parse_argv
|
@@ -88,8 +87,9 @@ module Pupu
|
|
88
87
|
def install
|
89
88
|
self.args.each do |pupu|
|
90
89
|
begin
|
91
|
-
GitHub.install(pupu)
|
92
|
-
rescue PluginIsAlreadyInstalled
|
90
|
+
GitHub.install(pupu, options)
|
91
|
+
rescue PluginIsAlreadyInstalled => e
|
92
|
+
puts e.backtrace.join("\n- ")
|
93
93
|
info "Plugin #{pupu} is already installed, skipping"
|
94
94
|
end
|
95
95
|
end
|
data/lib/pupu/dsl.rb
CHANGED
@@ -51,15 +51,22 @@ module Pupu
|
|
51
51
|
def javascript(basename, params = Hash.new)
|
52
52
|
path = @pupu.javascript(basename).url
|
53
53
|
tag = "<script src='#{path}' type='text/javascript'></script>"
|
54
|
+
if params[:if]
|
55
|
+
tag = "<!--[if #{params[:if]}]>" + tag + "<![endif]-->"
|
56
|
+
end
|
54
57
|
@files.push(path)
|
55
58
|
@output.push(tag)
|
56
59
|
end
|
57
60
|
|
58
61
|
def stylesheet(basename, params = Hash.new)
|
59
62
|
path = @pupu.stylesheet(basename).url
|
63
|
+
condition = params.delete(:if)
|
60
64
|
default = {media: 'screen', rel: 'stylesheet', type: 'text/css'}
|
61
65
|
params = default.merge(params)
|
62
66
|
tag = "<link href='#{path}' #{params.to_html_attrs} />"
|
67
|
+
if condition
|
68
|
+
tag = "<!--[if #{condition}]>" + tag + "<![endif]-->"
|
69
|
+
end
|
63
70
|
@files.push(path)
|
64
71
|
@output.push(tag)
|
65
72
|
end
|
data/lib/pupu/github.rb
CHANGED
@@ -21,13 +21,14 @@ module Pupu
|
|
21
21
|
class << self
|
22
22
|
include ShellExtensions
|
23
23
|
# GitHub.install("autocompleter")
|
24
|
-
# GitHub.install("botanicus/autocompleter")
|
25
|
-
def install(repo)
|
24
|
+
# GitHub.install("botanicus/autocompleter", force: true)
|
25
|
+
def install(repo, options = Hash.new)
|
26
26
|
user, repo = repo.split("/") if repo.match(%r{/})
|
27
27
|
user = ENV["USER"] unless user
|
28
28
|
url = "git://github.com/#{user}/pupu-#{repo}.git"
|
29
|
-
|
30
|
-
self.
|
29
|
+
info "Installing #{repo}"
|
30
|
+
self.install_files(repo, url, options)
|
31
|
+
self.install_dependencies(@pupu, options)
|
31
32
|
# TODO: git commit [files] -m "Added pupu #{repo} from #{url}"
|
32
33
|
end
|
33
34
|
|
@@ -73,17 +74,22 @@ module Pupu
|
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
76
|
-
def install_dependencies(pupu)
|
77
|
+
def install_dependencies(pupu, options = Hash.new)
|
77
78
|
dsl = DSL.new(pupu)
|
78
79
|
dsl.instance_eval(File.read(pupu.file("config.rb").path))
|
79
80
|
dsl.get_dependencies.each do |dependency|
|
80
|
-
|
81
|
+
info "Installing dependency #{dependency}"
|
82
|
+
self.install(dependency.name.to_s, options) # FIXME: "user/repo"
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
84
|
-
def install_files(repo, url)
|
86
|
+
def install_files(repo, url, options = Hash.new)
|
85
87
|
chdir do |media_dir|
|
86
|
-
|
88
|
+
if File.directory?(repo) && !options[:force]
|
89
|
+
raise PluginIsAlreadyInstalled, "Pupu #{repo} already exist"
|
90
|
+
elsif File.directory?(repo) && options[:force]
|
91
|
+
FileUtils.rm_r(repo)
|
92
|
+
end
|
87
93
|
run("git clone #{url} #{repo}") || abort("Git failed")
|
88
94
|
Dir.chdir(repo) do
|
89
95
|
proceed_files(repo, url)
|
data/lib/pupu/pupu.rb
CHANGED
@@ -17,6 +17,18 @@ module Pupu
|
|
17
17
|
@@root = path
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.framework
|
21
|
+
@@framework
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.framework=(framework)
|
25
|
+
@@framework = framework
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.environment?(environment)
|
29
|
+
self.environment.eql?(environment)
|
30
|
+
end
|
31
|
+
|
20
32
|
# @example Pupu.media_prefix("media").url
|
21
33
|
# => "/media/pupu/autocompleter/javascripts/autocompleter.js"
|
22
34
|
def self.media_prefix=(prefix)
|
data/lib/pupu/version.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env gem build
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Run ./<%= @name %>.gemspec or gem build <%= @name %>.gemspec
|
5
|
+
# NOTE: we can't use require_relative because when we run gem build, it use eval for executing this file
|
6
|
+
require File.join(File.dirname(__FILE__), "lib", "<%= @name %>", "version")
|
7
|
+
require "base64"
|
8
|
+
|
9
|
+
Gem::Specification.new do |s|
|
10
|
+
s.name = "<%= @name %>"
|
11
|
+
s.version = <%= @constant %>::VERSION
|
12
|
+
s.authors = ["<%= @full_name %>"]
|
13
|
+
s.homepage = "http://github.com/<%= @github_user %>/<%= @github_repository %>"
|
14
|
+
s.summary = "" # TODO: summary
|
15
|
+
s.description = "" # TODO: long description
|
16
|
+
s.cert_chain = nil
|
17
|
+
s.email = Base64.decode64() # TODO: your encrypted e-mail
|
18
|
+
s.has_rdoc = true
|
19
|
+
|
20
|
+
# files
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
|
23
|
+
s.executables = Dir["bin/*"].map(&File.method(:basename))
|
24
|
+
s.default_executable = "<%= @name %>"
|
25
|
+
s.require_paths = ["lib"]
|
26
|
+
|
27
|
+
# Ruby version
|
28
|
+
s.required_ruby_version = ::Gem::Requirement.new(">= 1.9")
|
29
|
+
|
30
|
+
# runtime dependencies
|
31
|
+
# s.add_dependency "my-gem"
|
32
|
+
|
33
|
+
# development dependencies
|
34
|
+
# use gem install <%= @name %> --development if you want to install them
|
35
|
+
# s.add_development_dependency "simple-templater"
|
36
|
+
|
37
|
+
begin
|
38
|
+
require "changelog"
|
39
|
+
rescue LoadError
|
40
|
+
warn "You have to have changelog gem installed for post install message"
|
41
|
+
else
|
42
|
+
s.post_install_message = CHANGELOG.new.version_changes
|
43
|
+
end
|
44
|
+
|
45
|
+
# RubyForge
|
46
|
+
s.rubyforge_project = "<%= @name %>"
|
47
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env gem build
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# You might think this is a terrible mess and guess what, you're
|
5
|
+
# right mate! However say thanks to authors of RubyGems, not me.
|
6
|
+
eval(File.read("<%= @name %>.gemspec")).tap do |specification|
|
7
|
+
specification.version = "#{specification.version}.pre"
|
8
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# This file will be loaded automatically when the pupu helper is used
|
4
|
+
# If you don't want to load this file, use pupu :whatever, helpers: false
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(File.expand_path("lib", __FILE__))
|
7
|
+
|
8
|
+
begin
|
9
|
+
require "<%= @name %>/adapters/#{Pupu.framework}"
|
10
|
+
rescue LoadError
|
11
|
+
# If you don't have adapter file, everything should work anyway since Pupu::Helpers
|
12
|
+
# mixin is included into helper module of your framework, so we can fail silently
|
13
|
+
end
|
14
|
+
|
15
|
+
module Pupu::Helpers
|
16
|
+
include <%= @constant %>::Helpers
|
17
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
data/stubs/pupu/postprocess.rb
CHANGED
@@ -8,4 +8,12 @@ require "simple-templater/hooks/postprocess/git_repository"
|
|
8
8
|
hook do |generator, context|
|
9
9
|
# simple-templater create rango --full-name="Jakub Stastny"
|
10
10
|
generator.after Hooks::GitRepository
|
11
|
+
|
12
|
+
unless context[:ruby]
|
13
|
+
rm "init.rb"
|
14
|
+
rm "deps.rb"
|
15
|
+
rm "#{context[:name]}.gemspec"
|
16
|
+
rm "#{context[:name]}.pre.gemspec"
|
17
|
+
rm_r "lib"
|
18
|
+
end
|
11
19
|
end
|
data/stubs/pupu/setup.rb
CHANGED
@@ -10,6 +10,7 @@ require "simple-templater/hooks/preprocess/full_name"
|
|
10
10
|
# --javascripts=mootools-core,mootools-more | --no-javascripts
|
11
11
|
# --stylesheets=one,two | --no-stylesheets
|
12
12
|
# --dependencies=mootools,blueprint | --no-dependencies
|
13
|
+
# --ruby || --no-ruby
|
13
14
|
hook do |generator, context|
|
14
15
|
generator.before Hooks::FullName, Hooks::GithubUser
|
15
16
|
generator.target = "pupu-#{context[:name]}" unless generator.target.match(/^pupu-/) # this is the convention
|
@@ -22,4 +23,7 @@ hook do |generator, context|
|
|
22
23
|
unless context[:github_repository] && context[:github_repository].match(/^pupu-/)
|
23
24
|
context[:github_repository] = "pupu-#{context[:github_repository]}"
|
24
25
|
end
|
26
|
+
if context[:ruby]
|
27
|
+
context[:constant] = context[:name].camel_case
|
28
|
+
end
|
25
29
|
end
|
data/tasks.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
|
-
|
1
|
+
#!/usr/bin/env nake
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
4
|
begin
|
5
|
-
|
5
|
+
require File.expand_path("../.bundle/environment", __FILE__)
|
6
6
|
rescue LoadError
|
7
|
-
|
7
|
+
require "bundler"
|
8
|
+
Bundler.setup
|
8
9
|
end
|
9
10
|
|
10
|
-
$LOAD_PATH.unshift(File.
|
11
|
-
|
12
|
-
ENV["PATH"] = "script:#{ENV["PATH"]}"
|
11
|
+
$LOAD_PATH.unshift(File.expand_path("../lib", __FILE__))
|
13
12
|
|
14
13
|
require "pupu/version"
|
15
14
|
require "nake/tasks/gem"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pupu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
|
-
date: 2010-
|
11
|
+
date: 2010-02-24 00:00:00 +00:00
|
12
12
|
default_executable: pupu
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
@@ -364,16 +364,27 @@ files:
|
|
364
364
|
- spec/pupu/pupu_spec.rb
|
365
365
|
- spec/spec.opts
|
366
366
|
- spec/spec_helper.rb
|
367
|
+
- stubs/pupu/content/%name%.gemspec.rbt
|
368
|
+
- stubs/pupu/content/%name%.pre.gemspec.rbt
|
367
369
|
- stubs/pupu/content/.gitignore
|
368
370
|
- stubs/pupu/content/CHANGELOG
|
369
371
|
- stubs/pupu/content/LICENSE.rbt
|
370
372
|
- stubs/pupu/content/README.textile.rbt
|
371
373
|
- stubs/pupu/content/TODO.txt
|
372
374
|
- stubs/pupu/content/config.rb.rbt
|
375
|
+
- stubs/pupu/content/deps.rip
|
373
376
|
- stubs/pupu/content/images/.gitignore
|
377
|
+
- stubs/pupu/content/init.rb.rbt
|
374
378
|
- stubs/pupu/content/initializers/%name%.css
|
375
379
|
- stubs/pupu/content/initializers/%name%.js
|
376
380
|
- stubs/pupu/content/javascripts/%javascript%.js
|
381
|
+
- stubs/pupu/content/lib/%name%.rb.rbt
|
382
|
+
- stubs/pupu/content/lib/%name%/adapters/rails.rb
|
383
|
+
- stubs/pupu/content/lib/%name%/adapters/rango.rb
|
384
|
+
- stubs/pupu/content/spec/%name%/.gitignore
|
385
|
+
- stubs/pupu/content/spec/%name%_spec.rb.rbt
|
386
|
+
- stubs/pupu/content/spec/spec.opts
|
387
|
+
- stubs/pupu/content/spec/spec_helper.rb.rbt
|
377
388
|
- stubs/pupu/content/stylesheets/%stylesheet%.css
|
378
389
|
- stubs/pupu/metadata.yml
|
379
390
|
- stubs/pupu/postprocess.rb
|
@@ -383,7 +394,7 @@ has_rdoc: true
|
|
383
394
|
homepage: http://github.com/botanicus/pupu
|
384
395
|
licenses: []
|
385
396
|
|
386
|
-
post_install_message: "[\e[32mVersion 0.0.
|
397
|
+
post_install_message: "[\e[32mVersion 0.0.5\e[0m] Added if option to javascript/stylesheet, so you can use styleshett \"ie\", if: \"lt IE 8\"\n"
|
387
398
|
rdoc_options: []
|
388
399
|
|
389
400
|
require_paths:
|
@@ -396,9 +407,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
396
407
|
version:
|
397
408
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
398
409
|
requirements:
|
399
|
-
- - "
|
410
|
+
- - ">="
|
400
411
|
- !ruby/object:Gem::Version
|
401
|
-
version:
|
412
|
+
version: "0"
|
402
413
|
version:
|
403
414
|
requirements: []
|
404
415
|
|