pupu 0.0.3.pre → 0.0.3

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 CHANGED
@@ -10,3 +10,8 @@
10
10
  = Version 0.0.2
11
11
  * Rails support
12
12
  * Better documentation
13
+
14
+ = Version 0.0.3
15
+ * Bug fixes
16
+ * Refactoring
17
+ * Examples
data/README.textile CHANGED
@@ -71,7 +71,7 @@ If pupu has optional arguments, you can specify them, it will modify its behavio
71
71
 
72
72
  <pre>
73
73
  # this will include not just basic autocompleter files, but script for local requests too
74
- pupu :autocompleter, :type => "local"
74
+ pupu :autocompleter, type: "local"
75
75
  </pre>
76
76
 
77
77
  There is some helpers for getting path to pupu's files:
@@ -9,7 +9,7 @@ load "pupu/tasks/pupu.rake"
9
9
  # Load the basic runtime dependencies; this will include
10
10
  # any plugins and therefore plugin rake tasks.
11
11
  init_env = ENV["MERB_ENV"] || "development"
12
- Merb.load_dependencies(:environment => init_env)
12
+ Merb.load_dependencies(environment: init_env)
13
13
 
14
14
  # Get Merb plugins and dependencies
15
15
  Merb::Plugins.rakefiles.each { |r| require r }
@@ -21,10 +21,10 @@ rake_files.each{|rake_file| load rake_file }
21
21
 
22
22
  desc "Start runner environment"
23
23
  task :merb_env do
24
- Merb.start_environment(:environment => init_env, :adapter => "runner")
24
+ Merb.start_environment(environment: init_env, adapter: "runner")
25
25
  end
26
26
 
27
27
  require "spec/rake/spectask"
28
28
  require "merb-core/test/tasks/spectasks"
29
29
  desc "Default: run spec examples"
30
- task :default => "spec"
30
+ task default: "spec"
@@ -1,7 +1,7 @@
1
1
  Merb::Config[:framework] = {
2
- :application => Merb.root / "application.rb",
3
- :config => [Merb.root / "config", nil],
4
- :public => [Merb.root / "public", nil],
5
- :view => Merb.root / "views"
2
+ application: Merb.root / "application.rb",
3
+ config: [Merb.root / "config", nil],
4
+ public: [Merb.root / "public", nil],
5
+ view: Merb.root / "views"
6
6
  }
7
7
 
@@ -19,8 +19,8 @@ h2. Layout
19
19
  plugin :autocompleter
20
20
 
21
21
  # for local requests through Autocompleter.Request class
22
- plugin :autocompleter, :type => "local"
22
+ plugin :autocompleter, type: "local"
23
23
 
24
24
  # for ajax requests through Autocompleter.Request class
25
- plugin :autocompleter, :type => "request"
25
+ plugin :autocompleter, type: "request"
26
26
  </pre>
@@ -7,6 +7,6 @@ javascripts "observer", "autocompleter"
7
7
  # stylesheet
8
8
  stylesheet "autocompleter"
9
9
 
10
- parameter :type, :optional => ["local", "request"] do |type|
10
+ parameter :type, optional: ["local", "request"] do |type|
11
11
  javascript "autocompleter.#{type}"
12
12
  end
@@ -1,18 +1,18 @@
1
- # css_include_tag "blueprint/screen", "blueprint/plugins/fancy-type/screen", :media => "screen, projection"
2
- # css_include_tag "blueprint/print", :media => "print"
1
+ # css_include_tag "blueprint/screen", "blueprint/plugins/fancy-type/screen", media: "screen, projection"
2
+ # css_include_tag "blueprint/print", media: "print"
3
3
  # / [if IE]
4
- # = css_include_tag "blueprint/ie", :media => "screen, projection"
4
+ # = css_include_tag "blueprint/ie", media: "screen, projection"
5
5
 
6
6
  # TODO
7
- # :if => "ie"
8
- stylesheet "screen", :media => "screen, projection"
9
- stylesheet "print", :media => "print"
7
+ # if: "ie"
8
+ stylesheet "screen", media: "screen, projection"
9
+ stylesheet "print", media: "print"
10
10
  stylesheet "ie"
11
11
 
12
12
  # parameters of plugin
13
13
  # it will be blank in most cases
14
14
  parameter :plugins do |plugins|
15
15
  plugins.each do |plugin|
