pupu 0.0.5.5 → 0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. data/CHANGELOG +0 -16
  2. data/LICENSE +1 -1
  3. data/README.textile +3 -3
  4. data/Rakefile +28 -0
  5. data/TODO.txt +3 -8
  6. data/bin/pupu +24 -19
  7. data/examples/merb/README.textile +5 -3
  8. data/examples/merb/Rakefile +3 -3
  9. data/examples/merb/config/framework.rb +4 -4
  10. data/examples/merb/config/init.rb +0 -7
  11. data/examples/merb/public/pupu/autocompleter/README.textile +2 -2
  12. data/examples/merb/public/pupu/autocompleter/config.rb +1 -1
  13. data/examples/merb/public/pupu/blueprint/config.rb +7 -7
  14. data/examples/merb/public/pupu/flash/config.rb +1 -1
  15. data/examples/merb/public/pupu/lighter/config.rb +2 -2
  16. data/examples/merb/public/pupu/mootools/README.textile +1 -1
  17. data/examples/merb/public/pupu/mootools/config.rb +1 -1
  18. data/examples/rango/README.textile +6 -4
  19. data/examples/rango/init.rb +0 -7
  20. data/examples/rango/media/pupu/autocompleter/README.textile +2 -2
  21. data/examples/rango/media/pupu/autocompleter/config.rb +1 -1
  22. data/examples/rango/media/pupu/blueprint/config.rb +7 -7
  23. data/examples/rango/media/pupu/flash/config.rb +1 -1
  24. data/examples/rango/media/pupu/lighter/config.rb +2 -2
  25. data/examples/rango/media/pupu/mootools/README.textile +1 -1
  26. data/examples/rango/media/pupu/mootools/config.rb +1 -1
  27. data/lib/pupu.rb +1 -2
  28. data/lib/pupu/adapters/merb.rb +0 -12
  29. data/lib/pupu/adapters/rails.rb +0 -12
  30. data/lib/pupu/adapters/rango.rb +3 -25
  31. data/lib/pupu/cli.rb +11 -13
  32. data/lib/pupu/dsl.rb +13 -34
  33. data/lib/pupu/exceptions.rb +0 -2
  34. data/lib/pupu/github.rb +11 -23
  35. data/lib/pupu/helpers.rb +2 -8
  36. data/lib/pupu/metadata.rb +0 -2
  37. data/lib/pupu/parser.rb +4 -19
  38. data/lib/pupu/pupu.rb +21 -47
  39. data/lib/pupu/version.rb +3 -1
  40. data/pupu.gemspec +7 -15
  41. data/pupu.pre.gemspec +33 -5
  42. data/script/spec +14 -0
  43. data/spec/data/public/pupu/autocompleter/README.textile +2 -2
  44. data/spec/data/public/pupu/autocompleter/config.rb +1 -3
  45. data/{examples/merb/public/pupu/lighter/images/.gitignore → spec/pupu/adapters/merb_spec.rb} +0 -0
  46. data/{examples/rails/app/views/examples/arguments.html.erb → spec/pupu/adapters/rango_spec.rb} +0 -0
  47. data/spec/pupu/dsl_spec.rb +0 -3
  48. data/spec/pupu/exceptions_spec.rb +0 -3
  49. data/spec/pupu/github_spec.rb +1 -4
  50. data/spec/pupu/helpers_spec.rb +2 -5
  51. data/spec/pupu/metadata_spec.rb +0 -3
  52. data/spec/pupu/parser_spec.rb +1 -4
  53. data/spec/pupu/pupu_spec.rb +0 -3
  54. data/stubs/pupu/content/config.rb.rbt +1 -3
  55. data/stubs/pupu/postprocess.rb +0 -8
  56. data/stubs/pupu/setup.rb +0 -4
  57. data/tasks/benchmark.rake +11 -0
  58. data/tasks/gem.rake +23 -0
  59. data/tasks/hooks.rake +12 -0
  60. data/tasks/release.rake +68 -0
  61. data/tasks/spec.rake +27 -0
  62. data/tasks/submodules.rake +33 -0
  63. data/tasks/yardoc.rake +9 -0
  64. metadata +199 -290
  65. data/.gitignore +0 -9
  66. data/Gemfile +0 -9
  67. data/examples/merb/.gitignore +0 -17
  68. data/examples/merb/Gemfile +0 -27
  69. data/examples/merb/public/pupu/autocompleter/.gitignore +0 -5
  70. data/examples/merb/public/pupu/blueprint/.gitignore +0 -5
  71. data/examples/merb/public/pupu/flash/.gitignore +0 -5
  72. data/examples/merb/public/pupu/lighter/.gitignore +0 -10
  73. data/examples/merb/public/pupu/mootools/.gitignore +0 -5
  74. data/examples/rails/.gitignore +0 -7
  75. data/examples/rails/Gemfile +0 -28
  76. data/examples/rails/README.textile +0 -5
  77. data/examples/rails/Rakefile +0 -10
  78. data/examples/rails/app/controllers/application_controller.rb +0 -10
  79. data/examples/rails/app/controllers/home_controller.rb +0 -8
  80. data/examples/rails/app/helpers/application_helper.rb +0 -3
  81. data/examples/rails/app/views/examples/dependencies.html.erb +0 -0
  82. data/examples/rails/app/views/examples/simple.html.erb +0 -4
  83. data/examples/rails/app/views/index.html.erb +0 -7
  84. data/examples/rails/app/views/layout.html.erb +0 -12
  85. data/examples/rails/config/boot.rb +0 -110
  86. data/examples/rails/config/environment.rb +0 -55
  87. data/examples/rails/config/environments/development.rb +0 -17
  88. data/examples/rails/config/environments/production.rb +0 -28
  89. data/examples/rails/config/environments/test.rb +0 -28
  90. data/examples/rails/config/initializers/backtrace_silencers.rb +0 -7
  91. data/examples/rails/config/initializers/inflections.rb +0 -10
  92. data/examples/rails/config/initializers/mime_types.rb +0 -5
  93. data/examples/rails/config/initializers/new_rails_defaults.rb +0 -21
  94. data/examples/rails/config/initializers/session_store.rb +0 -15
  95. data/examples/rails/config/routes.rb +0 -43
  96. data/examples/rails/db/seeds.rb +0 -7
  97. data/examples/rails/public/404.html +0 -30
  98. data/examples/rails/public/422.html +0 -30
  99. data/examples/rails/public/500.html +0 -30
  100. data/examples/rails/public/favicon.ico +0 -0
  101. data/examples/rails/public/robots.txt +0 -5
  102. data/examples/rails/script/about +0 -4
  103. data/examples/rails/script/console +0 -3
  104. data/examples/rails/script/dbconsole +0 -3
  105. data/examples/rails/script/destroy +0 -3
  106. data/examples/rails/script/generate +0 -3
  107. data/examples/rails/script/performance/benchmarker +0 -3
  108. data/examples/rails/script/performance/profiler +0 -3
  109. data/examples/rails/script/plugin +0 -3
  110. data/examples/rails/script/runner +0 -3
  111. data/examples/rails/script/server +0 -3
  112. data/examples/rails/spec/application_spec.rb +0 -37
  113. data/examples/rails/spec/spec_helper.rb +0 -0
  114. data/examples/rango/.gitignore +0 -4
  115. data/examples/rango/Gemfile +0 -56
  116. data/examples/rango/media/pupu/autocompleter/.gitignore +0 -5
  117. data/examples/rango/media/pupu/blueprint/.gitignore +0 -5
  118. data/examples/rango/media/pupu/flash/.gitignore +0 -5
  119. data/examples/rango/media/pupu/lighter/.gitignore +0 -10
  120. data/examples/rango/media/pupu/lighter/images/.gitignore +0 -0
  121. data/examples/rango/media/pupu/mootools/.gitignore +0 -5
  122. data/gems/cache/media-path-0.1.2.gem +0 -0
  123. data/gems/cache/nake-0.0.8.gem +0 -0
  124. data/gems/cache/rspec-1.3.0.gem +0 -0
  125. data/gems/cache/term-ansicolor-1.0.4.gem +0 -0
  126. data/lib/pupu/tasks/pupu.nake +0 -52
  127. data/spec/data/public/pupu/autocompleter/.gitignore +0 -5
  128. data/stubs/pupu/content/%name%.gemspec.rbt +0 -47
  129. data/stubs/pupu/content/%name%.pre.gemspec.rbt +0 -8
  130. data/stubs/pupu/content/.gitignore +0 -12
  131. data/stubs/pupu/content/deps.rip +0 -5
  132. data/stubs/pupu/content/images/.gitignore +0 -0
  133. data/stubs/pupu/content/init.rb.rbt +0 -17
  134. data/stubs/pupu/content/lib/%name%.rb.rbt +0 -4
  135. data/stubs/pupu/content/lib/%name%/adapters/rails.rb +0 -0
  136. data/stubs/pupu/content/lib/%name%/adapters/rango.rb +0 -0
  137. data/stubs/pupu/content/spec/%name%/.gitignore +0 -0
  138. data/stubs/pupu/content/spec/%name%_spec.rb.rbt +0 -10
  139. data/stubs/pupu/content/spec/spec.opts +0 -5
  140. data/stubs/pupu/content/spec/spec_helper.rb.rbt +0 -7
  141. data/tasks.rb +0 -37
