merb-freezer 0.9.3 → 0.9.4

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/README CHANGED
@@ -1,4 +1,35 @@
1
1
  merb-freezer
2
2
  ============
3
3
 
4
- see README.markdown
4
+ <<<<<<< HEAD:merb-freezer/README
5
+ This plugin lets you freeze Merb and run it using the frozen gems.
6
+
7
+ ==Why would you want to freeze Merb?
8
+
9
+ * You might have multiple applications on the same server/slice/cluster. Different applications might require different versions of Merb.
10
+
11
+ * You might work with a team of developers and want everyone to be using the same Merb version.
12
+
13
+ * You are using Merb Edge, you want to make sure the production server and your co workers are developing/testing against the same revision.
14
+
15
+
16
+ ==What are your options?
17
+
18
+ * You just want to lock your app to a specific version. For instance version merb-core 0.9.2
19
+
20
+ * You only want to use frozen gems located in /framework or /gems
21
+
22
+
23
+ == How to lock your app?
24
+
25
+ TODO
26
+
27
+ == How to use frozen gems
28
+
29
+ Instead of starting merb by typing "merb" in your console, type "frozen-merb" and that's it :)
30
+
31
+
32
+ If frozen-merb can't find frozen gems in /framework or /gems then Merb will start normally using the system's gems.
33
+ =======
34
+ see README.markdown
35
+ >>>>>>> new_merb_gen:merb-freezer/README
data/Rakefile CHANGED
@@ -1,29 +1,46 @@
1
1
  require 'rubygems'
2
2
  require 'rake/gempackagetask'
3
+ require "extlib"
4
+ require 'merb-core/tasks/merb_rake_helper'
5
+ require "spec/rake/spectask"
3
6
 
4
- PLUGIN = "merb-freezer"
5
- NAME = "merb-freezer"
6
- VERSION = "0.9.3"
7
- AUTHOR = "Matt Aimonetti"
8
- EMAIL = "mattaimonetti@gmail.com"
9
- HOMEPAGE = "http://www.merbivore.com"
10
- SUMMARY = "Merb plugin that let's you freeze Merb"
7
+ ##############################################################################
8
+ # Package && release
9
+ ##############################################################################
10
+ RUBY_FORGE_PROJECT = "merb"
11
+ PROJECT_URL = "http://merbivore.com"
12
+ PROJECT_SUMMARY = "Merb plugin that let's you freeze Merb"
13
+ PROJECT_DESCRIPTION = PROJECT_SUMMARY
14
+
15
+ GEM_AUTHOR = "Matt Aimonetti"
16
+ GEM_EMAIL = "mattaimonetti@gmail.com"
17
+
18
+ GEM_NAME = "merb-freezer"
19
+ PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
20
+ GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.4") + PKG_BUILD
21
+
22
+ RELEASE_NAME = "REL #{GEM_VERSION}"
23
+
24
+ require "extlib/tasks/release"
11
25
 
12
26
  spec = Gem::Specification.new do |s|
13
- s.name = NAME
14
- s.version = VERSION
27
+ s.rubyforge_project = RUBY_FORGE_PROJECT
28
+ s.name = GEM_NAME
29
+ s.version = GEM_VERSION
15
30
  s.platform = Gem::Platform::RUBY
16
31
  s.has_rdoc = true
17
32
  s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
18
- s.summary = SUMMARY
19
- s.description = s.summary
20
- s.author = AUTHOR
21
- s.email = EMAIL
22
- s.homepage = HOMEPAGE
33
+ s.summary = PROJECT_SUMMARY
34
+ s.description = PROJECT_DESCRIPTION
35
+ s.author = GEM_AUTHOR
36
+ s.email = GEM_EMAIL
37
+ s.homepage = PROJECT_URL
38
+ s.add_dependency('merb-core', ">= #{GEM_VERSION}")
23
39
  s.require_path = 'lib'
24
40
  s.bindir = "bin"
25
41
  s.executables = %w( frozen-merb )
26
- s.autorequire = PLUGIN
42
+ s.autorequire = 'merb-freezer'
43
+ s.require_path = 'lib'
27
44
  s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
28
45
  end
29
46
 
@@ -31,16 +48,23 @@ Rake::GemPackageTask.new(spec) do |pkg|
31
48
  pkg.gem_spec = spec
32
49
  end
33
50
 
34
- desc "install merb-freezer"
51
+ desc "Install the gem"
35
52
  task :install => [:package] do
