paste 0.2.2 → 0.3.0

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.
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe Paste::Glue, 'building cached concatenations' do
4
+
5
+ before :each do
6
+ Paste::Test.write 'foo', 'foo()'
7
+ Paste::Test.write 'bar', 'bar()'
8
+ Paste::Test.write 'foo/baz', 'baz()'
9
+ end
10
+
11
+ it "should rebuild within the same instance of the unifier" do
12
+ subject.rebuild
13
+
14
+ subject.should have_in_result('foo', 'foo()')
15
+ subject.should have_in_result('bar', 'bar()')
16
+ subject.should have_in_result('foo/baz', 'baz()')
17
+ end
18
+
19
+ it "should rebuild pre-existing results despite modification times" do
20
+ subject.rebuild
21
+
22
+ Paste::Test.write 'foo', 'foo2()', Time.now - 42
23
+ Paste::Test.write 'bar', 'bar2()', Time.now - 42
24
+ Paste::Test.write 'foo/baz', 'baz2()', Time.now - 42
25
+
26
+ subject.rebuild
27
+
28
+ subject.should have_in_result('foo', 'foo2()')
29
+ subject.should have_in_result('bar', 'bar2()')
30
+ subject.should have_in_result('foo/baz', 'baz2()')
31
+ end
32
+
33
+ it "doesn't explode when one of the files is removed after a rebuild" do
34
+ subject.rebuild
35
+
36
+ Paste::Test.delete_source 'foo'
37
+
38
+ subject.rebuild
39
+ end
40
+
41
+ end
@@ -10,24 +10,24 @@ describe Paste::Glue, 'configuration' do
10
10
  subject.config.root = '/foo/bar'
11
11
  subject.resolve('nonexistent').should == '/foo/bar/nonexistent'
12
12
  end
13
-
13
+
14
14
  it "should allow relative paths to the root to be set for configuration" do
15
- subject.config.root = '/foo/bar'
16
- subject.config.tmp_path = 'tmp'
17
- subject.config.erb_path = 'erb'
18
- subject.config.destination = 'dst'
19
-
15
+ subject.config.root = '/foo/bar'
16
+ subject.config.tmp_path = 'tmp'
17
+ subject.config.erb_path = 'erb'
18
+ subject.config.js_destination = 'dst'
19
+
20
20
  subject.tmp_path.should == '/foo/bar/tmp'
21
21
  subject.erb_path.should == '/foo/bar/erb'
22
22
  subject.destination.should == '/foo/bar/dst'
23
23
  end
24
-
24
+
25
25
  it "should allow absolute paths to the root to be set for configuration" do
26
- subject.config.root = '/foo/bar'
27
- subject.config.tmp_path = '/tmp'
28
- subject.config.erb_path = '/erb'
29
- subject.config.destination = '/dst'
30
-
26
+ subject.config.root = '/foo/bar'
27
+ subject.config.tmp_path = '/tmp'
28
+ subject.config.erb_path = '/erb'
29
+ subject.config.js_destination = '/dst'
30
+
31
31
  subject.tmp_path.should == '/tmp'
32
32
  subject.erb_path.should == '/erb'
33
33
  subject.destination.should == '/dst'