16
- stylesheet "plugins/#{plugin}/screen", :media => "screen, projection"
16
+ stylesheet "plugins/#{plugin}/screen", media: "screen, projection"
17
17
  end
18
18
  end
@@ -6,6 +6,6 @@ javascript "flash"
6
6
 
7
7
  # parameters of plugin
8
8
  # it will be blank in most cases
9
- #parameter :request, :optional => ["local", "ajax"] do |type|
9
+ #parameter :request, optional: ["local", "ajax"] do |type|
10
10
  # javascript "lib/autocompleter.#{type}"
11
11
  #end
@@ -10,11 +10,11 @@ themes = Dir["#{root}/stylesheets/Flame.*.css"].map { |theme| File.basename(th
10
10
  syntaxes = Dir["#{root}/javascripts/Fuel.*.js"].map { |theme| File.basename(theme).split(".")[1] }
11
11
 
12
12
  # pupu :lighter, theme: "mocha"
13
- parameter :theme, :optional => themes do |theme|
13
+ parameter :theme, optional: themes do |theme|
14
14
  stylesheet "Flame.#{theme}"
15
15
  end
16
16
 
17
17
  # pupu :lighter, syntax: "ruby"
18
- parameter :syntax, :optional => syntaxes do |syntax|
18
+ parameter :syntax, optional: syntaxes do |syntax|
19
19
  javascript "Fuel.#{syntax}"
20
20
  end
@@ -15,5 +15,5 @@ h2. Layout
15
15
  plugin :mootools
16
16
 
17
17
  # for mootools-more
18
- plugin :mootools, :more => true
18
+ plugin :mootools, more: true
19
19
  </pre>
@@ -2,7 +2,7 @@
2
2
  javascript "mootools-1.2-core"
3
3
 
4
4
  # parameters of plugin
5
- # pupu :mootools, :more => true
5
+ # pupu :mootools, more: true
6
6
  parameter :more do |boolean|
7
7
  javascript "mootools-1.2-more" if boolean
8
8
  end
@@ -19,8 +19,8 @@ h2. Layout
19
19
  plugin :autocompleter
20
20
 
21
21
  # for local requests through Autocompleter.Request class
22
- plugin :autocompleter, :type => "local"
22
+ plugin :autocompleter, type: "local"
23
23
 
24
24
  # for ajax requests through Autocompleter.Request class
25
- plugin :autocompleter, :type => "request"
25
+ plugin :autocompleter, type: "request"
26
26
  </pre>
@@ -7,6 +7,6 @@ javascripts "observer", "autocompleter"
7
7
  # stylesheet
8
8
  stylesheet "autocompleter"
9
9
 
10
- parameter :type, :optional => ["local", "request"] do |type|
10
+ parameter :type, optional: ["local", "request"] do |type|
11
11
  javascript "autocompleter.#{type}"
12
12
  end
@@ -1,18 +1,18 @@
1
- # css_include_tag "blueprint/screen", "blueprint/plugins/fancy-type/screen", :media => "screen, projection"
2
- # css_include_tag "blueprint/print", :media => "print"
1
+ # css_include_tag "blueprint/screen", "blueprint/plugins/fancy-type/screen", media: "screen, projection"
2
+ # css_include_tag "blueprint/print", media: "print"
3
3
  # / [if IE]
4
- # = css_include_tag "blueprint/ie", :media => "screen, projection"
4
+ # = css_include_tag "blueprint/ie", media: "screen, projection"
5
5
 
6
6
  # TODO
7
- # :if => "ie"
8
- stylesheet "screen", :media => "screen, projection"
9
- stylesheet "print", :media => "print"
7
+ # if: "ie"
8
+ stylesheet "screen", media: "screen, projection"
9
+ stylesheet "print", media: "print"
10
10
  stylesheet "ie"
11
11
 
12
12
  # parameters of plugin
13
13
  # it will be blank in most cases
14
14
  parameter :plugins do |plugins|
15
15
  plugins.each do |plugin|
16
- stylesheet "plugins/#{plugin}/screen", :media => "screen, projection"
16
+ stylesheet "plugins/#{plugin}/screen", media: "screen, projection"
17
17
  end
18
18
  end
@@ -6,6 +6,6 @@ javascript "flash"
6
6
 
7
7
  # parameters of plugin
8
8
  # it will be blank in most cases
9
- #parameter :request, :optional => ["local", "ajax"] do |type|
9
+ #parameter :request, optional: ["local", "ajax"] do |type|
10
10
  # javascript "lib/autocompleter.#{type}"
11
11
  #end
@@ -10,11 +10,11 @@ themes = Dir["#{root}/stylesheets/Flame.*.css"].map { |theme| File.basename(th
10
10
  syntaxes = Dir["#{root}/javascripts/Fuel.*.js"].map { |theme| File.basename(theme).split(".")[1] }
11
11
 
12
12
  # pupu :lighter, theme: "mocha"
13
- parameter :theme, :optional => themes do |theme|
13
+ parameter :theme, optional: themes do |theme|
14
14
  stylesheet "Flame.#{theme}"
15
15
  end
16
16
 
17
17
  # pupu :lighter, syntax: "ruby"
18
- parameter :syntax, :optional => syntaxes do |syntax|
18
+ parameter :syntax, optional: syntaxes do |syntax|
19
19
  javascript "Fuel.#{syntax}"
20
20
  end
@@ -15,5 +15,5 @@ h2. Layout
15
15
  plugin :mootools
16
16
 
17
17
  # for mootools-more
18
- plugin :mootools, :more => true
18
+ plugin :mootools, more: true
19
19
  </pre>
@@ -2,7 +2,7 @@
2
2
  javascript "mootools-1.2-core"
3
3
 
4
4
  # parameters of plugin
5
- # pupu :mootools, :more => true
5
+ # pupu :mootools, more: true
6
6
  parameter :more do |boolean|
7
7
  javascript "mootools-1.2-more" if boolean
8
8
  end
data/lib/pupu/cli.rb CHANGED
@@ -47,7 +47,7 @@ module Pupu
47
47
  self.parse_argv
48
48
  self.check_setup
49
49
  note "Using media directory: #{::Pupu.media_root}"
50
- note "Using strategy: #{Pupu.strategy}"
50
+ note "Using strategy: #{::Pupu.strategy}"
51
51
  end
52
52
 
53
53
  def parse_argv
@@ -62,7 +62,7 @@ module Pupu
62
62
  elsif argument.match(/--strategy=(.+)/)
63
63
  self.args.delete(argument)
64
64
  if %[copy submodules].include?($1)
65
- Pupu.strategy = $1.to_sym
65
+ ::Pupu.strategy = $1.to_sym
66
66
  else
67
67
  abort "Available strategies: copy, submodules"
68
68
  end
@@ -76,7 +76,7 @@ module Pupu
76
76
  path ||= ["media", "public"].find { |directory| File.directory?(directory) }
77
77
  return if path.nil?
78
78
  ::Pupu.media_root = File.expand_path(path)
79
- Pupu.strategy ||= :copy
79
+ ::Pupu.strategy ||= :copy
80
80
  end
81
81
 
82
82
  def check_setup
data/lib/pupu/dsl.rb CHANGED
@@ -74,7 +74,7 @@ module Pupu
74
74
  end
75
75
  end
76
76
 
77
- # parameter :type, :optional => ["local", "request"] do |type|
77
+ # parameter :type, optional: ["local", "request"] do |type|
78
78
  # javascript "autocompleter.#{type}"
79
79
  # end
80
80
 
@@ -82,11 +82,11 @@ module Pupu
82
82
  # javascript "mootools-1.2-more" if boolean
83
83
  # end
84
84
  def parameter(name, params = Hash.new, &block)
85
- # pupu :autocompleter, :type => "request"
86
- # @pupu.params: { :type => "request" }
85
+ # pupu :autocompleter, type: "request"
86
+ # @pupu.params: { type: "request" }
87
87
 
88
- # pupu :mootools, :more => true
89
- # @pupu.params: { :more => true }
88
+ # pupu :mootools, more: true
89
+ # @pupu.params: { more: true }
90
90
  if @pupu.params.key?(name)
91
91
  block.call(@pupu.params[name])
92
92
  end
data/lib/pupu/github.rb CHANGED
@@ -32,7 +32,7 @@ module Pupu
32
32
  def update(pupu_name)
33
33
  if pupu_name
34
34
  pupu = Pupu[pupu_name]
35
- if Pupu.strategy.eql?(:submodules)
35
+ if ::Pupu.strategy.eql?(:submodules)
36
36
  puts %(git fetch)
37
37
  puts %(git reset origin/master --hard)
38
38
  else
@@ -63,7 +63,7 @@ module Pupu
63
63
  revision = %x(git log | head -1).chomp.sub(/^commit /, "")
64
64
  dsl = DSL.new(pupu)
65
65
  dependencies = dsl.get_dependencies.map { |dependency| dependency.name }
66
- params = {:revision => revision, :repozitory => url, :dependencies => dependencies}
66
+ params = {revision: revision, repozitory: url, dependencies: dependencies}
67
67
  Dir.chdir(@pupu.root.to_s) do
68
68
  File.open("metadata.yml", "w") do |file|
69
69
  file.puts(params.to_yaml)
@@ -104,7 +104,7 @@ module Pupu
104
104
  end
105
105
  @pupu = Pupu[repo]
106
106
  self.save_metadata(@pupu, url)
107
- FileUtils.rm_r(".git") if Pupu.strategy.eql?(:copy)
107
+ FileUtils.rm_r(".git") if ::Pupu.strategy.eql?(:copy)
108
108
  rescue Exception => exception
109
109
  FileUtils.rm_r(repo) if File.directory?(repo)
110
110
  raise exception
data/lib/pupu/helpers.rb CHANGED
@@ -3,7 +3,7 @@ require "pupu/parser"
3
3
  module Pupu
4
4
  module Helpers
5
5
  # Use it in your layout
6
- # Example: pupu :autocompleter, :type => "local"
6
+ # Example: pupu :autocompleter, type: "local"
7
7
  def pupu(name, params = Hash.new)
8
8
  comment = if params.empty? then "<!-- Pupu #{name} without params -->"
9
9
  else "<!-- Pupu #{name} with params #{params.inspect} -->" end
data/lib/pupu/parser.rb CHANGED
@@ -13,7 +13,7 @@ module Pupu
13
13
 
14
14
  def loaded?
15
15
  # The reason why just array with plugin names isn't enough is that every time it can be called
16
- # with different parameters. For example pupu :mootools and then pupu :mootools, :more => true
16
+ # with different parameters. For example pupu :mootools and then pupu :mootools, more: true
17
17
  @@loaded[@plugin.name] && @dsl.files.all? do |file|
18
18
  @@loaded[@plugin.name].include?(file)
19
19
  end
data/lib/pupu/pupu.rb CHANGED
@@ -7,27 +7,42 @@ require "pupu/metadata"
7
7
 
8
8
  module Pupu
9
9
  # this must be set in adapters
10
- class << self
11
- attr_accessor :root
10
+ def self.root
11
+ @@root ||= Dir.pwd
12
+ end
12
13
 
13
- # @example Pupu.media_prefix("media").url
14
- # => "/media/pupu/autocompleter/javascripts/autocompleter.js"
15
- def media_prefix=(prefix)
16
- MediaPath.rewrite { |path| File.join(prefix, path) }
17
- end
14
+ def self.root=(path)
15
+ @@root = path
16
+ end
18
17
 
19
- # TODO: media_root or media_root?
20
- def media_root=(path)
21
- MediaPath.media_root = path
22
- @media_root = path
23
- end
24
- attr_reader :media_root
18
+ # @example Pupu.media_prefix("media").url
19
+ # => "/media/pupu/autocompleter/javascripts/autocompleter.js"
20
+ def self.media_prefix=(prefix)
21
+ MediaPath.rewrite { |path| File.join(prefix, path) }
22
+ end
25
23
 
26
- # @example Pupu.rewrite { |path| "http://media.domain.org/#{path}" }.url
27
- # # => "http://media.domain.org/pupu/autocompleter/javascripts/autocompleter.js"
28
- def rewrite(&block)
29
- MediaPath.rewrite(&block)
30
- end
24
+ def self.media_root
25
+ @@media_root ||= Dir.pwd
26
+ end
27
+
28
+ def self.media_root=(path)
29
+ MediaPath.media_root = path
30
+ @@media_root = path
31
+ end
32
+
33
+ # @example Pupu.rewrite { |path| "http://media.domain.org/#{path}" }.url
34
+ # # => "http://media.domain.org/pupu/autocompleter/javascripts/autocompleter.js"
35
+ def rewrite(&block)
36
+ MediaPath.rewrite(&block)
37
+ end
38
+
39
+ # strategies: submodules, copy
40
+ def self.strategy
41
+ @@strategy ||= :copy
42
+ end
43
+
44
+ def self.strategy=(strategy)
45
+ @@strategy = strategy
31
46
  end
32
47
 
33
48
  class Pupu
@@ -44,9 +59,6 @@ module Pupu
44
59
  File.join(::Pupu.media_root, "pupu")
45
60
  end
46
61
 
47
- # strategies: submodules, copy
48
- cattr_accessor :strategy
49
-
50
62
  def root
51
63
  # TODO: it should be configurable
52
64
  # root = ::Pupu.root.sub(%r[#{Regexp::quote(::Pupu.root)}], '').chomp("/")
data/pupu.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env gem1.9 build
1
+ #!/usr/bin/env gem build
2
2
  # encoding: utf-8
3
3
 
4
4
  require "base64"
@@ -30,6 +30,14 @@ Gem::Specification.new do |s|
30
30
  # use gem install pupu --development if you want to install them
31
31
  s.add_development_dependency "simple-templater"
32
32
 
33
+ begin
34
+ require "changelog"
35
+ rescue LoadError
36
+ warn "You have to have changelog gem installed for post install message"
37
+ else
38
+ s.post_install_message = CHANGELOG.new.version_changes
39
+ end
40
+
33
41
  # RubyForge
34
42
  s.rubyforge_project = "pupu"
35
43
  end
@@ -19,8 +19,8 @@ h2. Layout
19
19
  plugin :autocompleter
20
20
 
21
21
  # for local requests through Autocompleter.Request class
22
- plugin :autocompleter, :type => "local"
22
+ plugin :autocompleter, type: "local"
23
23
 
24
24
  # for ajax requests through Autocompleter.Request class
25
- plugin :autocompleter, :type => "request"
25
+ plugin :autocompleter, type: "request"
26
26
  </pre>
@@ -7,6 +7,6 @@ javascripts "observer", "autocompleter"
7
7
  # stylesheet
8
8
  stylesheet "autocompleter"
9
9
 
10
- parameter :type, :optional => ["local", "request"] do |type|
10
+ parameter :type, optional: ["local", "request"] do |type|
11
11
  javascript "autocompleter.#{type}"
12
12
  end
@@ -13,7 +13,7 @@ describe Pupu::GitHub do
13
13
  end
14
14
 
15
15
  it "should return nil if plugin do not exists" do
16
- plugin(:autocompleter, :request => "local")
16
+ plugin(:autocompleter, request: "local")
17
17
  end
18
18
  end
19
19
  end
@@ -13,6 +13,6 @@ describe "Helpers#pupu" do
13
13
  end
14
14
 
15
15
  it "should return text with assets" do
16
- pupu(:autocompleter, :type => "local").should eql(Parser.new(:autocompleter, :type => "local").parse!)
16
+ pupu(:autocompleter, type: "local").should eql(Parser.new(:autocompleter, type: "local").parse!)
17
17
  end
18
18
  end
@@ -13,7 +13,7 @@ describe Pupu::Parser do
13
13
  end
14
14
 
15
15
  it "should return nil if plugin do not exists" do
16
- plugin(:autocompleter, :request => "local")
16
+ plugin(:autocompleter, request: "local")
17
17
  end
18
18
  end
19
19
  end
@@ -17,6 +17,6 @@ stylesheet "<%= stylesheet %>"
17
17
 
18
18
  # parameters of plugin
19
19
  # it will be blank in most cases
20
- #parameter :request, :optional => ["local", "ajax"] do |type|
20
+ #parameter :request, optional: ["local", "ajax"] do |type|
21
21
  # javascript "lib/autocompleter.#{type}"
22
22
  #end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pupu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.pre
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"
@@ -337,7 +337,9 @@ has_rdoc: true
337
337
  homepage: http://github.com/botanicus/pupu
338
338
  licenses: []
339
339
 
340
- post_install_message:
340
+ post_install_message: "[\e[32mVersion 0.0.3\e[0m] Bug fixes\n\
341
+ [\e[32mVersion 0.0.3\e[0m] Refactoring\n\
342
+ [\e[32mVersion 0.0.3\e[0m] Examples\n"
341
343
  rdoc_options: []
342
344
 
343
345
  require_paths:
@@ -350,9 +352,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
350
352
  version:
351
353
  required_rubygems_version: !ruby/object:Gem::Requirement
352
354
  requirements:
353
- - - ">"
355
+ - - ">="
354
356
  - !ruby/object:Gem::Version
355
- version: 1.3.1
357
+ version: "0"
356
358
  version:
357
359
  requirements: []
358
360