merb-freezer 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/bin/frozen-merb +0 -2
- data/lib/merb-freezer/freezer.rb +17 -2
- data/lib/merb-freezer/freezer_mode.rb +12 -8
- data/spec/merb-freezer_spec.rb +13 -2
- metadata +3 -3
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@ GEM_EMAIL = "mattaimonetti@gmail.com"
|
|
17
17
|
|
18
18
|
GEM_NAME = "merb-freezer"
|
19
19
|
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
20
|
-
GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.
|
20
|
+
GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.5") + PKG_BUILD
|
21
21
|
|
22
22
|
RELEASE_NAME = "REL #{GEM_VERSION}"
|
23
23
|
|
data/bin/frozen-merb
CHANGED
@@ -27,13 +27,11 @@ if File.directory?(framework)
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
require "merb-core/core_ext/kernel"
|
30
|
-
require "merb-core/core_ext/rubygems"
|
31
30
|
else
|
32
31
|
# load from the gems folder
|
33
32
|
gem = Dir["./gems/gems/merb-core-*"].last
|
34
33
|
if gem
|
35
34
|
require gem + "/lib/merb-core/core_ext/kernel"
|
36
|
-
require gem + "/lib/merb-core/core_ext/rubygems"
|
37
35
|
|
38
36
|
Gem.clear_paths
|
39
37
|
Gem.path.unshift(__DIR__+"/gems")
|
data/lib/merb-freezer/freezer.rb
CHANGED
@@ -53,7 +53,7 @@ class Freezer
|
|
53
53
|
def initialize(component, update=false, mode=nil)
|
54
54
|
@component = Freezer.components.keys.include?(component) ? "merb-" + component : component
|
55
55
|
@update = update
|
56
|
-
if (mode.nil? && framework_component?) ||
|
56
|
+
if (mode.nil? && framework_component?) || component_git_url? || mode == 'submodules'
|
57
57
|
@mode = 'submodules'
|
58
58
|
else
|
59
59
|
@mode = 'rubygems'
|
@@ -72,4 +72,19 @@ class Freezer
|
|
72
72
|
Freezer.components.keys.include?(@component.gsub("merb-", ""))
|
73
73
|
end
|
74
74
|
|
75
|
-
|
75
|
+
def component_git_url?
|
76
|
+
return true if @component.split(":").first == "git"
|
77
|
+
return true if @component[-4..-1] == ".git"
|
78
|
+
false
|
79
|
+
end
|
80
|
+
|
81
|
+
def component_name
|
82
|
+
@component = File.basename(@component)
|
83
|
+
if @component[-4..-1] == ".git"
|
84
|
+
@component[0..-5]
|
85
|
+
else
|
86
|
+
@component
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
@@ -5,8 +5,12 @@ require 'rubygems/dependency_installer'
|
|
5
5
|
module FreezerMode
|
6
6
|
|
7
7
|
def sudo
|
8
|
-
|
9
|
-
sudo = windows ? "" :
|
8
|
+
ENV['MERB_SUDO'] ||= "sudo"
|
9
|
+
sudo = windows? ? "" : ENV['MERB_SUDO']
|
10
|
+
end
|
11
|
+
|
12
|
+
def windows?
|
13
|
+
(PLATFORM =~ /win32|cygwin/) rescue nil
|
10
14
|
end
|
11
15
|
|
12
16
|
def gitmodules
|
@@ -17,7 +21,7 @@ module FreezerMode
|
|
17
21
|
#
|
18
22
|
def submodules_freeze
|
19
23
|
# Ensure that required git commands are available
|
20
|
-
%w(git
|
24
|
+
%w(git).each do |bin|
|
21
25
|
next if in_path?(bin)
|
22
26
|
$stderr.puts "ERROR: #{bin} must be avaible in PATH - you might want to freeze using MODE=rubygems"
|
23
27
|
exit 1
|
@@ -27,22 +31,22 @@ module FreezerMode
|
|
27
31
|
create_freezer_dir(freezer_dir)
|
28
32
|
|
29
33
|
if managed?(@component)
|
30
|
-
puts "#{@component} seems to be already managed by git
|
34
|
+
puts "#{@component} seems to be already managed by git submodule."
|
31
35
|
if @update
|
32
36
|
puts "Trying to update #{@component} ..."
|
33
|
-
`cd #{freezer_dir}/#{@component} && git
|
37
|
+
`cd #{freezer_dir}/#{@component} && git pull`
|
34
38
|
else
|
35
39
|
puts "you might want to call this rake task using UPDATE=true if you wish to update the frozen gems using this task"
|
36
40
|
end
|
37
41
|
else
|
38
42
|
puts "Creating submodule for #{@component} ..."
|
39
43
|
if framework_component?
|
40
|
-
`cd #{Dir.pwd} & git
|
44
|
+
`cd #{Dir.pwd} & git submodule --quiet add #{Freezer.components[@component.gsub("merb-", '')]} #{File.basename(freezer_dir)}/#{@component}`
|
41
45
|
else
|
42
|
-
`cd #{Dir.pwd} & git
|
46
|
+
`cd #{Dir.pwd} & git submodule --quiet add #{@component} gems/submodules/#{component_name}`
|
43
47
|
end
|
44
48
|
if $?.success?
|
45
|
-
`git
|
49
|
+
`git submodule init`
|
46
50
|
else
|
47
51
|
# Should this instead be a raise?
|
48
52
|
$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)")
|
data/spec/merb-freezer_spec.rb
CHANGED
@@ -63,5 +63,16 @@ describe "merb-freezer" do
|
|
63
63
|
File.exists?('gems').should be_true
|
64
64
|
Dir['gems/gems/googlecharts-1.*'].join(' ').include?('gems/gems/googlecharts-').should be_true
|
65
65
|
end
|
66
|
-
|
67
|
-
|
66
|
+
|
67
|
+
it "should check if it's a git url correctly" do
|
68
|
+
Freezer.new('googlecharts.git').should be_component_git_url
|
69
|
+
Freezer.new('git://googlecharts').should be_component_git_url
|
70
|
+
Freezer.new('googlecharts').should_not be_component_git_url
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should extract component name properly" do
|
74
|
+
Freezer.new('googlecharts.git').component_name.should == "googlecharts"
|
75
|
+
Freezer.new('git://moo/googlecharts').component_name.should == "googlecharts"
|
76
|
+
Freezer.new('~/moo/googlecharts').component_name.should == "googlecharts"
|
77
|
+
end
|
78
|
+
end
|
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.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Aimonetti
|
@@ -9,7 +9,7 @@ autorequire: merb-freezer
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-08-
|
12
|
+
date: 2008-08-26 00:00:00 +03: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.
|
23
|
+
version: 0.9.5
|
24
24
|
version:
|
25
25
|
description: Merb plugin that let's you freeze Merb
|
26
26
|
email: mattaimonetti@gmail.com
|