allen 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/allen/preprocessors.rb +11 -7
- data/lib/allen/settings.rb +4 -21
- data/lib/allen/version.rb +1 -1
- data/lib/settings.rb +23 -0
- data/spec/lib/allen/preprocessors_spec.rb +41 -18
- metadata +22 -21
data/Gemfile.lock
CHANGED
data/lib/allen/preprocessors.rb
CHANGED
@@ -19,16 +19,20 @@ module Allen
|
|
19
19
|
|
20
20
|
name :echo
|
21
21
|
|
22
|
+
def self.relative(path)
|
23
|
+
path.gsub(Dir.pwd + '/',"")
|
24
|
+
end
|
25
|
+
|
22
26
|
def self.build(input, output)
|
23
|
-
sh "#{@name} #{input}:#{output}"
|
27
|
+
sh "#{@name} #{relative input}:#{relative output}"
|
24
28
|
end
|
25
29
|
|
26
30
|
def self.compress(input, output)
|
27
|
-
sh "#{@name} #{input}:#{output} --compress"
|
31
|
+
sh "#{@name} #{relative input}:#{relative output} --compress"
|
28
32
|
end
|
29
33
|
|
30
34
|
def self.watch(input, output)
|
31
|
-
sh "#{@name} #{input}:#{output} --watch"
|
35
|
+
sh "#{@name} #{relative input}:#{relative output} --watch"
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
@@ -42,16 +46,16 @@ module Allen
|
|
42
46
|
|
43
47
|
class Sass < Preprocessor
|
44
48
|
def self.build(input, output)
|
45
|
-
sh "sass #{input}:#{output} --style expanded"
|
49
|
+
sh "sass #{relative input}:#{relative output} --style expanded"
|
46
50
|
end
|
47
51
|
|
48
52
|
def self.compress(input, output)
|
49
|
-
sh "sass #{input}:#{output} --style compressed"
|
53
|
+
sh "sass #{relative input}:#{relative output} --style compressed"
|
50
54
|
end
|
51
55
|
|
52
56
|
def self.watch(input, output)
|
53
|
-
input_path = input.gsub(/\/\w+\.\w+$/,'')
|
54
|
-
output_path = output.gsub(/\/\w+\.\w+$/,'')
|
57
|
+
input_path = relative(input).gsub(/\/\w+\.\w+$/,'')
|
58
|
+
output_path = relative(output).gsub(/\/\w+\.\w+$/,'')
|
55
59
|
sh "sass --watch #{input_path}:#{output_path} --style expanded"
|
56
60
|
end
|
57
61
|
end
|
data/lib/allen/settings.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
require 'settings'
|
2
|
+
|
1
3
|
module Allen
|
2
|
-
class Settings
|
4
|
+
class Settings < ::Settings
|
3
5
|
def initialize
|
6
|
+
super
|
4
7
|
pwd = Dir.pwd
|
5
8
|
|
6
9
|
defaults = Proc.new do
|
@@ -21,26 +24,6 @@ module Allen
|
|
21
24
|
|
22
25
|
configure defaults
|
23
26
|
end
|
24
|
-
|
25
|
-
def configure(configuration=nil, &block)
|
26
|
-
instance_eval(&configuration) if configuration
|
27
|
-
instance_eval(&block) if block
|
28
|
-
end
|
29
|
-
|
30
|
-
def method_missing(method, value=nil, &block)
|
31
|
-
set(method, value, block) if !value.nil? or block
|
32
|
-
get(method)
|
33
|
-
end
|
34
|
-
|
35
|
-
def set(name, value, block)
|
36
|
-
instance_variable_set "@#{name}", !value.nil? ? value : block
|
37
|
-
end
|
38
|
-
|
39
|
-
def get(name)
|
40
|
-
value = instance_variable_get "@#{name}"
|
41
|
-
value = value.call if value.respond_to? :call
|
42
|
-
value
|
43
|
-
end
|
44
27
|
end
|
45
28
|
end
|
46
29
|
|
data/lib/allen/version.rb
CHANGED
data/lib/settings.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
class Settings
|
2
|
+
def configure(configuration=nil, &block)
|
3
|
+
instance_eval(&configuration) if configuration
|
4
|
+
instance_eval(&block) if block
|
5
|
+
end
|
6
|
+
|
7
|
+
def method_missing(method, value=nil, &block)
|
8
|
+
set(method, value, block) if !value.nil? or block
|
9
|
+
get(method)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def set(name, value, block)
|
15
|
+
instance_variable_set "@#{name}", !value.nil? ? value : block
|
16
|
+
end
|
17
|
+
|
18
|
+
def get(name)
|
19
|
+
value = instance_variable_get "@#{name}"
|
20
|
+
value = value.call if value.respond_to? :call
|
21
|
+
value
|
22
|
+
end
|
23
|
+
end
|
@@ -2,60 +2,83 @@ require 'spec_helper'
|
|
2
2
|
require 'allen/preprocessors'
|
3
3
|
|
4
4
|
describe Allen::Preprocessors do
|
5
|
+
describe Allen::Preprocessors::Preprocessor do
|
6
|
+
describe ".relative" do
|
7
|
+
it "gets a relative path from an absolute one" do
|
8
|
+
Dir.stub(:pwd) { "c:/path/to/some" }
|
9
|
+
abs_path = "c:/path/to/some/input/file.css"
|
10
|
+
rel_path = "input/file.css"
|
11
|
+
Allen::Preprocessors::Preprocessor.relative(abs_path).should == rel_path
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
5
16
|
describe Allen::Preprocessors::Coyote do
|
6
17
|
let(:coyote) { Allen::Preprocessors::Coyote }
|
18
|
+
let(:input) { "c:/path/to/some/input/file.less" }
|
19
|
+
let(:output) { "c:/path/to/some/output/file.css" }
|
20
|
+
|
21
|
+
before { Dir.stub(:pwd) { "c:/path/to/some" } }
|
7
22
|
|
8
23
|
it "has a build command" do
|
9
|
-
coyote.should_receive("sh").with("coyote input.less:output.css")
|
10
|
-
coyote.build(
|
24
|
+
coyote.should_receive("sh").with("coyote input/file.less:output/file.css")
|
25
|
+
coyote.build(input, output)
|
11
26
|
end
|
12
27
|
|
13
28
|
it "has a compress command" do
|
14
|
-
coyote.should_receive("sh").with("coyote input.less:output.css --compress")
|
15
|
-
coyote.compress(
|
29
|
+
coyote.should_receive("sh").with("coyote input/file.less:output/file.css --compress")
|
30
|
+
coyote.compress(input, output)
|
16
31
|
end
|
17
32
|
|
18
33
|
it "has a watch command" do
|
19
|
-
coyote.should_receive("sh").with("coyote input.less:output.css --watch")
|
20
|
-
coyote.watch(
|
34
|
+
coyote.should_receive("sh").with("coyote input/file.less:output/file.css --watch")
|
35
|
+
coyote.watch(input, output)
|
21
36
|
end
|
22
37
|
end
|
23
38
|
|
24
39
|
describe Allen::Preprocessors::Banshee do
|
25
40
|
let(:banshee) { Allen::Preprocessors::Banshee }
|
41
|
+
let(:input) { "c:/path/to/some/input/file.less" }
|
42
|
+
let(:output) { "c:/path/to/some/output/file.css" }
|
43
|
+
|
44
|
+
before { Dir.stub(:pwd) { "c:/path/to/some" } }
|
26
45
|
|
27
46
|
it "has a build command" do
|
28
|
-
banshee.should_receive("sh").with("banshee input.less:output.css")
|
29
|
-
banshee.build(
|
47
|
+
banshee.should_receive("sh").with("banshee input/file.less:output/file.css")
|
48
|
+
banshee.build(input, output)
|
30
49
|
end
|
31
50
|
|
32
51
|
it "has a compress command" do
|
33
|
-
banshee.should_receive("sh").with("banshee input.less:output.css --compress")
|
34
|
-
banshee.compress(
|
52
|
+
banshee.should_receive("sh").with("banshee input/file.less:output/file.css --compress")
|
53
|
+
banshee.compress(input, output)
|
35
54
|
end
|
36
55
|
|
37
56
|
it "has a watch command" do
|
38
|
-
banshee.should_receive("sh").with("banshee input.less:output.css --watch")
|
39
|
-
banshee.watch(
|
57
|
+
banshee.should_receive("sh").with("banshee input/file.less:output/file.css --watch")
|
58
|
+
banshee.watch(input, output)
|
40
59
|
end
|
41
60
|
end
|
42
61
|
|
43
62
|
describe Allen::Preprocessors::Sass do
|
44
63
|
let(:sass) { Allen::Preprocessors::Sass }
|
64
|
+
let(:input) { "c:/path/to/some/input/file.sass" }
|
65
|
+
let(:output) { "c:/path/to/some/output/file.css" }
|
66
|
+
|
67
|
+
before { Dir.stub(:pwd) { "c:/path/to" } }
|
45
68
|
|
46
69
|
it "has a build command" do
|
47
|
-
sass.should_receive("sh").with("sass input.sass:output.css --style expanded")
|
48
|
-
sass.build(
|
70
|
+
sass.should_receive("sh").with("sass some/input/file.sass:some/output/file.css --style expanded")
|
71
|
+
sass.build(input, output)
|
49
72
|
end
|
50
73
|
|
51
74
|
it "has a compress command" do
|
52
|
-
sass.should_receive("sh").with("sass input.sass:output.css --style compressed")
|
53
|
-
sass.compress(
|
75
|
+
sass.should_receive("sh").with("sass some/input/file.sass:some/output/file.css --style compressed")
|
76
|
+
sass.compress(input, output)
|
54
77
|
end
|
55
78
|
|
56
79
|
it "has a watch command" do
|
57
|
-
sass.should_receive("sh").with("sass --watch
|
58
|
-
sass.watch(
|
80
|
+
sass.should_receive("sh").with("sass --watch some/input:some/output --style expanded")
|
81
|
+
sass.watch(input, output)
|
59
82
|
end
|
60
83
|
end
|
61
84
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2012-11-08 00:00:00.000000000Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
17
|
-
requirement: &
|
17
|
+
requirement: &2152960180 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 0.16.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2152960180
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: i18n
|
28
|
-
requirement: &
|
28
|
+
requirement: &2152959000 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 0.6.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2152959000
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: active_support
|
39
|
-
requirement: &
|
39
|
+
requirement: &2152958100 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 3.0.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2152958100
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: albacore
|
50
|
-
requirement: &
|
50
|
+
requirement: &2152957400 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - =
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 0.3.4
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2152957400
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: rake
|
61
|
-
requirement: &
|
61
|
+
requirement: &2152956820 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - =
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 0.9.2.2
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *2152956820
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rspec
|
72
|
-
requirement: &
|
72
|
+
requirement: &2152955980 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - =
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 2.11.0
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *2152955980
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: listen
|
83
|
-
requirement: &
|
83
|
+
requirement: &2152954980 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - =
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 0.4.7
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *2152954980
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: guard
|
94
|
-
requirement: &
|
94
|
+
requirement: &2152949320 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - =
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: 1.2.3
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *2152949320
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: guard-rspec
|
105
|
-
requirement: &
|
105
|
+
requirement: &2152948820 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - =
|
@@ -110,10 +110,10 @@ dependencies:
|
|
110
110
|
version: 1.2.1
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *2152948820
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: growl
|
116
|
-
requirement: &
|
116
|
+
requirement: &2152948200 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
119
|
- - =
|
@@ -121,7 +121,7 @@ dependencies:
|
|
121
121
|
version: 1.0.3
|
122
122
|
type: :development
|
123
123
|
prerelease: false
|
124
|
-
version_requirements: *
|
124
|
+
version_requirements: *2152948200
|
125
125
|
description: Quickly build and manage Umbraco projects
|
126
126
|
email:
|
127
127
|
- taylor.smith@imulus.com
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- lib/allen/settings.rb
|
151
151
|
- lib/allen/task_definer.rb
|
152
152
|
- lib/allen/version.rb
|
153
|
+
- lib/settings.rb
|
153
154
|
- spec/lib/allen/dsl_spec.rb
|
154
155
|
- spec/lib/allen/preprocessors_spec.rb
|
155
156
|
- spec/lib/allen/project_spec.rb
|