stylus_rails 0.0.2 → 0.0.3

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/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ *.DS_Store
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.0.3 (2011-03-13)
4
+ [Compare view](http://github.com/lucasmazza/stylus_rails/compare/v0.0.2...v0.0.3)
5
+
6
+ * Added 'compile_directory' option, so you can output the generated .css files on any other folder. (by [sebastiandeutsch](https://github.com/sebastiandeutsch))
7
+
3
8
  ### 0.0.2 (2011-02-02)
4
9
  [Compare view](http://github.com/lucasmazza/stylus_rails/compare/v0.0.1...v0.0.2)
5
10
 
data/README.md CHANGED
@@ -13,7 +13,11 @@ Just add `gem 'stylus_rails'` To your `Gemfile`.
13
13
 
14
14
  ## Folders
15
15
 
16
- By default, `stylus_rails` will compile all files existing at `public/stylesheets/stylus` to the `public/stylesheets` folder. For instance, `public/stylesheets/stylus/application.styl` would generate `public/stylesheets/application.css`.
16
+ By default, `stylus_rails` will compile all files existing at `public/stylesheets/stylus` to the `public/stylesheets` folder. For instance, `public/stylesheets/stylus/application.styl` would generate `public/stylesheets/application.css`. You can add some configuration by creating an initializer in `config/initializers`
17
+
18
+ Stylus.root = File.join(Rails.root, 'app')
19
+ Stylus.directory = 'stylus'
20
+ Stylus.compile_directory = File.join(Rails.root, 'public', 'stylesheets')
17
21
 
18
22
  ## Changelog
19
23
  [here.](https://github.com/lucasmazza/stylus_rails/blob/master/CHANGELOG.md)
@@ -17,7 +17,13 @@ module Stylus
17
17
 
18
18
  private
19
19
  def css_folder(path)
20
- File.dirname(File.dirname(path))
20
+ if Stylus.compile_directory.nil?
21
+ dirname = File.dirname(File.dirname(path))
22
+ else
23
+ dirname = File.dirname(path)
24
+ dirname.gsub!(File.join(Stylus.root, Stylus.directory), Stylus.compile_directory)
25
+ end
26
+ dirname
21
27
  end
22
28
 
23
29
  def group_paths
@@ -9,6 +9,10 @@ module Stylus
9
9
  # Root path for the stylus directory lookup.
10
10
  mattr_accessor :root
11
11
  @@root = File.dirname(__FILE__)
12
+
13
+ # Root path for the output
14
+ mattr_accessor :compile_directory
15
+ @@compile_directory = nil
12
16
 
13
17
  mattr_accessor :extension
14
18
  @@extension = "styl"
@@ -1,3 +1,3 @@
1
1
  module Stylus
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,4 @@
1
+ body {
2
+ background-color: #000;
3
+ color: #fff;
4
+ }
@@ -0,0 +1,8 @@
1
+ body {
2
+ font: 12px Helvetica, Arial, sans-serif;
3
+ }
4
+ a.button {
5
+ -webkit-border-radius: 5px;
6
+ -moz-border-radius: 5px;
7
+ border-radius: 5px;
8
+ }
File without changes
@@ -0,0 +1,3 @@
1
+ body
2
+ background-color white
3
+ color black
data/spec/runner_spec.rb CHANGED
@@ -17,8 +17,13 @@ describe Stylus::Runner do
17
17
  parser = Stylus::Runner.new(fixtures("stylus/simple.styl", "stylus/_border_radius.styl"))
18
18
  parser.paths.should == fixture("stylus/simple.styl")
19
19
  end
20
+
21
+ it "process nested files correctly" do
22
+ parser = Stylus::Runner.new(fixtures("stylus/nested/bar.styl"))
23
+ parser.paths.should == fixture("stylus/nested/bar.styl")
24
+ end
20
25
  end
21
-
26
+
22
27
  describe "#call" do
23
28
  subject { Stylus::Runner.new(fixture("stylus/simple.styl")) }
24
29
  let(:stylus_file) { fixture("stylus/simple.styl").first }
@@ -46,4 +51,35 @@ describe Stylus::Runner do
46
51
  subject.call
47
52
  end
48
53
  end
54
+
55
+ describe "#call with different compile_dir" do
56
+ subject { Stylus::Runner.new(fixture("stylus/simple.styl")) }
57
+ let(:stylus_file) { fixture("stylus/simple.styl").first }
58
+ let(:target_folder) { File.dirname(fixture("output/simple.css").first) }
59
+
60
+ before do
61
+ Stylus.compress = false
62
+ Stylus.root = File.join(File.dirname(__FILE__), 'fixtures')
63
+ Stylus.directory = 'stylus'
64
+ Stylus.compile_directory = File.join(File.dirname(__FILE__), 'fixtures', 'output')
65
+ end
66
+
67
+ it "calls the stylus cli" do
68
+ subject.should_receive(:system).with("stylus #{stylus_file} -o #{target_folder}")
69
+ subject.call
70
+ end
71
+
72
+ it "runs files on the same folder on a single command" do
73
+ paths = fixtures("stylus/simple.styl", "stylus/foo.styl")
74
+ subject = Stylus::Runner.new(paths)
75
+ subject.should_receive(:system).with("stylus #{paths.join(" ")} -o #{target_folder}")
76
+ subject.call
77
+ end
78
+
79
+ it "uses the compress flag when configured to" do
80
+ Stylus.compress = true
81
+ subject.should_receive(:system).with("stylus #{stylus_file} -o #{target_folder} -C")
82
+ subject.call
83
+ end
84
+ end
49
85
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stylus_rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 2
10
- version: 0.0.2
5
+ version: 0.0.3
11
6
  platform: ruby
12
7
  authors:
13
8
  - Lucas Mazza
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-02-02 00:00:00 -02:00
13
+ date: 2011-03-13 00:00:00 -03:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,10 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ~>
28
23
  - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 3
32
- - 0
33
24
  version: "3.0"
34
25
  type: :runtime
35
26
  version_requirements: *id001
@@ -41,10 +32,6 @@ dependencies:
41
32
  requirements:
42
33
  - - ~>
43
34
  - !ruby/object:Gem::Version
44
- hash: 11
45
- segments:
46
- - 2
47
- - 4
48
35
  version: "2.4"
49
36
  type: :development
50
37
  version_requirements: *id002
@@ -71,10 +58,14 @@ files:
71
58
  - lib/stylus_rails/tasks/tasks.rake
72
59
  - lib/stylus_rails/version.rb
73
60
  - spec/fixtures/foo.css
61
+ - spec/fixtures/output/foo.css
62
+ - spec/fixtures/output/simple.css
63
+ - spec/fixtures/output/style.css
74
64
  - spec/fixtures/simple.css
75
65
  - spec/fixtures/style.css
76
66
  - spec/fixtures/stylus/_border_radius.styl
77
67
  - spec/fixtures/stylus/foo.styl
68
+ - spec/fixtures/stylus/nested/bar.styl
78
69
  - spec/fixtures/stylus/simple.styl
79
70
  - spec/runner_spec.rb
80
71
  - spec/spec_helper.rb
@@ -93,32 +84,30 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
84
  requirements:
94
85
  - - ">="
95
86
  - !ruby/object:Gem::Version
96
- hash: 3
97
- segments:
98
- - 0
99
87
  version: "0"
100
88
  required_rubygems_version: !ruby/object:Gem::Requirement
101
89
  none: false
102
90
  requirements:
103
91
  - - ">="
104
92
  - !ruby/object:Gem::Version
105
- hash: 3
106
- segments:
107
- - 0
108
93
  version: "0"
109
94
  requirements: []
110
95
 
111
96
  rubyforge_project:
112
- rubygems_version: 1.4.2
97
+ rubygems_version: 1.5.2
113
98
  signing_key:
114
99
  specification_version: 3
115
100
  summary: Stylus stylesheets for Rails apps
116
101
  test_files:
117
102
  - spec/fixtures/foo.css
103
+ - spec/fixtures/output/foo.css
104
+ - spec/fixtures/output/simple.css
105
+ - spec/fixtures/output/style.css
118
106
  - spec/fixtures/simple.css
119
107
  - spec/fixtures/style.css
120
108
  - spec/fixtures/stylus/_border_radius.styl
121
109
  - spec/fixtures/stylus/foo.styl
110
+ - spec/fixtures/stylus/nested/bar.styl
122
111
  - spec/fixtures/stylus/simple.styl
123
112
  - spec/runner_spec.rb
124
113
  - spec/spec_helper.rb