@@ -0,0 +1,88 @@
1
+ require 'spec_helper'
2
+
3
+ describe Paste::Glue do
4
+
5
+ it "should render an erb file into a temporary location" do
6
+ Paste::Test.write 'foo.js.erb', ''
7
+ subject.render_all_erb
8
+
9
+ subject.erb_path('foo.js').should exist
10
+ end
11
+
12
+ it "should execute the ERB in the file" do
13
+ Paste::Test.write 'foo.js.erb', '<%= "foo" %><%= "bar" %>'
14
+ subject.render_all_erb
15
+
16
+ subject.erb_path('foo.js').should have_contents('foobar')
17
+ end
18
+
19
+ it "should handle deeply nested erb files alright" do
20
+ Paste::Test.write 'foo/bar/baz.js.erb', '<%= "foo" %><%= "bar" %>'
21
+ subject.render_all_erb
22
+
23
+ subject.erb_path('foo/bar/baz.js').should have_contents('foobar')
24
+ end
25
+
26
+ it "shouldn't try to render regular js files" do
27
+ Paste::Test.write 'foo', 'foo()'
28
+ subject.render_all_erb
29
+
30
+ subject.erb_path('foo.js').should_not exist
31
+ end
32
+
33
+ describe Paste::Glue, "pasting a variety of regular/erb files" do
34
+ it "should use the generated ERB file when pasting" do
35
+ Paste::Test.write 'foo.js.erb', '<%= "foo" %><%= "bar" %>'
36
+ Paste::Test.write 'bar', "//= require <foo>\nbar()"
37
+ subject.render_all_erb
38
+
39
+ subject.paste('bar')
40
+ end
41
+
42
+ it "should watch for a file to be changed to an ERB file" do
43
+ Paste::Test.write 'foo', 'foo'
44
+ subject.render_all_erb
45
+ Paste::Test.delete_source 'foo'
46
+
47
+ Paste::Test.write 'foo.js.erb', '<%= "foo" %><%= "bar" %>'
48
+ subject.render_all_erb
49
+
50
+ subject.paste('foo')
51
+ end
52
+ end
53
+
54
+ describe "modifying existing files" do
55
+ before :each do
56
+ Paste::Test.write subject.erb_path('foo.js'), 'foo'
57
+ end
58
+
59
+ it "should regenerate the file if the source was modified" do
60
+ # File is modified after the original one
61
+ Paste::Test.write 'foo.js.erb', 'foobar', Time.now + 42
62
+
63
+ subject.render_all_erb
64
+
65
+ subject.erb_path('foo.js').should have_contents('foobar')
66
+ end
67
+
68
+ it "should not regenerate the file if the source was not modified" do
69
+ Paste::Test.write 'foo.js.erb', 'foobar', Time.now - 42
70
+ subject.render_all_erb
71
+
72
+ subject.erb_path('foo.js').should have_contents('foo')
73
+ end
74
+ end
75
+
76
+ context "rails" do
77
+ before :each do
78
+ Rails = {:foo => 'bar'}
79
+ end
80
+
81
+ it "should allow templates to use Rails instead of ::Rails" do
82
+ Paste::Test.write 'foo.js.erb', '<%= Rails[:foo] %>'
83
+ subject.render_all_erb
84
+
85
+ subject.erb_path('foo.js').should have_contents('bar')
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,56 @@
1
+ require 'spec_helper'
2
+
3
+ describe Paste::Glue do
4
+ before :each do
5
+ Paste::Test.write 'foo', 'foo()'
6
+ Paste::Test.write 'bar', 'bar()'
7
+ Paste::Test.write 'foo/baz', 'baz()'
8
+ end
9
+
10
+ it "should return the sources given" do
11
+ results = subject.paste('foo', 'bar', 'foo/baz')[:javascripts]
12
+
13
+ results.sort.should == ['bar.js', 'foo.js', 'foo/baz.js']
14
+ end
15
+
16
+ it "returns the sources with dependencies satisfied" do
17
+ Paste::Test.write 'foo', "//= require <foo/bar>\n//= require <bar>"
18
+ Paste::Test.write 'bar', '//= require <foo/bar>'
19
+ Paste::Test.write 'foo/bar', 'foobar()'
20
+
21
+ subject.paste('foo', 'bar', 'foo/bar')[:javascripts].should == ['foo/bar.js', 'bar.js', 'foo.js']
22
+ end
23
+
24
+ it "raises an exception on circular dependencies" do
25
+ Paste::Test.write 'foo', '//= require <bar>'
26
+ Paste::Test.write 'bar', '//= require <foo>'
27
+
28
+ lambda {
29
+ subject.paste('foo', 'bar')
30
+ }.should raise_exception(/circular dependency/i)
31
+ end
32
+
33
+ describe "regenerating files" do
34
+ it "watches for changes in dependencies" do
35
+ Paste::Test.write 'foo', '//= require <bar>'
36
+ Paste::Test.write 'bar', ''
37
+ Paste::Test.write 'baz', ''
38
+ subject.paste('foo')
39
+
40
+ Paste::Test.write 'bar', '//= require <baz>', Time.now + 42
41
+
42
+ subject.paste('foo')[:javascripts].should == ['baz.js', 'bar.js', 'foo.js']
43
+ end
44
+
45
+ it "watches for changes in deep dependencies" do
46
+ Paste::Test.write 'foo', ''
47
+ Paste::Test.write 'bar', ''
48
+ subject.paste('foo')
49
+
50
+ Paste::Test.write 'foo', '//= require <bar>', Time.now + 42
51
+
52
+ subject.paste('foo')[:javascripts].should == ['bar.js', 'foo.js']
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Paste::Glue, 'as a css provider' do
4
+ before :each do
5
+ Paste::Test.write 'foo', '//= require_css <foo>'
6
+ end
7
+
8
+ it "should require the css" do
9
+ result = subject.paste 'foo'
10
+ result[:stylesheets].should == ['foo']
11
+ end
12
+
13
+ it "should not require multiple css twice" do
14
+ Paste::Test.write 'bar', '//= require_css <foo>'
15
+
16
+ subject.paste('foo', 'bar')[:stylesheets].should == ['foo']
17
+ end
18
+ end
@@ -1,12 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Paste::Rails::Helper do
4
-
4
+
5
5
  before :each do