@@ -1,5 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
+ # NOTE: Do not edit this file manually, this
4
+ # file is regenerated by task rake version:increase
3
5
  module Pupu
4
- VERSION = "0.0.5.5"
6
+ VERSION ||= "0.0.2"
5
7
  end
@@ -1,8 +1,9 @@
1
- #!/usr/bin/env gem build
1
+ #!/usr/bin/env gem1.9 build
2
2
  # encoding: utf-8
3
3
 
4
- require "base64"
5
- require File.join(File.dirname(__FILE__), "lib/pupu/version")
4
+ # NOTE: we can't use require_relative because when we run gem build, it use eval for executing this file
5
+ $:.unshift File.join(File.dirname(__FILE__), "lib")
6
+ require "pupu/version"
6
7
 
7
8
  Gem::Specification.new do |s|
8
9
  s.name = "pupu"
@@ -12,12 +13,11 @@ Gem::Specification.new do |s|
12
13
  s.summary = "Framework-agnostic package system for media files"
13
14
  s.description = "Pupu is a plugin system for media like mootools plugins, icon sets etc. It knows dependencies and it has CLI interface, so it's really easy to bundle such pupus into your app."
14
15
  s.cert_chain = nil
15
- s.email = Base64.decode64("c3Rhc3RueUAxMDFpZGVhcy5jeg==\n")
16
+ s.email = ["knava.bestvinensis", "gmail.com"].join("@")
16
17
 
