asphalt 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad0487d650796c423775e06355c7c18e144a2718
4
- data.tar.gz: ce677999bc5ac0958580c3288be10a643c4863d5
3
+ metadata.gz: cbe182c4727007bf9abb7d6fd39a8d6b2c905d5b
4
+ data.tar.gz: ba18613e2243ff3c669be72d56369625b324e08a
5
5
  SHA512:
6
- metadata.gz: 17995f50c917684ce1c93454f52782c396496332ce0278950b485f5b5372d13d80e3e632caf7ac74628341f25fd864740ba69ee6b2228422f37d1e1270f7fd12
7
- data.tar.gz: 253e028501ed8ea063e089d38c0f85446140696f3d365a6072e7d11b57b32c57b93f2d6ee9b3008bee0cf609da210ed426e401dad82f52fbb6ed0c28b40fbe01
6
+ metadata.gz: b00c2ce4cac6cf03a737efb28ce43a984689822e6dd34531908951de8578c748aeab24d2b57fbfe565c4d10e9760c3b049c01c83ae90dc5cfb4391547a2509ef
7
+ data.tar.gz: 607fea8922c466c6f2e3e44bf5efae11e3f2896cccdf85c8dd46a605d72d2b9e666d4bdfef807610d5b6a38107ead05c9430d4fe6613f754090dd86faa9690e7
data/README.md CHANGED
@@ -18,7 +18,7 @@ Install it from RubyGems:
18
18
 
19
19
  or clone and install from this repo
20
20
 
21
- $ git clone https//github.com/donokuda/asphalt.git
21
+ $ git clone https://github.com/donokuda/asphalt.git
22
22
  $ cd asphalt
23
23
  $ rake install
24
24
 
@@ -31,7 +31,11 @@ In the directory of your stylesheets:
31
31
 
32
32
  This will generate a folder structure of partialized Scss files.
33
33
 
34
- That's it! Run `sass -w /path/to/stylesheet_folder/main.scss` to compile your sass files!
34
+ If you prefer the indented sass syntax, you can run
35
+
36
+ $ asphalt init --sass
37
+
38
+ That's it! Run `sass -w main.scss` to compile your sass files!
35
39
 
36
40
 
37
41
  ## Contributing
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
  spec.add_dependency "thor", "~> 0.18.1"
21
+ spec.add_dependency "sass", "~> 3.2.10"
21
22
 
22
23
  spec.add_development_dependency "bundler", "~> 1.3"
23
24
  spec.add_development_dependency "rake"
@@ -2,9 +2,11 @@ require 'thor'
2
2
 
3
3
  module Asphalt
4
4
  class CLI < Thor
5
+ option :sass, :type => :boolean
5
6
  desc "init /path/to/stylesheets", "bootstrap directory with a set of Sass files"
6
7
  def init(target_directory=Dir.pwd)
7
- Asphalt::Generator.init!(target_directory)
8
+ format = :sass if options[:sass] == true
9
+ Asphalt::Generator.init!(target_directory, :format => format)
8
10
  end
9
11
  end
10
12
 
@@ -1,7 +1,7 @@
1
1
  module Asphalt
2
2
  module Generator
3
3
  # FIXME: TOMDOC this method and all other methods
4
- def self.init!(directory)
4
+ def self.init!(directory, options = {})
5
5
  directories = ["modules", "partials", "vendors"]
6
6
  directories.each do |scaffold_dir|
7
7
  FileUtils.mkdir_p(File.join(directory, scaffold_dir)) unless Dir.exists?(File.join(directory, scaffold_dir))
@@ -20,10 +20,26 @@ module Asphalt
20
20
 
21
21
  files.each do |scaffold_file|
22
22
  template_file_path = File.join(File.dirname(__FILE__), 'templates', scaffold_file)
23
- target_file = File.new(File.join(directory, scaffold_file), 'a+')
23
+
24
+ scaffold_directory = File.dirname(scaffold_file)
25
+ scaffold_filename = File.basename(scaffold_file, File.extname(scaffold_file))
26
+
27
+ if scaffold_file == 'partials/_base.sass'
28
+ scaffold_ext = '.sass'
29
+ else
30
+ scaffold_ext = options[:format] == :sass ? ".sass" : ".scss"
31
+ end
32
+
33
+ scaffold_file_path = File.join(scaffold_directory, scaffold_filename + scaffold_ext)
34
+
35
+ target_file = File.new(File.join(directory, scaffold_file_path), 'a+')
24
36
 
25
37
  if File.exists?(template_file_path)
26
- target_file.write(File.read(template_file_path))
38
+ if options[:format] == :sass && File.extname(template_file_path) == '.scss'
39
+ target_file.write(`sass-convert #{ template_file_path } -F scss -T sass`)
40
+ else
41
+ target_file.write(File.read(template_file_path))
42
+ end
27
43
  target_file.close