6
6
  @helper = Object.new
7
7
  @helper.class.send :include, subject
8
8
  end
9
9
 
10
+ after :each do
11
+ Paste.config.no_cache = false
12
+ end
13
+
10
14
  describe "working with javascript" do
11
15
  it "should register the include_javascript method" do
12
16
  @helper.include_javascript 'foobar'
@@ -34,84 +38,99 @@ describe Paste::Rails::Helper do
34
38
 
35
39
  @glue.should_receive(:paste).with('foo', 'bar').and_return(
36
40
  :javascripts => [],
37
- :css => []
41
+ :stylesheets => []
38
42
  )
39
43
 
40
44
  @helper.include_javascript 'foo'
41
- @helper.paste_js_tags 'bar'
45
+ @helper.javascript_tags 'bar'
42
46
  end
43
47
 
44
48
  it "should return the javascript include tags" do
45
49
  @helper.should_receive(:javascript_include_tag).with(
46
- 'foo', 'bar').and_return 'foo.js'
50
+ 'foo', 'bar', instance_of(Hash)).and_return 'foo.js'
47
51
  Paste::Rails.stub(:glue).and_return(
48
52
  mock(Paste::Glue, :paste => {
49
- :javascript => ['foo', 'bar'],
50
- :css => ['bar/baz']
53
+ :javascripts => ['foo', 'bar'],
54
+ :stylesheets => ['bar/baz']
51
55
  })
52
56
  )
53
57
 
54
- @helper.paste_js_tags('foo').should == 'foo.js'
58
+ @helper.javascript_tags('foo').should == 'foo.js'
59
+ end
60
+
61
+ it "doesn't cache javascripts when asked to not do so" do
62
+ Paste::Test.write 'bar', 'test'
63
+ Paste.config.no_cache = true
64
+ @helper.should_receive(:javascript_include_tag).with('bar.js')
65
+
66
+ @helper.javascript_tags('bar')
55
67
  end
56
68
  end
57
69
 
58
70
  describe "working with css" do
59
71
  it "should register the include_css method" do
60
- @helper.include_css 'foobar'
72
+ @helper.stylesheet 'foobar'
61
73
 
62
- @helper.included_css.should == ['foobar']
74
+ @helper.included_stylesheets.should == ['foobar']
63
75
  end
64
76
 
65
77
  it "should allow multiple sources to be included at once" do
66
- @helper.include_css 'foo', 'bar'
78
+ @helper.include_stylesheets 'foo', 'bar'
67
79
 
68
- @helper.included_css.should == ['foo', 'bar']
80
+ @helper.included_stylesheets.should == ['foo', 'bar']
69
81
  end
70
82
 
71
83
  it "shouldn't allow multiple sources to be in the list" do
72
- @helper.include_css 'foo', 'bar'
73
- @helper.include_css 'foo'
84
+ @helper.include_stylesheets 'foo', 'bar'
85
+ @helper.include_stylesheet 'foo'
74
86
 
75
- @helper.included_css.should == ['foo', 'bar']
87
+ @helper.included_stylesheets.should == ['foo', 'bar']
76
88
  end