17
18
  # files
18
- s.files = `git ls-files`.split("\n")
19
-
20
- s.executables = Dir["bin/*"].map(&File.method(:basename))
19
+ s.files = Dir.glob("**/*") - Dir.glob("pkg/*")
20
+ s.executables = ["pupu"]
21
21
  s.default_executable = "pupu"
22
22
  s.require_paths = ["lib"]
23
23
 
@@ -31,14 +31,6 @@ Gem::Specification.new do |s|
31
31
  # use gem install pupu --development if you want to install them
32
32
  s.add_development_dependency "simple-templater"
33
33
 
34
- begin
35
- require "changelog"
36
- rescue LoadError
37
- warn "You have to have changelog gem installed for post install message"
38
- else
39
- s.post_install_message = CHANGELOG.new.version_changes
40
- end
41
-
42
34
  # RubyForge
43
35
  s.rubyforge_project = "pupu"
44
36
  end
@@ -1,8 +1,36 @@
1
- #!/usr/bin/env gem build
1
+ #!/usr/bin/env gem1.9 build
2
2
  # encoding: utf-8
3
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("pupu.gemspec")).tap do |specification|
7
- specification.version = "#{specification.version}.pre"
4
+ # NOTE: we can't use require_relative because when we run gem build, it use eval for executing this file
5
+ $:.unshift File.join(File.dirname(__FILE__), "lib")
6
+ require "pupu/version"
7
+
8
+ Gem::Specification.new do |s|
9
+ s.name = "pupu"
10
+ s.version = '0.1.pre'
11
+ s.authors = ["Jakub Šťastný aka Botanicus"]
12
+ s.homepage = "http://github.com/botanicus/pupu"
13
+ s.summary = "Framework-agnostic package system for media files"
14
+ s.description = "Pupu is a plugin system for media like mootools plugins, icon sets etc. It knows dependencies and it has CLI interface, so it's really easy to bundle such pupus into your app."
15
+ s.cert_chain = nil
16
+ s.email = ["knava.bestvinensis", "gmail.com"].join("@")
17
+
18
+ # files
19
+ s.files = Dir.glob("**/*") - Dir.glob("pkg/*")
20
+ s.executables = ["pupu"]
21
+ s.default_executable = "pupu"
22
+ s.require_paths = ["lib"]
23
+
24
+ # Ruby version
25
+ s.required_ruby_version = ::Gem::Requirement.new("~> 1.9.1")
26
+
27
+ # runtime dependencies
28
+ s.add_dependency "media-path"
29
+
30
+ # development dependencies
31
+ # use gem install pupu --development if you want to install them
32
+ s.add_development_dependency "simple-templater"
33
+
34
+ # RubyForge
35
+ s.rubyforge_project = "pupu"
8
36
  end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby1.9