36
- sh %{sudo gem install pkg/#{NAME}-#{VERSION} --no-update-sources}
53
+ sh %{#{sudo} gem install #{install_home} pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources}
37
54
  end
38
55
 
39
56
  namespace :jruby do
40
57
 
41
58
  desc "Run :package and install the resulting .gem with jruby"
42
59
  task :install => :package do
43
- sh %{#{SUDO} jruby -S gem install pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
60
+ sh %{#{sudo} jruby -S gem install #{install_home} pkg/#{GEM_NAME}-#{GEM_VERSION}.gem --no-rdoc --no-ri}
44
61
  end
45
-
46
- end
62
+
63
+ end
64
+
65
+
66
+ desc "Run the freezer specs"
67
+ Spec::Rake::SpecTask.new("specs") do |t|
68
+ t.spec_opts = ["--format", "specdoc", "--colour"]
69
+ t.spec_files = Dir["spec/**/*_spec.rb"].sort
70
+ end
data/TODO CHANGED
@@ -0,0 +1,5 @@
1
+ TODO:
2
+ Fix LICENSE with your name
3
+ Fix Rakefile with your name and contact info
4
+ Add your code to lib/merb-freezer.rb
5
+ Add your Merb rake tasks to lib/merb-freezer/merbtasks.rb
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
-
3
2
  root = nil
4
3
  %w[-m --merb-root].detect { |o| root = ARGV.index(o) }
5
4
  __DIR__ = root ? ARGV[root+1] : Dir.getwd
5
+
6
6
  framework = File.join(__DIR__,"framework")
7
7
 
8
8
  # load merb from the framework folder
9
+
9
10
  if File.directory?(framework)
10
11
  puts "Running from frozen framework"
11
12
  core = File.join(framework,"merb-core")
@@ -63,7 +63,6 @@ class Freezer
63
63
 
64
64
  # Calls the freezer mode on the component
65
65
  def freeze
66
- puts "Ice, Ice Baby!"
67
66
  puts "freezing mode: #{@mode}"
68
67
  send "#{@mode}_freeze"
69
68
  end
@@ -1,15 +1,18 @@
1
1
  require 'find'
2
+ require 'rubygems'
3
+ require 'rubygems/dependency_installer'
4
+
2
5
  module FreezerMode
3
6
 
4
7
  def sudo
5
8
  windows = (PLATFORM =~ /win32|cygwin/) rescue nil
6
9
  sudo = windows ? "" : "sudo"
7
10
  end
8
-
11
+
9
12
  def gitmodules
10
13
  File.join(Dir.pwd, ".gitmodules")
11
- end
12
-
14
+ end
15
+
13
16
  # Uses the Git submodules to freeze a component
14
17
  #
15
18
  def submodules_freeze
@@ -34,35 +37,63 @@ module FreezerMode
34
37
  else
35
38
  puts "Creating submodule for #{@component} ..."
36
39
  if framework_component?
37
- `cd #{Dir.pwd} & git-submodule --quiet add #{Freezer.components[@component.gsub("merb-", '')]} #{File.basename(freezer_dir)}/#{@component}`
40
+ `cd #{Dir.pwd} & git-submodule --quiet add #{Freezer.components[@component.gsub("merb-", '')]} #{File.basename(freezer_dir)}/#{@component}`
38
41
  else
39
- `cd #{Dir.pwd} & git-submodule --quiet add #{@component} gems/submodules/#{@component.match(/.*\/(.*)\..{3}$/)[1]}`
42
+ `cd #{Dir.pwd} & git-submodule --quiet add #{@component} gems/submodules/#{@component.match(/.*\/(.*)\..{3}$/)[1]}`
40
43
  end
41
44
  if $?.success?
42
45
  `git-submodule init`
43
46
  else
44
47
  # Should this instead be a raise?
45
- $stderr.puts("ERROR: unable to create submodule for #{@component} - you might want to freeze using MODE=rubygems")
48
+ $stderr.puts("ERROR: unable to create submodule for #{@component} - you might want to freeze using MODE=rubygems (make sure the current project has a git repository)")
46
49
  end
47
50
  end
48
51
  end
49
-
52
+
50
53
  # Uses rubygems to freeze the components locally
51
- #
52
54
  def rubygems_freeze
53
55
  create_freezer_dir(freezer_dir)
54
- action = update ? 'update' : 'install'
55
- puts "#{action} #{@component} and dependencies from rubygems"
56
- `#{sudo} gem #{action} #{@component} --no-rdoc --no-ri -i #{framework_component? ? 'framework' : 'gems'}`
56
+ puts "Install #{@component} and dependencies from rubygems"
57
+ if File.exist?(freezer_dir) && !File.writable?("#{freezer_dir}/cache")
58
+ puts "you might want to CHOWN the gems folder so it's not owned by root: sudo chown -R #{`whoami`} #{freezer_dir}"
59
+ end
60
+ install_rubygem @component
57
61
  end
58
62
 
63
+ # Install a gem - looks remotely and locally
64
+ # won't process rdoc or ri options.
65
+ def install_rubygem(gem, version = nil)
66
+ Gem.configuration.update_sources = false
67
+ Gem.clear_paths
68
+ installer = Gem::DependencyInstaller.new(:install_dir => freezer_dir)
69
+ exception = nil
70
+ begin
71
+ installer.install gem, version
72
+ rescue Gem::InstallError => e
73
+ exception = e
74
+ rescue Gem::GemNotFoundException => e
75
+ puts "Locating #{gem} in local gem path cache..."
76
+ spec = version ? Gem.cache.find_name(gem, "= #{version}").first : Gem.cache.find_name(gem).sort_by { |g| g.version }.last
77
+ if spec && File.exists?(gem_file = spec.installation_path / 'cache' / "#{spec.full_name}.gem")
78
+ installer.install gem_file
79
+ end
80
+ exception = e
81
+ end
82
+ if installer.installed_gems.empty? && e
83
+ puts "Failed to install gem '#{gem}' (#{e.message})"
84
+ end
85
+ installer.installed_gems.each do |spec|
86
+ puts "Successfully installed #{spec.full_name}"
87
+ end
88
+ end
89
+
59
90
  def create_freezer_dir(path)
60
91
  unless File.directory?(path)
61
92
  puts "Creating freezer directory ..."
62
93
  FileUtils.mkdir_p(path)
63
94
  end
64
95
  end
65
-
96
+
66
97
  protected
67
98
 
68
99
  # returns true if submodules are used
@@ -76,10 +107,10 @@ module FreezerMode
76
107
  def managed?(component)
77
108
  File.directory?(File.join(freezer_dir, component)) || in_submodule?(component)
78
109
  end
79
-
110
+
80
111
  def in_path?(bin)
81
112
  `which #{bin}`
82
113
  !$?.nil? && $?.success?
83
114
  end
84
-
85
- end
115
+
116
+ end
@@ -18,4 +18,11 @@ namespace :freeze do
18
18
  Freezer.freeze(ENV["GEM"], ENV["UPDATE"], ENV["MODE"])
19
19
  end
20
20
 
21
- end
21
+ desc "freeze all merb components (core, more, plugins) - use MODE=rubgygems and UPDATE=true as in regular freezing tasks"
22
+ task :all do
23
+ ['core', 'more', 'plugins'].each do |component|
24
+ Freezer.freeze(component, ENV["UPDATE"], ENV["MODE"])
25
+ end
26
+ end
27
+
28
+ end
@@ -61,7 +61,7 @@ describe "merb-freezer" do
61
61
  mr_freeze.mode.should == 'rubygems'
62
62
  mr_freeze.freeze
63
63
  File.exists?('gems').should be_true
64
- File.exists?('gems/gems/googlecharts-1.1.0').should be_true
64
+ Dir['gems/gems/googlecharts-1.*'].join(' ').include?('gems/gems/googlecharts-').should be_true
65
65
  end
66
66
 
67
67
  end
@@ -1,3 +1,3 @@
1
1
  $TESTING=true
2
2
  $:.push File.join(File.dirname(__FILE__), '..', 'lib')
3
- require 'merb-freezer'
3
+ require 'merb-freezer'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb-freezer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Aimonetti
@@ -9,10 +9,19 @@ autorequire: merb-freezer
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-04 00:00:00 -05:00
12
+ date: 2008-08-13 00:00:00 +03:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: merb-core
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.4
24
+ version:
16
25
  description: Merb plugin that let's you freeze Merb
17
26
  email: mattaimonetti@gmail.com
18
27
  executables:
@@ -36,7 +45,7 @@ files:
36
45
  - spec/merb-freezer_spec.rb
37
46
  - spec/spec_helper.rb
38
47
  has_rdoc: true
39
- homepage: http://www.merbivore.com
48
+ homepage: http://merbivore.com
40
49
  post_install_message:
41
50
  rdoc_options: []
42
51
 
@@ -56,8 +65,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
65
  version:
57
66
  requirements: []
58
67
 
59
- rubyforge_project:
60
- rubygems_version: 1.0.1
68
+ rubyforge_project: merb
69
+ rubygems_version: 1.2.0
61
70
  signing_key:
62
71
  specification_version: 2
63
72
  summary: Merb plugin that let's you freeze Merb