stylus_rails 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.1.1 (2011-03-29)
4
+ [Compare view](http://github.com/lucasmazza/stylus_rails/compare/v0.1.0...v0.1.1)
5
+
6
+ * Isolating the `mattr_accessor` core ext to a module, avoiding conflicts with AS code.
7
+
3
8
  ### 0.1.0 (2011-03-28)
4
9
  [Compare view](http://github.com/lucasmazza/stylus_rails/compare/v0.0.3...v0.1.0)
5
10
 
data/README.md CHANGED
@@ -1,42 +1,25 @@
1
1
  # Stylus for Rails apps
2
2
 
3
- A Rails helper to compile your [Stylus](https://github.com/LearnBoost/stylus) files in your Rails apps.
3
+ A gem to compile your [Stylus](https://github.com/LearnBoost/stylus) stylesheets in your ruby apps.
4
4
 
5
5
  ## Installation
6
6
 
7
- Just add `gem 'stylus_rails'` To your `Gemfile`. Rails will load the Stylus Railtie on your app on the development environment.
7
+ Just add `gem 'stylus_rails'` To your `Gemfile`. Rails will load the Stylus Railtie on your app on the development environment, and classic Sinatra applications will have an extension registered on your current application. On any other cenario you can run `Stylus.compile` inside your ruby code.
8
8
 
9
9
  ## Folders
10
10
 
11
- 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`
11
+ By default, `stylus_rails` will compile all files at `public/stylesheets/stylus` to the `public/stylesheets` folder. For instance, `public/stylesheets/stylus/application.styl` would generate `public/stylesheets/application.css`.
12
+
13
+ To change this behavior, on Rails apps, you can drop some configurations in an initializer to override the default paths.
12
14
 
13
15
  Stylus.root = File.join(Rails.root, 'app')
14
16
  Stylus.directory = 'stylus'
15
17
  Stylus.compile_directory = File.join(Rails.root, 'public', 'stylesheets')
16
18
 
17
- ## Partials
18
-
19
- `stylus_rails` will skip all files starting with `_`, so you can use this naming convention on your partial files and import them on other files.
20
-
21
- So, let's say that you have the following `_vendor.styl`:
22
-
23
- border-radius()
24
- -webkit-border-radius arguments
25
- -moz-border-radius arguments
26
- border-radius arguments
27
-
28
- And a `application.styl`
29
-
30
- @import '_mixins'
31
- .button
32
- border-radius 5px
33
-
34
- Stylus will compile your `application.styl` into a `application.css` and your `_vendor.styl` will be ignored.
35
-
36
19
  ## Sinatra
37
20
 
38
- We all love [Sinatra](http://www.sinatrarb.com/), so we have a extension to add `stylus` to your Sinatra applications.
39
- When using classic applications, just requiring `stylus_rails` will load the extension inside the Sinatra stack. When goin' modular, you will need to register it yourself.
21
+ We all love [Sinatra](http://www.sinatrarb.com/), so we have a extension to your Sinatra applications.
22
+ When using classic applications, just requiring `stylus_rails` will load the extension inside the Sinatra stack. When going modular, you will need to register it yourself.
40
23
 
41
24
  require 'sinatra'
42
25
  require 'stylus_rails'
@@ -59,12 +42,31 @@ You can also customize the `root` and `compile_directory` options using the Sina
59
42
 
60
43
  ## Rake task
61
44
 
62
- `stylus_rails` bundles a rake task `stylus:compile` to recompile your `.styl` files. Just add the following to your Rakefile:
45
+ `stylus_rails` bundles a rake task `stylus:compile` to recompile your `.styl` files whenever necessary. Just add the following to your Rakefile:
63
46
 
64
- require 'rubygems'
47
+ require 'stylus_rails'
65
48
  load 'stylus_rails/tasks/compile.rake'
66
49
 
67
- The task is included automatically the Railtile on Rails apps.
50
+ **NOTE** - *This task is included automatically on Rails apps, so you don't need to do this.*
51
+
52
+ ## Partials
53
+
54
+ `stylus_rails` will skip all files starting with `_`, so you can use this naming convention on your partial files and import them on other files.
55
+
56
+ So, let's say that you have the following `_vendor.styl`:
57
+
58
+ border-radius()
59
+ -webkit-border-radius arguments
60
+ -moz-border-radius arguments
61
+ border-radius arguments
62
+
63
+ And a `application.styl`
64
+
65
+ @import '_mixins'
66
+ .button
67
+ border-radius 5px
68
+
69
+ Stylus will compile your `application.styl` into a `application.css` and your `_vendor.styl` will be ignored.
68
70
 
69
71
  ## Changelog
70
72
  [here.](https://github.com/lucasmazza/stylus_rails/blob/master/CHANGELOG.md)
@@ -0,0 +1,19 @@
1
+ # Similar implementation to the ActiveSupport core extension.
2
+ # https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
3
+ module Stylus
4
+ module CoreExt
5
+ def mattr_accessor(sym)
6
+ class_eval(<<-EOS, __FILE__, __LINE__ + 1)
7
+ @@#{sym} = nil unless defined? @@#{sym}
8
+
9
+ def self.#{sym}
10
+ @@#{sym}
11
+ end
12
+
13
+ def self.#{sym}=(obj)
14
+ @@#{sym} = obj
15
+ end
16
+ EOS
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  module Stylus
2
-
2
+ extend CoreExt
3
3
  # Directory to look for .stylus files
4
4
  mattr_accessor :directory
5
5
  @@directory = "stylus"
@@ -1,3 +1,3 @@
1
1
  module Stylus
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/stylus_rails.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'stylus_rails/core_ext/attribute_accessors'
1
+ require 'stylus_rails/core_ext'
2
2
  require 'stylus_rails/stylus'
3
3
  require 'stylus_rails/runner'
4
4
  require 'stylus_rails/railtie' if defined?(::Rails) && Rails.env.development?
data/stylus_rails.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["Lucas Mazza"]
10
10
  s.email = ["luc4smazza@gmail.com"]
11
11
  s.homepage = "http://rubygems.org/gems/stylus_rails"
12
- s.summary = %q{Stylus stylesheets for Rails apps}
13
- s.description = %q{Rails plugin to compile .styl files between requests}
12
+ s.summary = %q{Stylus stylesheets for Ruby}
13
+ s.description = %q{Compiling .styl from your Rails/Sinatra applications}
14
14
 
15
15
  s.add_development_dependency "rspec", "~> 2.0"
16
16
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stylus_rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lucas Mazza
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-28 00:00:00 -03:00
18
+ date: 2011-03-29 00:00:00 -03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: "2.0"
34
34
  type: :development
35
35
  version_requirements: *id001
36
- description: Rails plugin to compile .styl files between requests
36
+ description: Compiling .styl from your Rails/Sinatra applications
37
37
  email:
38
38
  - luc4smazza@gmail.com
39
39
  executables: []
@@ -50,7 +50,7 @@ files:
50
50
  - README.md
51
51
  - Rakefile
52
52
  - lib/stylus_rails.rb
53
- - lib/stylus_rails/core_ext/attribute_accessors.rb
53
+ - lib/stylus_rails/core_ext.rb
54
54
  - lib/stylus_rails/railtie.rb
55
55
  - lib/stylus_rails/runner.rb
56
56
  - lib/stylus_rails/sinatra.rb
@@ -100,10 +100,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements: []
101
101
 
102
102
  rubyforge_project:
103
- rubygems_version: 1.4.2
103
+ rubygems_version: 1.6.1
104
104
  signing_key:
105
105
  specification_version: 3
106
- summary: Stylus stylesheets for Rails apps
106
+ summary: Stylus stylesheets for Ruby
107
107
  test_files:
108
108
  - spec/fixtures/foo.css
109
109
  - spec/fixtures/output/foo.css
@@ -1,18 +0,0 @@
1
- # Similar implementation to the ActiveSupport core extension.
2
- # https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
3
- class Module
4
-
5
- def mattr_accessor(sym)
6
- class_eval(<<-EOS, __FILE__, __LINE__ + 1)
7
- @@#{sym} = nil unless defined? @@#{sym}
8
-
9
- def self.#{sym}
10
- @@#{sym}
11
- end
12
-
13
- def self.#{sym}=(obj)
14
- @@#{sym} = obj
15
- end
16
- EOS
17
- end
18
- end