2
+ # encoding: utf-8
3
+
4
+ Dir[File.join(File.dirname(__FILE__), "..", "vendor", "*")].each do |path|
5
+ if File.directory?(path) && Dir["#{path}/*"].empty?
6
+ warn "Dependency #{File.basename(path)} in vendor seems to be empty. Run git submodule init && git submodule update to checkout it."
7
+ elsif File.directory?(path) && File.directory?(File.join(path, "lib"))
8
+ $:.unshift File.join(path, "lib")
9
+ end
10
+ end
11
+
12
+ ARGV.push("spec") if ARGV.empty?
13
+
14
+ load File.expand_path(File.join(File.dirname(__FILE__), "..", "vendor", "rspec", "bin", "spec"))
@@ -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>
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # autocompleter depends on mootools
4
2
  dependencies :mootools
5
3
 
@@ -9,6 +7,6 @@ javascripts "observer", "autocompleter"
9
7
  # stylesheet
10
8
  stylesheet "autocompleter"
11
9
 
12
- parameter :type, optional: ["local", "request"] do |type|
10
+ parameter :type, :optional => ["local", "request"] do |type|
13
11
  javascript "autocompleter.#{type}"
14
12
  end
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative "../spec_helper"
4
-
5
2
  require "pupu/dsl"
6
3
  require "pupu/pupu"
7
4
 
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative "../spec_helper"
4
-
5
2
  require "pupu/exceptions"
6
3
 
7
4
  describe Pupu::PupuRootNotFound do
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative "../spec_helper"
4
-
5
2
  require "pupu/github"
6
3
 
7
4
  # TODO
@@ -16,7 +13,7 @@ describe Pupu::GitHub do
16
13
  end
17
14
 
18
15
  it "should return nil if plugin do not exists" do
19
- plugin(:autocompleter, request: "local")
16
+ plugin(:autocompleter, :request => "local")
20
17
  end
21
18
  end
22
19
  end
@@ -1,12 +1,9 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative "../spec_helper"
4
-
5
2
  require "pupu/pupu"
6
3
  require "pupu/helpers"
4
+ include Pupu::Helpers
7
5
 
8
6
  describe "Helpers#pupu" do
9
- include Pupu::Helpers
10
7
  before(:each) do
11
8
  Pupu.root = File.dirname(__FILE__) + "/data/root/pupu"
12
9
  end
@@ -16,6 +13,6 @@ describe "Helpers#pupu" do
16
13
  end
17
14
 
18
15
  it "should return text with assets" do
19
- 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!)
20
17
  end
21
18
  end
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative "../spec_helper"
4
-
5
2
  require "pupu/metadata"
6
3
 
7
4
  describe Pupu do
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative "../spec_helper"
4
-
5
2
  require "pupu/parser"
6
3
 
7
4
  # TODO