28
44
  end
29
45
  end
@@ -1,3 +1,3 @@
1
1
  module Asphalt
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -35,8 +35,6 @@ describe Asphalt::Generator do
35
35
  end
36
36
 
37
37
  it "should have content in the files generated" do
38
- fixtures_path = File.expand_path(File.join(__FILE__, '..', 'fixtures', 'example_stylesheet_folder'))
39
-
40
38
  Asphalt::Generator.init!(@temp_directory)
41
39
 
42
40
  File.read(File.join(@temp_directory, 'main.scss')).should match(%r(// ASPHALT GENERATED: MODULES))
@@ -58,6 +56,31 @@ describe Asphalt::Generator do
58
56
  existing_file_content.should match("// ASPHALT GENERATED: MODULES")
59
57
  end
60
58
 
59
+ context "with the sass format option" do
60
+ it "creates sass files with the sass argument" do
61
+ sass_directory = Dir.mktmpdir
62
+
63
+ Asphalt::Generator.init!(sass_directory, :format => :sass)
64
+
65
+ File.should exist(File.join(sass_directory, 'main.sass'))
66
+ File.should exist(File.join(sass_directory, 'modules', '_all.sass'))
67
+ File.should exist(File.join(sass_directory, 'partials', '_base.sass'))
68
+ File.should exist(File.join(sass_directory, 'partials', '_buttons.sass'))
69
+
70
+ FileUtils.remove_entry_secure sass_directory
71
+ end
72
+
73
+ it "has files with the indented sass format" do
74
+ sass_directory = Dir.mktmpdir
75
+
76
+ Asphalt::Generator.init!(sass_directory, :format => :sass)
77
+ File.read(File.join(sass_directory, 'main.sass')).should match(%r(@import partials/base$))
78
+ File.read(File.join(sass_directory, 'partials', '_base.sass')).should match(%r(@import "modules/all"$))
79
+
80
+ FileUtils.remove_entry_secure sass_directory
81
+ end
82
+ end
83
+
61
84
  after(:all) do
62
85
  FileUtils.remove_entry_secure @temp_directory
63
86
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asphalt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Don Okuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-06 00:00:00.000000000 Z
11
+ date: 2013-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.18.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: sass
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 3.2.10
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 3.2.10
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -89,9 +103,6 @@ files:
89
103
  - lib/asphalt/templates/partials/_base.sass
90
104
  - lib/asphalt/version.rb
91
105
  - spec/asphalt_spec.rb
92
- - spec/fixtures/example_stylesheet_folder/main.scss
93
- - spec/fixtures/example_stylesheet_folder/modules/_all.scss
94
- - spec/fixtures/example_stylesheet_folder/partials/_base.sass
95
106
  - spec/spec_helper.rb
96
107
  homepage: https://github.com/donokuda/asphalt
97
108
  licenses:
@@ -119,7 +130,4 @@ specification_version: 4
119
130
  summary: Asphalt paves the way for your Sass stylesheets!
120
131
  test_files:
121
132
  - spec/asphalt_spec.rb
122
- - spec/fixtures/example_stylesheet_folder/main.scss
123
- - spec/fixtures/example_stylesheet_folder/modules/_all.scss
124
- - spec/fixtures/example_stylesheet_folder/partials/_base.sass
125
133
  - spec/spec_helper.rb
@@ -1,17 +0,0 @@
1
- // ASPHALT: MODULES
2
- @import "partials/base";
3
-
4
- // ASPHALT: PARTIALS
5
- @import "partials/reset";
6
- @import "partials/typography";
7
- @import "partials/buttons";
8
- @import "partials/figures";
9
- @import "partials/grids";
10
-
11
- // Import third party styles here
12
- // PROTIP: Be sure to change the file extension to .scss
13
- // EXAMPLES:
14
- // @import "vendor/colorpicker";
15
- // @import "vendor/jquery.ui.core";
16
-
17
- // Your styles go here:
@@ -1,4 +0,0 @@
1
- // Include this to get all your modules
2
- // ASPHALT GENERATED: Modules
3
- @import 'utility';
4
- @import 'colors';
@@ -1,23 +0,0 @@
1
- // Uncomment if you use compass
2
- // @import "compass"
3
-
4
- // Font weights
5
- $light: 100
6
- $regular: 400
7
- $bold: 600
8
-
9
- // Base Font
10
- $base-font-family: sans-serif
11
- $base-font-weight: $regular
12
- $base-font-size: 13px
13
- $base-line-height: 1.4
14
-
15
- // Fixed Font
16
- $fixed-font-family: monospace
17
- $fixed-font-size: 85%
18
- $fixed-line-height: $base-line-height
19
-
20
- // Headings
21
- $header-font-weight: $bold
22
-
23
- @import "modules/all"