merb-gen 0.9.12 → 0.9.13

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,10 +1,4 @@
1
- require 'rubygems'
2
- require 'rake/gempackagetask'
3
- require "extlib"
4
- require 'merb-core/tasks/merb_rake_helper'
5
- require "spec/rake/spectask"
6
-
7
- require File.join(File.dirname(__FILE__), "../merb-core/lib/merb-core/version.rb")
1
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
8
2
 
9
3
  ##############################################################################
10
4
  # Package && release
@@ -91,7 +91,7 @@ module Merb
91
91
  #
92
92
 
93
93
  def merb_gems_version
94
- "0.9.10"
94
+ Merb::VERSION
95
95
  end
96
96
 
97
97
  def dm_gems_version
@@ -92,6 +92,7 @@ module GemManagement
92
92
  if installer.installed_gems.empty? && exception
93
93
  error "Failed to install gem '#{gem} (#{version || 'any version'})' (#{exception.message})"
94
94
  end
95
+ ensure_bin_wrapper_for_installed_gems(installer.installed_gems, options)
95
96
  installer.installed_gems.each do |spec|
96
97
  success "Successfully installed #{spec.full_name}"
97
98
  end
@@ -119,6 +120,7 @@ module GemManagement
119
120
  if installer.installed_gems.empty? && exception
120
121
  error "Failed to install gem '#{gem}' (#{e.message})"
121
122
  end
123
+ ensure_bin_wrapper_for_installed_gems(installer.installed_gems, options)
122
124
  installer.installed_gems.each do |spec|
123
125
  success "Successfully installed #{spec.full_name}"
124
126
  end
@@ -132,8 +134,8 @@ module GemManagement
132
134
  # install_gem_from_source(source_dir, :skip => [...])
133
135
  def install_gem_from_source(source_dir, *args)
134
136
  installed_gems = []
135
- Dir.chdir(source_dir) do
136
- opts = args.last.is_a?(Hash) ? args.pop : {}
137
+ opts = args.last.is_a?(Hash) ? args.pop : {}
138
+ Dir.chdir(source_dir) do
137
139
  gem_name = args[0] || File.basename(source_dir)
138
140
  gem_pkg_dir = File.join(source_dir, 'pkg')
139
141
  gem_pkg_glob = File.join(gem_pkg_dir, "#{gem_name}-*.gem")
@@ -173,6 +175,8 @@ module GemManagement
173
175
  end
174
176
  end
175
177
 
178
+ ensure_bin_wrapper_for(opts[:install_dir], opts[:bin_dir], *installed_gems)
179
+
176
180
  # Finally install the main gem
177
181
  if install_pkg(Dir[gem_pkg_glob][0], opts.merge(:refresh => refresh))
178
182
  installed_gems = refresh
@@ -302,6 +306,13 @@ module GemManagement
302
306
  end
303
307
  end
304
308
 
309
+ def ensure_bin_wrapper_for_installed_gems(gemspecs, options)
310
+ if options[:install_dir] && options[:bin_dir]
311
+ gems = gemspecs.map { |spec| spec.name }
312
+ ensure_bin_wrapper_for(options[:install_dir], options[:bin_dir], *gems)
313
+ end
314
+ end
315
+
305
316
  private
306
317
 
307
318
  def executable_wrapper(spec, bin_file_name, minigems = true)
@@ -322,9 +333,9 @@ rescue LoadError
322
333
  require '#{then_req}'
323
334
  end
324
335
 
325
- if File.directory?(gems_dir = File.join(Dir.pwd, 'gems')) ||
326
- File.directory?(gems_dir = File.join(File.dirname(__FILE__), '..', 'gems'))
327
- $BUNDLE = true; Gem.clear_paths; Gem.path.unshift(gems_dir)
336
+ # use gems dir if ../gems exists - eg. only for ./bin/#{bin_file_name}
337
+ if File.directory?(gems_dir = File.join(File.dirname(__FILE__), '..', 'gems'))
338
+ $BUNDLE = true; Gem.clear_paths; Gem.path.replace([gems_dir])
328
339
  ENV["PATH"] = "\#{File.dirname(__FILE__)}:\#{gems_dir}/bin:\#{ENV["PATH"]}"