@@ -16,7 +13,7 @@ describe Pupu::Parser do
16
13
  end
17
14
 
18
15
  it "should return nil if plugin do not exists" do
19
- plugin(:autocompleter, request: "local")
16
+ plugin(:autocompleter, :request => "local")
20
17
  end
21
18
  end
22
19
  end
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative "../spec_helper"
4
-
5
2
  require "pupu/pupu"
6
3
 
7
4
  describe Pupu::Pupu do
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # dependencies of the pupu
4
2
  <% @dependencies.each do |dependency| %>
5
3
  dependency :<%= dependency %>
@@ -17,6 +15,6 @@ stylesheet "<%= stylesheet %>"
17
15
 
18
16
  # parameters of plugin
19
17
  # it will be blank in most cases
20
- #parameter :request, optional: ["local", "ajax"] do |type|
18
+ #parameter :request, :optional => ["local", "ajax"] do |type|
21
19
  # javascript "lib/autocompleter.#{type}"
22
20
  #end
@@ -8,12 +8,4 @@ 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
19
11
  end
@@ -10,7 +10,6 @@ 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
14
13
  hook do |generator, context|
15
14
  generator.before Hooks::FullName, Hooks::GithubUser
16
15
  generator.target = "pupu-#{context[:name]}" unless generator.target.match(/^pupu-/) # this is the convention
@@ -23,7 +22,4 @@ hook do |generator, context|
23
22
  unless context[:github_repository] && context[:github_repository].match(/^pupu-/)
24
23
  context[:github_repository] = "pupu-#{context[:github_repository]}"
25
24
  end