77
89
 
78
90
  it "should return the stylesheet link tags for what was included" do
79
- @helper.include_css 'foo', 'bar'
91
+ @helper.include_stylesheets 'foo', 'bar'
80
92
  @helper.should_receive(:stylesheet_link_tag).with(
81
93
  'foo', 'bar', instance_of(Hash)).and_return 'foo.css'
82
- Paste::Rails.stub(:glue).and_return(Paste::JS::Chain.new)
94
+ Paste::Rails.stub(:glue).and_return(Paste::Glue.new)
83
95
 
84
- @helper.paste_css_tags.should == 'foo.css'
96
+ @helper.stylesheet_tags.should == 'foo.css'
85
97
  end
86
-
98
+
87
99
  it "should return the stylesheet link tags for what is specified" do
88
100
  @helper.should_receive(:stylesheet_link_tag).with(
89
101
  'foo', 'bar', instance_of(Hash)).and_return 'foo.css'
90
- Paste::Rails.stub(:glue).and_return(Paste::JS::Chain.new)
102
+ Paste::Rails.stub(:glue).and_return(Paste::Glue.new)
91
103
 
92
- @helper.paste_css_tags('foo', 'bar').should == 'foo.css'
104
+ @helper.stylesheet_tags('foo', 'bar').should == 'foo.css'
93
105
  end
94
-
106
+
95
107
  it "should include css required by the javascript" do
96
- Paste::JS::Test.write 'foo.js', '//= require_css <bar>'
108
+ Paste::Test.write 'foo.js', '//= require_css <bar>'
97
109
  @helper.include_javascript 'foo'
98
110
  @helper.should_receive(:stylesheet_link_tag).with(
99
111
  'bar', instance_of(Hash)).and_return 'bar.css'
100
112
 
101
- @helper.paste_css_tags.should == 'bar.css'
113
+ @helper.stylesheet_tags.should == 'bar.css'
114
+ end
115
+
116
+ it "doesn't cache stylesheets when asked to not do so" do
117
+ Paste.config.no_cache = true
118
+ @helper.should_receive(:stylesheet_link_tag).with('bar')
119
+
120
+ @helper.stylesheet_tags('bar')
102
121
  end
103
122
  end
104
123
 
105
124
  describe "the default glue value" do
106
125
  it "should be a unifier by default" do
107
- Paste::Rails.glue.should be_a(Paste::JS::Unify)
126
+ Paste::Rails.glue.should be_a(Paste::Glue)
108
127
  end
109
128
 
110
129
  it "should be swappable" do
111
- @chain = Paste::JS::Chain
130
+ @chain = Paste::Glue
112
131
  Paste::Rails.glue = @chain
113
132
 
114
133
  Paste::Rails.glue.should == @chain
115
134
  end
116
- end
135
+ end
117
136
  end
data/spec/spec_helper.rb CHANGED
@@ -5,18 +5,18 @@ require 'fileutils'
5
5
  require 'rspec/core'
6
6
  require 'paste'
7
7
 
8
- Paste::Glue.configure do |config|
8
+ Paste.configure do |config|
9
9
  config.root = File.expand_path('../tmp', __FILE__)
10
10
  end
11
11
 
12
- Paste::JS.config.load_path = ['js_sources']
13
- Paste::JS.config.destination = 'destination'
12
+ Paste.config.js_load_path = ['js_sources']
13
+ Paste.config.js_destination = 'destination'
14
14
 
15
15
  RSpec.configure do |c|
16
16
  c.color_enabled = true
17
17
 
18
18
  c.after(:each) do
19
- FileUtils.rm_rf Paste::Glue.config.root
19
+ FileUtils.rm_rf Paste.config.root
20
20
  end
21
21
  end
22
22
 
@@ -1,5 +1,5 @@
1
1
  def dump_tree
