seedling 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,10 +6,10 @@ begin; require 'rubygems'; rescue LoadError; end
6
6
 
7
7
  require 'rake'
8
8
  require 'rake/clean'
9
- require 'rake/gempackagetask'
9
+ require 'rubygems/package_task'
10
10
  require 'time'
11
11
  require 'date'
12
- require "lib/seedling"
12
+ require "./lib/seedling"
13
13
 
14
14
  PROJECT_SPECS = FileList[
15
15
  'spec/**/*.rb'
@@ -1,15 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ require "pathname"
4
+
2
5
  begin
3
- require "pathname"
4
- local_seedling = Pathname.new(__FILE__).expand_path.dirname.join("..", "lib", "seedling.rb")
6
+ file = Pathname(__FILE__)
7
+ file = file.readlink if file.symlink?
8
+ local_seedling = file.join('../../lib/seedling.rb').expand_path
9
+
5
10
  if local_seedling.file?
6
11
  require local_seedling
7
12
  else
8
13
  require "seedling"
9
14
  end
15
+
10
16
  require "seedling/bin"
11
17
  rescue LoadError
12
18
  require "rubygems"
13
19
  require "seedling/bin"
14
20
  end
21
+
15
22
  Seedling::Bin::Cmd.run(ARGV)
@@ -157,7 +157,7 @@ module Seedling
157
157
  raise "plant_defaults requires a :lib_name in the calling argument" unless o[:lib_name]
158
158
  o[:lib_name_u] = o[:lib_name].underscore
159
159
  [:author_name, :author_email].each do |opt|
160
- o[opt] = self.send(opt)
160
+ o[opt] ||= self.send(opt)
161
161
  end
162
162
  o[:summary] ||= "The #{o[:lib_name].classify.titleize} library, by #{o[:author_name]}"
163
163
  o[:description] ||= o[:summary]
@@ -143,7 +143,7 @@ module Seedling
143
143
  end
144
144
 
145
145
  def each
146
- Dir["#{proto}/**/*"].each{|path| yield(path) }
146
+ Dir["#{proto}/**/{*,.*}"].each{|path| yield(path) }
147
147
  end
148
148
 
149
149
  include Enumerable
@@ -1,3 +1,3 @@
1
1
  module Seedling
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -0,0 +1,5 @@
1
+ # Place list of gems here with versions
2
+ # We need innate for traiting/options,
3
+ # and bacon for specs
4
+ innate -v 2012.03
5
+ bacon -v 1.1.0
@@ -0,0 +1,2 @@
1
+ rvm --install --create use 1.9.3@<%= @options[:lib_name_u] %>
2
+ [[ -s .gems ]] && rvm gemset import .gems
@@ -2,13 +2,13 @@ begin; require 'rubygems'; rescue LoadError; end
2
2
 
3
3
  require 'rake'
4
4
  require 'rake/clean'
5
- require 'rake/gempackagetask'
5
+ require 'rubygems/package_task'
6
6
  require 'time'
7
7
  require 'date'
8
- require "lib/<%= @options[:lib_name_u] %>"
8
+ require_relative "./lib/<%= @options[:lib_name_u] %>"
9
9
 
10
10
  PROJECT_SPECS = FileList[
11
- 'spec/**/*.rb'
11
+ 'spec/*/**/*.rb'
12
12
  ]
13
13
 
14
14
  PROJECT_MODULE = '<%= @options[:lib_name] %>'
@@ -40,30 +40,38 @@ PROJECT_COPYRIGHT = PROJECT_COPYRIGHT_SUMMARY + [
40
40
  "# THE SOFTWARE."
41
41
  ]
42
42
 
43
+ <%= @options[:lib_name] %>_VERSION =
44
+ if version = ENV['PROJECT_VERSION'] || ENV['VERSION']
45
+ version
46
+ else
47
+ <%= @options[:lib_name] %>::VERSION rescue Date.today.strftime("%Y.%m.%d")
48
+ end
43
49
 
44
50
  # To release the monthly version do:
45
- # $ PROJECT_VERSION=2009.03 rake release
46
- IGNORE_FILES = [/\.gitignore/]
51
+ # $ <%= @options[:lib_name] %>_VERSION=2009.03 rake release
52
+ IGNORE_FILES = [/\.git(?:ignore)?/]
53
+
54
+ PROJECT_FILES = `find . -type f`.split("\n").sort.reject { |f| IGNORE_FILES.detect { |exp| f.match(exp) } }
47
55
 
48
56
  GEMSPEC = Gem::Specification.new{|s|
49
- s.name = '<%= @options[:lib_name_u] %>'
50
- s.author = "<%= @options[:author_name] %>"
51
- s.summary = "<%= @options[:summary] %>"
52
- s.description = "<%= @options[:description] || @options[:description] %>"
53
- s.email = '<%= @options[:author_email] %>'
54
- s.homepage = '<%= @options[:project_url] %>'
57
+ s.name = <%= @options[:lib_name_u].to_s.dump %>
58
+ s.author = <%= @options[:author_name].to_s.dump %>
59
+ s.summary = <%= @options[:summary].to_s.dump %>
60
+ s.description = <%= (@options[:description] || @options[:summary]).to_s.dump %>
61
+ s.email = <%= @options[:author_email].to_s.dump %>
62
+ s.homepage = <%= @options[:project_url].to_s.dump %>
55
63
  s.platform = Gem::Platform::RUBY
56
- s.version = (ENV['PROJECT_VERSION'] || (begin;Object.const_get(PROJECT_MODULE)::VERSION;rescue;Date.today.strftime("%Y.%m.%d");end))
57
- s.files = `git ls-files`.split("\n").sort.reject { |f| IGNORE_FILES.detect { |exp| f.match(exp) } }
64
+ s.version = <%= @options[:lib_name] %>_VERSION
65
+ s.files = PROJECT_FILES
58
66
  s.has_rdoc = true
59
- s.require_path = 'lib'
60
- s.bindir = "bin"
61
- s.executables = ["<%= @options[:lib_name] %>"]
67
+ s.require_path = "lib"
68
+ s.bindir = "bin"
69
+ s.executables = [<%= @options[:lib_name_u].to_s.dump %>]
62
70
  <% if @options[:rubyforge_project] %>
63
- s.rubyforge_project = "<%= @options[:rubyforge_project] %>"
71
+ s.rubyforge_project = <%= @options[:rubyforge_project].to_s.dump %>
64
72
  <% end %>
65
73
 
66
- s.post_install_message = <<MESSAGE.strip
74
+ s.post_install_message = <<MESSAGE
67
75
  ============================================================
68
76
 
69
77
  Thank you for installing <%= @options[:lib_name] %>!
@@ -72,7 +80,7 @@ Thank you for installing <%= @options[:lib_name] %>!
72
80
  MESSAGE
73
81
  }
74
82
 
75
- Dir['tasks/*.rake'].each{|f| import(f) }
83
+ Dir.glob('tasks/*.rake'){|f| import(f) }
76
84
 
77
85
  task :default => [:bacon]
78
86
 
@@ -1,5 +1,5 @@
1
1
  require "pathname"
2
- $LOAD_PATH.unshift(File.expand_path("../", __FILE__))
2
+ require "logger"
3
3
 
4
4
  # Allows for pathnames to be easily added to
5
5
  class Pathname
@@ -9,8 +9,49 @@ class Pathname
9
9
  end
10
10
 
11
11
  # <%= @options[:summary] %>
12
+ # This sets all the globals and creates our main namespace
12
13
  module <%= @options[:lib_name] %>
13
- autoload :VERSION, "<%= @options[:lib_name_u] %>/version"
14
- ROOT = Pathname($LOAD_PATH.first) unless <%= @options[:lib_name] %>.const_defined?("ROOT")
15
- LIBDIR = ROOT/:lib unless <%= @options[:lib_name] %>.const_defined?("LIBDIR")
14
+ LIBROOT = Pathname(__FILE__).dirname.expand_path
15
+ ROOT = LIBROOT/".."
16
+ MIGRATION_ROOT = ROOT/:migrations
17
+ MODEL_ROOT = ROOT/:model
18
+ SPEC_HELPER_PATH = ROOT/:spec
19
+ autoload :VERSION, (LIBROOT/"<%= @options[:lib_name_u] %>/version").to_s
20
+ # Helper method to load models
21
+ # @model String The model you wish to load
22
+ def self.M(model)
23
+ require <%= @options[:lib_name] %>::MODEL_ROOT.join(model).to_s
24
+ end
25
+
26
+ # Helper method to load files from ROOT
27
+ # @file String The file you wish to load
28
+ def self.R(file)
29
+ require <%= @options[:lib_name] %>::ROOT.join(file).to_s
30
+ end
31
+
32
+ # Helper method to load files from lib/yrb
33
+ # @file String The file you wish to load
34
+ def self.L(file)
35
+ require (<%= @options[:lib_name] %>::LIBROOT/:<%= @options[:lib_name_u] %>).join(file).to_s
36
+ end
37
+
38
+ def self.Run(*args)
39
+ require "open3"
40
+ Open3.popen3(*args) do |sin, sout, serr|
41
+ o = Thread.new do
42
+ sout.each_line { |l| puts l.chomp }
43
+ end
44
+ e = Thread.new do
45
+ serr.each_line { |l| $stderr.puts l.chomp }
46
+ end
47
+ sin.close
48
+ o.join
49
+ e.join
50
+ end
51
+ end
52
+
16
53
  end
54
+ <%= @options[:lib_name] %>::R "options"
55
+ <%= @options[:lib_name] %>::Log = Logger.new(<%= @options[:lib_name] %>.options.logfile, 10, 10240000) unless <%= @options[:lib_name] %>.const_defined?("Log")
56
+ <%= @options[:lib_name] %>::Log.level = <%= @options[:lib_name] %>.options.log_level
57
+
@@ -0,0 +1,15 @@
1
+ require "innate"
2
+
3
+ module <%= @options[:lib_name] %>
4
+ include Innate::Optioned
5
+
6
+ options.dsl do
7
+ o "Database", :db, ENV["<%=options[:lib_name] %>_DB"] || "postgres://postgres@localhost/<%= @options[:lib_name_u] %>"
8
+
9
+ o "Logfile", :logfile, ENV["<%=options[:lib_name] %>_LOG"] || $stdout
10
+
11
+ o "Log Level", :log_level, ENV["<%=options[:lib_name] %>_LogLevel"] || Logger::INFO
12
+ end
13
+
14
+ end
15
+
@@ -17,6 +17,8 @@ task :authors do
17
17
  name, email = "Kevin Berry", "kb@rubyists.com"
18
18
  when /^(?:(?:jayson|thedonvaughn|jvaughn)$|Jayson Vaughn)/
19
19
  name, email = "Jayson Vaughn", "jv@rubyists.com"
20
+ when /^(?:rubyists@rubyists.com)/
21
+ name, email = "The Rubyists, LLC", "rubyists@rubyists.com"
20
22
  end
21
23
 
22
24
  authors[[name, email]] += count.to_i
@@ -3,6 +3,7 @@ task :bacon => :install_dependencies do
3
3
  require 'open3'
4
4
  require 'scanf'
5
5
  require 'matrix'
6
+ require 'fileutils'
6
7
 
7
8
  specs = PROJECT_SPECS
8
9
 
@@ -23,7 +24,7 @@ task :bacon => :install_dependencies do
23
24
  specs.each_with_index do |spec, idx|
24
25
  print(left_format % [idx + 1, specs_size, spec])
25
26
 
26
- Open3.popen3(RUBY, spec) do |sin, sout, serr|
27
+ Open3.popen3(FileUtils::RUBY, spec) do |sin, sout, serr|
27
28
  out = sout.read.strip
28
29
  err = serr.read.strip
29
30
 
@@ -1,4 +1,4 @@
1
- require 'rake/gempackagetask'
1
+ require 'rubygems/package_task'
2
2
 
3
3
  desc "make a gemspec"
4
4
  task :gemspec => [:manifest, :changelog, :authors] do
@@ -17,7 +17,7 @@ task :uninstall => [:clean] do
17
17
  sh %{gem uninstall -x #{GEMSPEC.name}}
18
18
  end
19
19
 
20
- Rake::GemPackageTask.new(GEMSPEC) do |p|
20
+ Gem::PackageTask.new(GEMSPEC) do |p|
21
21
  p.need_tar = true
22
22
  p.need_zip = true
23
23
  end
@@ -0,0 +1,112 @@
1
+ task :gem_setup do
2
+ class GemSetup
3
+ def initialize(options = {}, &block)
4
+ @gems = []
5
+ @options = options.dup
6
+ @verbose = @options.delete(:verbose)
7
+
8
+ run(&block)
9
+ end
10
+
11
+ def run(&block)
12
+ return unless block_given?
13
+ instance_eval(&block)
14
+ setup
15
+ end
16
+
17
+ def gem(name, version = nil, options = {})
18
+ if version.respond_to?(:merge!)
19
+ options = version
20
+ else
21
+ options[:version] = version
22
+ end
23
+
24
+ @gems << [name, options]
25
+ end
26
+
27
+ # all gems defined, let's try to load/install them
28
+ def setup
29
+ require 'rubygems'
30
+ require 'rubygems/dependency_installer'
31
+
32
+ @gems.each do |name, options|
33
+ setup_gem(name, options)
34
+ end
35
+ end
36
+
37
+ def setup_gemspec(gemspec)
38
+ gemspec.dependencies.each do |dependency|
39
+ dependency.version_requirements.as_list.each do |version|
40
+ gem(dependency.name, version)
41
+ end
42
+ end
43
+
44
+ setup
45
+ end
46
+
47
+ # First try to activate.
48
+ # If activation fails, try to install and activate again.
49
+ # If the second activation also fails, try to require as it may just as
50
+ # well be in $LOAD_PATH.
51
+ def setup_gem(name, options)
52
+ version = [options[:version]].compact
53
+ lib_name = options[:lib] || name
54
+
55
+ log "activating #{name}"
56
+
57
+ Gem.activate(name, *version)
58
+ rescue Gem::LoadError
59
+ log "activating #{name} failed, try to install"
60
+
61
+ install_gem(name, version, options)
62
+ end
63
+
64
+ # tell rubygems to install a gem
65
+ def install_gem(name, version, options)
66
+ installer = Gem::DependencyInstaller.new(options)
67
+
68
+ temp_argv(options[:extconf]) do
69
+ log "installing #{name}"
70
+ installer.install(name, *version)
71
+ end
72
+
73
+ Gem.activate(name, *version)
74
+
75
+ log "install and final activation successful"
76
+ rescue Gem::GemNotFoundException => ex
77
+ log "installation failed: #{ex}, use normal require"
78
+
79
+ require(options[:lib] || name)
80
+
81
+ log "require successful, cannot verify version though"
82
+ end
83
+
84
+ # prepare ARGV for rubygems installer
85
+ def temp_argv(extconf)
86
+ if extconf ||= @options[:extconf]
87
+ old_argv = ARGV.clone
88
+ ARGV.replace(extconf.split(' '))
89
+ end
90
+
91
+ yield
92
+
93
+ ensure
94
+ ARGV.replace(old_argv) if extconf
95
+ end
96
+
97
+ private
98
+
99
+ def log(msg)
100
+ return unless @verbose
101
+
102
+ if defined?(Log)
103
+ Log.info(msg)
104
+ else
105
+ puts(msg)
106
+ end
107
+ end
108
+
109
+ def rubyforge; 'http://gems.rubyforge.org/' end
110
+ def github; 'http://gems.github.com/' end
111
+ end
112
+ end
@@ -0,0 +1,24 @@
1
+ namespace :metric do
2
+ desc 'committed changes per file according to git'
3
+ task 'changes' do
4
+ $stdout.sync = true
5
+ out = lambda{|changes, rb| puts("%4d %s" % [changes, rb]) }
6
+ changes = {}
7
+
8
+ print 'counting changes '
9
+
10
+ Dir['lib/**/*.rb'].each do |rb|
11
+ changes = `git-log --pretty=oneline '#{rb}'`.count("\n")
12
+ print '.'
13
+ # out[changes, rb]
14
+ changes[rb] = changes
15
+ end
16
+ puts ' done.'
17
+
18
+ sorted = changes.sort_by{|r,c| c }.reverse
19
+ puts "Top 20:"
20
+ sorted.first(20).each{|(r,c)| out[c,r] }
21
+ puts "Bottom 20:"
22
+ sorted.last(20).each{|(r,c)| out[c,r] }
23
+ end
24
+ end
@@ -23,28 +23,28 @@ INSTRUCTIONS
23
23
  # TODO: Not tested
24
24
  desc 'Display instructions to release on rubyforge'
25
25
  task :rubyforge => [:reversion, :gemspec, :package] do
26
- name, version = GEMSPEC.name, GEMSPEC.version
26
+ name, version = GEMSPEC.name, GEMSPEC.version.to_s
27
27
 
28
28
  puts <<INSTRUCTIONS
29
29
  To publish to rubyforge do following:
30
30
 
31
31
  rubyforge login
32
- rubyforge add_release #{name} #{name} '#{version}' pkg/#{name}-#{version}.gem
32
+ rubyforge add_release #{name} #{name} #{version.dump} pkg/#{name}-#{version}.gem
33
33
 
34
34
  After you have done these steps, see:
35
35
 
36
- rake release:rubyforge_archives
36
+ VERSION=#{version.dump} rake release:rubyforge_archives
37
37
 
38
38
  INSTRUCTIONS
39
39
  end
40
40
 
41
41
  desc 'Display instructions to add archives after release:rubyforge'
42
42
  task :rubyforge_archives do
43
- name, version = GEMSPEC.name, GEMSPEC.version
43
+ name, version = GEMSPEC.name, GEMSPEC.version.to_s
44
44
  puts "Adding archives for distro packagers is:", ""
45
45
 
46
46
  Dir["pkg/#{name}-#{version}.{tgz,zip}"].each do |file|
47
- puts "rubyforge add_file #{name} #{name} '#{version}' '#{file}'"
47
+ puts "rubyforge add_file %s %s %p %p" % [name, name, version, file]
48
48
  end
49
49
 
50
50
  puts
@@ -0,0 +1,12 @@
1
+ desc 'install all possible dependencies'
2
+ task :setup => [:gem_setup] do
3
+ GemSetup.new :verbose => false do
4
+ DEPENDENCIES.each do |name, options|
5
+ gem(name, options)
6
+ end
7
+
8
+ DEVELOPMENT_DEPENDENCIES.each do |name, options|
9
+ gem(name, options)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,27 @@
1
+ desc "show a todolist from all the TODO tags in the source"
2
+ task :todo do
3
+ Dir.glob('{lib,spec}/**/*.rb') do |file|
4
+ lastline = todo = comment = long_comment = false
5
+
6
+ File.readlines(file).each_with_index do |line, lineno|
7
+ lineno += 1
8
+ comment = line =~ /^\s*?#.*?$/
9
+ long_comment = line =~ /^=begin/
10
+ long_comment = line =~ /^=end/
11
+ todo = true if line =~ /TODO|FIXME|THINK/ and (long_comment or comment)
12
+ todo = false if line.gsub('#', '').strip.empty?
13
+ todo = false unless comment or long_comment
14
+ if todo
15
+ unless lastline and lastline + 1 == lineno
16
+ puts
17
+ puts "vim #{file} +#{lineno}"
18
+ end
19
+
20
+ l = line.strip.gsub(/^#\s*/, '')
21
+ print ' ' unless l =~ /^-/
22
+ puts l
23
+ lastline = lineno
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ desc 'listing of available traits per class/module'
2
+ task 'traits' do
3
+ nodes = Hash.new{|h,k| h[k] = []}
4
+ Dir['lib/**/*.rb'].each do |file|
5
+ content = File.read(file)
6
+ traits = content.grep(/^\s*trait\s*:/)
7
+ traits.each do |trait|
8
+ space = content[0..content.index(trait)].scan(/^\s*(?:class|module)\s+(.*)$/)
9
+ space = space.flatten.join('::')
10
+ nodes[space] << trait.strip
11
+ end
12
+ end
13
+
14
+ nodes.each do |space, traits|
15
+ puts space
16
+ traits.each do |trait|
17
+ print ' ', trait, "\n"
18
+ end
19
+ puts
20
+ end
21
+ end
@@ -58,4 +58,11 @@ describe "Seedling Planted Tree" do
58
58
  $?.should.equal 0
59
59
  output.should.match /1 specifications \(1 requirements\), 0 failures, 0 errors/m
60
60
  end
61
+
62
+ it "Should set email properly" do
63
+ Seedling::Bin::Cmd.run(["plant", "the_tree", "-q", "--email", "foo@bar.com"])
64
+ rakelines = (@tmpdir/:the_tree/"Rakefile").readlines
65
+ rakelines.detect { |l| l.match(/\s+s.email\s+=\s+"(.*)"/) }.should.not.be.nil
66
+ $~[1].should.equal "foo@bar.com"
67
+ end
61
68
  end
@@ -2,7 +2,7 @@
2
2
  # Distributed under the terms of the MIT license.
3
3
  # See the LICENSE file that accompanied this software for the full MIT License text
4
4
  #
5
- require 'rake/gempackagetask'
5
+ require 'rubygems/package_task'
6
6
 
7
7
  desc "make a gemspec"
8
8
  task :gemspec => [:manifest, :changelog, :authors] do
@@ -21,7 +21,7 @@ task :uninstall => [:clean] do
21
21
  sh %{gem uninstall -x #{GEMSPEC.name}}
22
22
  end
23
23
 
24
- Rake::GemPackageTask.new(GEMSPEC) do |p|
24
+ Gem::PackageTask.new(GEMSPEC) do |p|
25
25
  p.need_tar = true
26
26
  p.need_zip = true
27
27
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seedling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ prerelease:
5
+ version: 0.0.6
5
6
  platform: ruby
6
7
  authors:
7
8
  - Kevin Berry
@@ -9,7 +10,7 @@ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2009-05-29 00:00:00 -05:00
13
+ date: 2014-02-27 00:00:00 -06:00
13
14
  default_executable:
14
15
  dependencies: []
15
16
 
@@ -35,24 +36,30 @@ files:
35
36
  - lib/seedling/extensions/inflector.rb
36
37
  - lib/seedling/project_creator.rb
37
38
  - lib/seedling/version.rb
39
+ - lib/templates/core/.gems
40
+ - lib/templates/core/.rvmrc.seed
38
41
  - lib/templates/core/README.seed
39
42
  - lib/templates/core/Rakefile.seed
40
43
  - lib/templates/core/lib/library.rb.seed
41
44
  - lib/templates/core/lib/library/version.rb.seed
45
+ - lib/templates/core/options.rb.seed
42
46
  - lib/templates/core/spec/helper.rb.seed
43
47
  - lib/templates/core/tasks/authors.rake
44
48
  - lib/templates/core/tasks/bacon.rake
45
49
  - lib/templates/core/tasks/changelog.rake
46
50
  - lib/templates/core/tasks/copyright.rake
47
51
  - lib/templates/core/tasks/gem.rake
48
- - lib/templates/core/tasks/gem_installer.rake
52
+ - lib/templates/core/tasks/gem_setup.rake
49
53
  - lib/templates/core/tasks/install_dependencies.rake
50
54
  - lib/templates/core/tasks/manifest.rake
55
+ - lib/templates/core/tasks/metric_changes.rake
51
56
  - lib/templates/core/tasks/rcov.rake
52
57
  - lib/templates/core/tasks/release.rake
53
58
  - lib/templates/core/tasks/reversion.rake
54
- - lib/templates/core/tasks/setup.rake.seed
59
+ - lib/templates/core/tasks/setup.rake
60
+ - lib/templates/core/tasks/todo.rake
55
61
  - lib/templates/core/tasks/yard.rake
62
+ - lib/templates/ramaze/tasks/traits.rake
56
63
  - lib/templates/sequel-postgres/spec/db_helper.rb.seed
57
64
  - lib/templates/sequel-postgres/tasks/schema.rake.seed
58
65
  - lib/templates/sequel/tasks/migrate.rake.seed
@@ -90,21 +97,21 @@ rdoc_options: []
90
97
  require_paths:
91
98
  - lib
92
99
  required_ruby_version: !ruby/object:Gem::Requirement
100
+ none: false
93
101
  requirements:
94
102
  - - ">="
95
103
  - !ruby/object:Gem::Version
96
104
  version: "0"
97
- version:
98
105
  required_rubygems_version: !ruby/object:Gem::Requirement
106
+ none: false
99
107
  requirements:
100
108
  - - ">="
101
109
  - !ruby/object:Gem::Version
102
110
  version: "0"
103
- version:
104
111
  requirements: []
105
112
 
106
113
  rubyforge_project: seedling
107
- rubygems_version: 1.3.3
114
+ rubygems_version: 1.6.2
108
115
  signing_key:
109
116
  specification_version: 3
110
117
  summary: A lightweight tool to create new ruby library trees, with helpers to make gemming and maintaining a breeze.
@@ -1,76 +0,0 @@
1
- task :gem_installer do
2
- class GemInstaller
3
- def initialize(options = {}, &block)
4
- @gems = []
5
- @options = options
6
-
7
- run(&block)
8
- end
9
-
10
- def run(&block)
11
- instance_eval(&block) if block_given?
12
- end
13
-
14
- def gem(name, version = nil, options = {})
15
- if version.respond_to?(:merge!)
16
- options = version
17
- else
18
- options[:version] = version
19
- end
20
-
21
- @gems << [name, options]
22
- end
23
-
24
- def setup_gemspec(gemspec)
25
- gemspec.dependencies.each do |dependency|
26
- dependency.version_requirements.as_list.each do |version|
27
- gem(dependency.name, version)
28
- end
29
- end
30
-
31
- setup
32
- end
33
-
34
- def setup
35
- require 'rubygems'
36
- require 'rubygems/dependency_installer'
37
-
38
- @gems.each do |name, options|
39
- setup_gem(name, options)
40
- end
41
- end
42
-
43
- def setup_gem(name, options, try_install = true)
44
- print "activating #{name} ... "
45
- Gem.activate(name, *[options[:version]].compact)
46
- require(options[:lib] || name)
47
- puts "success."
48
- rescue LoadError => error
49
- puts error
50
- install_gem(name, options) if try_install
51
- setup_gem(name, options, try_install = false)
52
- end
53
-
54
- def install_gem(name, options)
55
- installer = Gem::DependencyInstaller.new(options)
56
-
57
- temp_argv(options[:extconf]) do
58
- print "Installing #{name} ... "
59
- installer.install(name, options[:version])
60
- puts "done."
61
- end
62
- end
63
-
64
- def temp_argv(extconf)
65
- if extconf ||= @options[:extconf]
66
- old_argv = ARGV.clone
67
- ARGV.replace(extconf.split(' '))
68
- end
69
-
70
- yield
71
-
72
- ensure
73
- ARGV.replace(old_argv) if extconf
74
- end
75
- end
76
- end
@@ -1,15 +0,0 @@
1
- desc 'install all possible dependencies'
2
- task :setup => :gem_installer do
3
- GemInstaller.new do
4
- # core
5
-
6
- # spec
7
- gem '<%= @options[:test_suite] %>'
8
- gem 'rcov'
9
-
10
- # doc
11
- gem '<%= @options[:doc_generator] %>'
12
-
13
- setup
14
- end
15
- end