329
340
  if (local_gem = Dir[File.join(gems_dir, "specifications", "#{spec.name}-*.gemspec")].last)
330
341
  version = File.basename(local_gem)[/-([\\.\\d]+)\\.gemspec$/, 1]
@@ -428,7 +439,7 @@ end
428
439
 
429
440
  module MerbThorHelper
430
441
 
431
- attr_accessor :include_dependencies, :force_gem_dir
442
+ attr_accessor :force_gem_dir
432
443
 
433
444
  def self.included(base)
434
445
  base.send(:include, ColorfulMessages)
@@ -552,11 +563,11 @@ module MerbThorHelper
552
563
  end
553
564
 
554
565
  def default_install_options
555
- { :install_dir => gem_dir, :ignore_dependencies => ignore_dependencies? }
566
+ { :install_dir => gem_dir, :bin_dir => bin_dir, :ignore_dependencies => ignore_dependencies? }
556
567
  end
557
568
 
558
569
  def default_uninstall_options
559
- { :install_dir => gem_dir, :ignore => true, :all => true, :executables => true }
570
+ { :install_dir => gem_dir, :bin_dir => bin_dir, :ignore => true, :all => true, :executables => true }
560
571
  end
561
572
 
562
573
  def dry_run?
@@ -564,11 +575,7 @@ module MerbThorHelper
564
575
  end
565
576
 
566
577
  def ignore_dependencies?
567
- options[:"ignore-dependencies"] || !include_dependencies?
568
- end
569
-
570
- def include_dependencies?
571
- options[:"include-dependencies"] || self.include_dependencies
578
+ options[:"ignore-dependencies"]
572
579
  end
573
580
 
574
581
  # The current working directory, or Merb app root (--merb-root option).
@@ -611,10 +618,6 @@ module MerbThorHelper
611
618
  def create_if_missing(path)
612
619
  FileUtils.mkdir(path) unless File.exists?(path)
613
620
  end
614
-
615
- def ensure_bin_wrapper_for(*gems)
616
- Merb::Gem.ensure_bin_wrapper_for(gem_dir, bin_dir, *gems)
617
- end
618
621
 
619
622
  def sudo
620
623
  ENV['THOR_SUDO'] ||= "sudo"
@@ -938,11 +941,6 @@ module Merb
938
941
  FileUtils.touch(File.join(spec.full_gem_path, "stable.strategy"))
939
942
  end
940
943
  end
941
-
942
- # Add local binaries for the installed framework dependencies
943
- comps = Merb::Stack.all_components & deps.map { |d| d.name }
944
- comps << { :no_minigems => 'merb-gen' }
945
- ensure_bin_wrapper_for(*comps)
946
944
  end
947
945
  return true
948
946
  end
@@ -1155,7 +1153,7 @@ module Merb
1155
1153
  merb_datamapper
1156
1154
  ]
1157
1155
 