2
- raise Dir[Paste::JS::Base.root + '/**/*'].map { |f|
2
+ raise Dir[Paste.config.root + '/**/*'].map { |f|
3
3
  unless File.directory?(f)
4
4
  out = f
5
5
  out += "\n\t- " + File.read(f).gsub("\n", "\n\t- ")
@@ -11,64 +11,50 @@ def dump_tree
11
11
  end
12
12
 
13
13
  module Paste
14
- module TestBase
15
- def write source, contents, last_modified = Time.now
16
- file = path source
17
- FileUtils.mkdir_p File.dirname(file)
18
- File.open(file, 'w') { |f| f << contents }
14
+ module Test
15
+ class << self
19
16
 
20
- touch source, last_modified
21
- end
17
+ def write source, contents, last_modified = Time.now
18
+ file = path source
19
+ FileUtils.mkdir_p File.dirname(file)
20
+ File.open(file, 'w') { |f| f << contents }
22
21
 
23
- def touch source, modified_time = Time.now
24
- File.utime Time.now, modified_time, path(source)
25
- end
22
+ touch source, last_modified
23
+ end
26
24
 
27
- def path source
28
- return source if source.to_s[0...1] == '/'
25
+ def touch source, modified_time = Time.now
26
+ File.utime Time.now, modified_time, path(source)
27
+ end
29
28
 
30
- file = File.join(base.load_path.first, source)
31
- file += '.' + extension unless file.end_with?('.' + extension) ||
32
- file.end_with?('.erb')
33
- file
34
- end
29
+ def path source
30
+ return source if source.to_s[0...1] == '/'
35
31
 
36
- def delete result
37
- delete_file File.join(base.destination, result)
38
- end
32
+ file = File.join(Paste::Glue.load_path.first, source)
33
+ file += '.' + extension unless file.end_with?('.' + extension) ||
34
+ file.end_with?('.erb')
35
+ file
36
+ end
39
37
 
40
- def delete_source source
41
- delete_file File.join(base.load_path.first, source)
42
- end
38
+ def delete result
39
+ delete_file File.join(Paste::Glue.destination, result)
40
+ end
43
41
 
44
- protected
42
+ def delete_source source
43
+ delete_file File.join(Paste::Glue.load_path.first, source)
44
+ end
45
45
 
46
- def delete_file file
47
- file += '.' + extension unless file.end_with?('.' + extension)
46
+ protected
48
47
 
49
- File.delete(file)
50
- end
51
-
52
- def base
53
- Paste.const_get(extension.upcase).const_get('Base')
54
- end
55
- end
48
+ def extension
49
+ 'js'
50
+ end
56
51
 
57
- module JS::Test
58
- extend TestBase
59
-
60
- def self.extension
61
- 'js'
62
- end
63
- end
64
-
65
- module CSS
66
- module Test
67
- extend TestBase
68
-
69
- def self.extension
70
- 'css'
52
+ def delete_file file
53
+ file += '.' + extension unless file.end_with?('.' + extension)
54
+
55
+ File.delete(file)
71
56
  end
57
+
72
58
  end
73
59
  end
74
- end
60
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 2
9
- version: 0.2.2
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alex Crichton
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-05 00:00:00 -04:00
17
+ date: 2010-09-30 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -30,22 +30,9 @@ dependencies:
30
30
  type: :runtime
31
31
  prerelease: false
32
32
  version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: closure-compiler
35
- requirement: &id002 !ruby/object:Gem::Requirement
36
- none: false
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- segments:
41
- - 0
42
- version: "0"
43
- type: :runtime
44
- prerelease: false
45
- version_requirements: *id002
46
33
  - !ruby/object:Gem::Dependency
47
34
  name: activesupport
48
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ requirement: &id002 !ruby/object:Gem::Requirement
49
36
  none: false
50
37
  requirements:
51
38
  - - ">="
@@ -58,7 +45,7 @@ dependencies:
58
45
  version: 3.0.0.beta4
59
46
  type: :runtime
60
47
  prerelease: false
61
- version_requirements: *id003
48
+ version_requirements: *id002
62
49
  description: Asset Management for Rails
63
50
  email: alex@alexcrichton.com
64
51
  executables: []
@@ -69,15 +56,10 @@ extra_rdoc_files:
69
56
  - README.rdoc
70
57
  files:
71
58
  - lib/paste.rb
72
- - lib/paste/capistrano.rb
73
- - lib/paste/css/base.rb
59
+ - lib/paste/cache.rb
60
+ - lib/paste/compress.rb
61
+ - lib/paste/erb_renderer.rb
74
62
  - lib/paste/glue.rb
75
- - lib/paste/js/base.rb
76
- - lib/paste/js/cache.rb
77
- - lib/paste/js/chain.rb
78
- - lib/paste/js/compress.rb
79
- - lib/paste/js/erb_renderer.rb
80
- - lib/paste/js/unify.rb
81
63
  - lib/paste/parser/sprockets.rb
82
64
  - lib/paste/rails.rb
83
65
  - lib/paste/rails/helper.rb
@@ -87,13 +69,11 @@ files:
87
69
  - lib/paste/tasks/paste.rake
88
70
  - lib/paste/version.rb
89
71
  - README.rdoc
90
- - spec/paste/css/provides_spec.rb
91
- - spec/paste/js/cache_spec.rb
92
- - spec/paste/js/chain_spec.rb
93
- - spec/paste/js/compress_spec.rb
94
- - spec/paste/js/config_spec.rb
95
- - spec/paste/js/erb_spec.rb
96
- - spec/paste/js/unify_spec.rb
72
+ - spec/paste/cache_spec.rb
73
+ - spec/paste/config_spec.rb
74
+ - spec/paste/erb_spec.rb
75
+ - spec/paste/glue_spec.rb
76
+ - spec/paste/provides_spec.rb
97
77
  - spec/paste/rails/helper_spec.rb
98
78
  - spec/spec_helper.rb
99
79
  - spec/support/helpers.rb
@@ -112,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
92
  requirements:
113
93
  - - ">="
114
94
  - !ruby/object:Gem::Version
115
- hash: -1981454484605526525
95
+ hash: -2371119180319752676
116
96
  segments:
117
97
  - 0
118
98
  version: "0"
@@ -121,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
101
  requirements:
122
102
  - - ">="
123
103
  - !ruby/object:Gem::Version
124
- hash: -1981454484605526525
104
+ hash: -2371119180319752676
125
105
  segments:
126
106
  - 0
127
107
  version: "0"
@@ -133,13 +113,11 @@ signing_key:
133
113
  specification_version: 3
134
114
  summary: JS and CSS dependency management
135
115
  test_files:
136
- - spec/paste/css/provides_spec.rb
137
- - spec/paste/js/cache_spec.rb
138
- - spec/paste/js/chain_spec.rb
139
- - spec/paste/js/compress_spec.rb
140
- - spec/paste/js/config_spec.rb
141
- - spec/paste/js/erb_spec.rb
142
- - spec/paste/js/unify_spec.rb
116
+ - spec/paste/cache_spec.rb
117
+ - spec/paste/config_spec.rb
118
+ - spec/paste/erb_spec.rb
119
+ - spec/paste/glue_spec.rb
120
+ - spec/paste/provides_spec.rb
143
121
  - spec/paste/rails/helper_spec.rb
144
122
  - spec/spec_helper.rb
145
123
  - spec/support/helpers.rb
@@ -1,32 +0,0 @@
1
- Capistrano::Configuration.instance(true).load do
2
- after 'deploy:setup', 'paste:create_cache'
3
- after 'deploy:update_code', 'paste:link_cache'
4
- before 'deploy:symlink', 'paste:rebuild'
5
-
6
- namespace :paste do
7
- desc "Rebuild javascripts and such"
8
- task :rebuild do
9
- # Don't fail if paste isn't installed or something like that. Force this
10
- # command to succeed
11
- env = exists?(:rails_env) ? rails_env : 'production'
12
- run "cd #{latest_release} && " +
13
- "rake RAILS_ENV=#{env} paste:rebuild; echo ''"
14
- end
15
-
16
- task :compress do
17
- env = exists?(:rails_env) ? rails_env : 'production'
18
- run "cd #{latest_release} && " +
19
- "rake RAILS_ENV=#{env} paste:compress"
20
- end
21
-
22
- desc "Create a directory for caching javascript and such"
23
- task :create_cache do
24
- run "mkdir -p #{shared_path}/paste-cache"
25
- end
26
-
27
- desc "Link the cache directory into place"
28
- task :link_cache do
29
- run "ln -nsf #{shared_path}/paste-cache #{latest_release}/tmp"
30
- end
31
- end
32
- end