26
- if context[:ruby]
27
- context[:constant] = context[:name].camel_case
28
- end
29
25
  end
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ # http://github.com/somebee/rbench/tree/master
4
+ desc "Run all benchmarks"
5
+ task :bm do
6
+ abort "Benchmarks doesn't work at the moment"
7
+ require "rbench"
8
+ Dir["#{Dir.pwd}/benchmarks/bm/*.rb"].each do |benchmark|
9
+ load benchmark
10
+ end
11
+ end
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+
3
+ desc "Build the gem"
4
+ task :build do
5
+ sh "gem build pupu.gemspec"
6
+ end
7
+
8
+ namespace :build do
9
+ desc "Build the prerelease gem"
10
+ task :prerelease do
11
+ gemspec = "pupu.gemspec"
12
+ content = File.read(gemspec)
13
+ prename = "#{gemspec.split(".").first}.pre.gemspec"
14
+ # 0.1.1 => 0.2
15
+ version = Pupu::VERSION.sub(/^(\d+)\.(\d+).*$/) { "#$1.#{$2.to_i + 1}" }
16
+ puts "Current #{Pupu::VERSION} => #{version} pre"
17
+ File.open(prename, "w") do |file|
18
+ file.puts(content.gsub(/(\w+::VERSION)/, "'#{version}.pre'"))
19
+ end
20
+ sh "gem build #{prename}"
21
+ rm prename
22
+ end
23
+ end
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ desc "Install Git hooks"
4
+ task :hooks do
5
+ if Dir.exist?(".git/hooks")
6
+ abort "You must remove .git/hooks first"
7
+ else
8
+ # do not symlink them, otherwise git will add samples
9
+ # FIXME: permissions
10
+ cp_r "support/hooks", ".git/hooks"
11
+ end
12
+ end
@@ -0,0 +1,68 @@
1
+ # encoding: utf-8
2
+
3
+ desc "Release new version of pupu"
4
+ task release: ["deps.rip", "version:increase", "release:tag", "release:gemcutter"]
5
+
6
+ namespace :version do
7
+ task :increase do
8
+ puts "Which version are you just releasing (previous version is #{Pupu::VERSION})"
9
+ version = STDIN.gets.chomp
10
+ File.open("lib/pupu/version.rb", "w") do |file|
11
+ file.puts <<-EOF
12
+ # encoding: utf-8
13
+
14
+ # NOTE: Do not edit this file manually, this
15
+ # file is regenerated by task rake version:increase
16
+ module Pupu
17
+ VERSION ||= "#{version}"
18
+ end
19
+ EOF
20
+ end
21
+
22
+ Pupu.const_set("VERSION", version) # so other release tasks will work
23
+ sh "git commit lib/pupu/version.rb -m 'Increased version to #{version}'"
24
+ end
25
+ end
26
+
27
+ namespace :release do
28
+ desc "Create Git tag"
29
+ task :tag do
30
+ puts "Creating new git tag #{Pupu::VERSION} and pushing it online ..."
31
+ sh "git tag -a -m 'Version #{Pupu::VERSION}' #{Pupu::VERSION}"
32
+ sh "git push --tags"
33
+ puts "Tag #{Pupu::VERSION} was created and pushed to GitHub."
34
+ end
35
+
36
+ desc "Push gem to Gemcutter"
37
+ task :gemcutter => :build do
38
+ puts "Pushing to Gemcutter ..."
39
+ sh "gem push #{Dir["*.gem"].last}"
40
+ end
41
+ end
42
+
43
+ desc "Create and push prerelease gem"
44
+ task :prerelease => "build:prerelease" do
45
+ puts "Pushing to Gemcutter ..."
46
+ sh "gem push #{Dir["*.pre.gem"].last}"
47
+ end
48
+
49
+ dependencies = FileList["vendor/*/.git"].sub(/\/\.git$/, "")
50
+
51
+ desc "Regenerate deps.rip"
52
+ file "deps.rip" => dependencies do
53
+ commits = Hash.new
54
+ commits = dependencies.inject(Hash.new) do |hash, path|
55
+ Dir.chdir(path) do
56
+ revision = %x(git show | head -1).chomp.sub("commit ", "")
57
+ hash[File.basename(path)] = revision
58
+ hash
59
+ end
60
+ end
61
+ template = File.read("deps.rip.rbe")
62
+ deps_rip = eval("%Q{#{template}}")
63
+ File.open("deps.rip", "w") do |file|
64
+ file.puts(deps_rip)
65
+ end
66
+ sh "chmod +x deps.rip"
67
+ sh "git commit deps.rip -m 'Updated deps.rip'"
68
+ end
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+
3
+ desc "Run specs"
4
+ task :spec, :path do |task, args|
5
+ exec "./script/spec --options spec/spec.opts #{args.path || "spec"}"
6
+ end
7
+
8
+ desc "Create stubs of all library files."
9
+ task "spec:stubs" do
10
+ Dir.glob("lib/**/*.rb").each do |file|
11
+ specfile = file.sub(/^lib/, "spec").sub(/\.rb$/, '_spec.rb')
12
+ unless File.exist?(specfile)
13
+ %x[mkdir -p #{File.dirname(specfile)}]
14
+ %x[touch #{specfile}]
15
+ puts "Created #{specfile}"
16
+ end
17
+ end
18
+ (Dir.glob("spec/pupu/**/*.rb") + ["spec/pupu_spec.rb"]).each do |file|
19
+ libfile = file.sub(/spec/, "lib").sub(/_spec\.rb$/, '.rb')
20
+ if !File.exist?(libfile) && File.zero?(file)
21
+ %x[rm #{file}]
22
+ puts "Removed empty file #{file}"
23
+ elsif !File.exist?(libfile)
24
+ puts "File exists just in spec, not in lib: #{file}"
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ # === Helpers === #
4
+ def submodules(&block)
5
+ File.foreach(File.join(File.dirname(__FILE__), "..", ".gitmodules")) do |line|
6
+ if line.match(%r{submodule "(.+)"})
7
+ block.call($1)
8
+ end
9
+ end
10
+ end
11
+
12
+ # === Tasks === #
13
+ namespace :submodules do
14
+ desc "Init submodules"
15
+ task :init do
16
+ sh "git submodule init"
17
+ end
18
+
19
+ desc "Update submodules"
20
+ task :update do
21
+ submodules do |path|
22
+ if File.directory?(path) && File.directory?(File.join(path, ".git"))
23
+ Dir.chdir(path) do
24
+ puts "=> #{path}"
25
+ sh "git reset --hard"
26
+ sh "git fetch"
27
+ sh "git reset origin/master --hard"
28
+ puts
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end