1158
- MERB_STACK = %w[
1156
+ MERB_STACK = %w[
1159
1157
  extlib
1160
1158
  merb-core
1161
1159
  merb-action-args
@@ -1172,7 +1170,7 @@ module Merb
1172
1170
  merb-exceptions
1173
1171
  ] + DM_STACK
1174
1172
 
1175
- MERB_BASICS = %w[
1173
+ MERB_BASICS = %w[
1176
1174
  extlib
1177
1175
  merb-core
1178
1176
  merb-action-args
@@ -1261,7 +1259,7 @@ module Merb
1261
1259
 
1262
1260
  global_method_options = {
1263
1261
  "--merb-root" => :optional, # the directory to operate on
1264
- "--include-dependencies" => :boolean, # gather sub-dependencies
1262
+ "--ignore-dependencies" => :boolean, # skip sub-dependencies
1265
1263
  "--version" => :optional # gather specific version of framework
1266
1264
  }
1267
1265
 
@@ -1661,15 +1659,12 @@ module Merb
1661
1659
  # merb:gem:install merb-core --version 0.9.8 # install a specific version of a gem
1662
1660
  # merb:gem:install merb-core --force # uninstall then subsequently install the gem
1663
1661
  # merb:gem:install merb-core --cache # try to install locally from system gems
1664
- # merb:gem:install merb-core --binaries # also install adapted bin wrapper
1665
1662
 
1666
1663
  desc 'install GEM_NAME [GEM_NAME, ...]', 'Install a gem from rubygems'
1667
- method_options "--cache" => :boolean,
1668
- "--binaries" => :boolean,
1669
- "--dry-run" => :boolean,
1670
- "--force" => :boolean
1664
+ method_options "--cache" => :boolean,
1665
+ "--dry-run" => :boolean,
1666
+ "--force" => :boolean
1671
1667
  def install(*names)
1672
- self.include_dependencies = true # deal with dependencies by default
1673
1668
  opts = { :version => options[:version], :cache => options[:cache] }
1674
1669
  current_gem = nil
1675
1670
 
@@ -1683,7 +1678,6 @@ module Merb
1683
1678
  else
1684
1679
  message "Installing #{current_gem}..."
1685
1680
  self.class.install(gem_name, default_install_options.merge(opts))
1686
- ensure_bin_wrapper_for(gem_name) if options[:binaries]
1687
1681
  end
1688
1682
  end
1689
1683
  rescue => e
@@ -1709,7 +1703,6 @@ module Merb
1709
1703
  desc 'uninstall GEM_NAME [GEM_NAME, ...]', 'Unstall a gem'
1710
1704
  method_options "--dry-run" => :boolean
1711
1705
  def uninstall(*names)
1712
- self.include_dependencies = true # deal with dependencies by default
1713
1706
  opts = { :version => options[:version] }
1714
1707
  current_gem = nil
1715
1708
  if dry_run?
@@ -1781,7 +1774,7 @@ module Merb
1781
1774
 
1782
1775
  global_method_options = {
1783
1776
  "--merb-root" => :optional, # the directory to operate on
1784
- "--include-dependencies" => :boolean, # gather sub-dependencies
1777
+ "--ignore-dependencies" => :boolean, # don't install sub-dependencies
1785
1778
  "--sources" => :optional # a yml config to grab sources from
1786
1779
  }
1787
1780
 
@@ -1831,13 +1824,11 @@ module Merb
1831
1824
  # merb:source:install merb-core merb-slices # install all specified gems
1832
1825
  # merb:source:install merb-core --force # uninstall then subsequently install the gem
1833
1826
  # merb:source:install merb-core --wipe # clear repo then install the gem
1834
- # merb:source:install merb-core --binaries # also install adapted bin wrapper
1835
1827
 
1836
1828
  desc 'install GEM_NAME [GEM_NAME, ...]', 'Install a gem from git source/edge'
1837
- method_options "--binaries" => :boolean,
1838
- "--dry-run" => :boolean,
1839
- "--force" => :boolean,
1840
- "--wipe" => :boolean
1829
+ method_options "--dry-run" => :boolean,
1830
+ "--force" => :boolean,
1831
+ "--wipe" => :boolean
1841
1832
  def install(*names)
1842
1833
  # uninstall existing gems of the ones we're going to install
1843
1834
  uninstall(*names) if options[:force] || options[:wipe]
@@ -1855,9 +1846,7 @@ module Merb
1855
1846
  note "Installing #{current_gem} from source..."
1856
1847
  else
1857
1848
  message "Installing #{current_gem} from source..."
1858
- if install_dependency_from_source(dependency)
1859
- ensure_bin_wrapper_for(dependency.name) if options[:binaries]
1860
- else
1849
+ unless install_dependency_from_source(dependency)
1861
1850
  raise "gem source not found"
1862
1851
  end
1863
1852
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.12
4
+ version: 0.9.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-29 00:00:00 -07:00
12
+ date: 2008-11-03 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.12
23
+ version: 0.9.13
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: templater
@@ -335,7 +335,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
335
335
  requirements: []
336
336
 
337
337
  rubyforge_project: merb
338
- rubygems_version: 1.3.0
338
+ rubygems_version: 1.3.1
339
339
  signing_key:
340
340
  specification_version: 2
341
341
  summary: Generators suite for Merb.