pieces 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce469759e0fa76551899ce44f51dc326806302b5
4
- data.tar.gz: 6691693a1c9f4ffc925bd1849081534d2d960837
3
+ metadata.gz: 0b51682b37d7d66fcb1ca1d9b4c771b183891d7b
4
+ data.tar.gz: 76d48e3faa29e687c112bbada03c820d76909203
5
5
  SHA512:
6
- metadata.gz: 519fea1fef10f8bae83f2ce61a877a64d112d0a94c6c0fe4e0c6325a66e4092bd0326d5489597a546405b809cde2466bd6d878a0743675aaad75e1c887f78e97
7
- data.tar.gz: 93008bb9f863ba0d56ba67e54fa6d513913e853f203fd192e9c6b2b028c92255f1c97bb134dddc95c5f3b9022786a9b84e2ce8b1fc603ff7cc2d296e98872f0e
6
+ metadata.gz: b6e6b397790bcf4d07933b206d137bc69657626115229b1525b3015eb694341855e79f050606dae413a155948d21aa22d846e10041328481812295f4c69cc78e
7
+ data.tar.gz: f4f78c2ee4db24950ce27f59f68706111fcf4a2632bb8450e201d3bee5ba6b2b14ff8bb55c4f1a7009f275b1716e4596cea60b0bde06e9553e747663d2bc43c4
data/.travis.yml CHANGED
@@ -1,3 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.2.1
4
+ env:
5
+ - CODECLIMATE_REPO_TOKEN=e1ed3b4a34c8a7383eaf6c450cf5776733abfbee60dc5446509bdefd9cc15a2c
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Pieces
2
2
 
3
+ [![Build Status](https://travis-ci.org/drpheltright/pieces.svg)](https://travis-ci.org/drpheltright/pieces)
4
+ [![Code Climate](https://codeclimate.com/github/drpheltright/pieces/badges/gpa.svg)](https://codeclimate.com/github/drpheltright/pieces)
5
+ [![Test Coverage](https://codeclimate.com/github/drpheltright/pieces/badges/coverage.svg)](https://codeclimate.com/github/drpheltright/pieces/coverage)
6
+
3
7
  This gem will take your HTML and CSS components and compile them into a static
4
8
  site. Very very alpha.
5
9
 
@@ -9,9 +13,11 @@ To create a new static site with pieces:
9
13
 
10
14
  ```
11
15
  gem install pieces
12
- pieces init
16
+ pieces init hello_world
13
17
  ```
14
18
 
19
+ This will install some boiler plate in `hello_world/`.
20
+
15
21
  ## Create styleguide within existing application
16
22
 
17
23
  Add pieces to your Gemfile:
@@ -40,9 +46,84 @@ pieces build
40
46
 
41
47
  Make sure you run this from your pieces directory!
42
48
 
49
+ ## How it works
50
+
51
+ Using configuration found in `config/routes.yml` pieces will compile your
52
+ modular components ala BEM (or whatever you prefer) into a static HTML site.
53
+
54
+ At the top level of your `routes.yml` you define your output files, or "routes".
55
+ The following example will build both `index.html` and `about.html`.
56
+
57
+ ``` yml
58
+ index:
59
+ _pieces:
60
+ - intro: { title: 'Welcome to my site' }
61
+
62
+ about:
63
+ _pieces:
64
+ - intro: { title: 'About me' }
65
+ ```
66
+
67
+ Both `index.html` and `about.html` make use of a piece called "intro". This
68
+ piece will be found in either `pieces/intro.html.*`, `pieces/intro/intro.html.*`
69
+ or `pieces/application/intro.html.*`. The `*` can be any format supported by
70
+ [tilt](https://github.com/rtomayko/tilt).
71
+
72
+ You can generate your HTML into directories quite easily:
73
+
74
+ ``` yml
75
+ portfolio/a-client:
76
+ _pieces:
77
+ - carousel: {}
78
+ - case_study: {}
79
+ portfolio/another-client:
80
+ _pieces:
81
+ - carousel: {}
82
+ - case_study: {}
83
+ ```
84
+
85
+ Likewise you can structure your pieces in directories:
86
+
87
+ ``` yml
88
+ about:
89
+ _pieces:
90
+ - header: {}
91
+ - copy/intro: {}
92
+ - galleries/photo: {}
93
+ - footer: {}
94
+ ```
95
+
96
+ "copy/intro" and "galleries/photo" will be found in `pieces/copy/intro.html.*`
97
+ and `pieces/galleries/photo.html.*` respectively.
98
+
99
+ You can place your content in a layout quite easily with nested pieces.
100
+
101
+ ``` yml
102
+ about:
103
+ _pieces:
104
+ - layouts/application:
105
+ _pieces:
106
+ - header: {}
107
+ - copy/intro: {}
108
+ - galleries/photo: {}
109
+ - footer: {}
110
+ ```
111
+
112
+ The child pieces will be rendered in order and passed into the parent
113
+ "layouts/application" piece as `yield`. If you had
114
+ `pieces/layouts/application.html.erb` then you can call yield like so:
115
+
116
+ ``` erb
117
+ <html>
118
+ <body>
119
+ <%= yield %>
120
+ </body>
121
+ </html>
122
+ ```
123
+
43
124
  ## Contributing
44
125
 
45
- 1. Fork it ( https://github.com/[my-github-username]/pieces/fork )
126
+ 1. Fork it ( https://github.com/drpheltright/pieces/fork )
46
127
  2. Create your feature branch (`git checkout -b my-new-feature`)
47
128
  3. Commit your changes (`git commit -am 'Add some feature'`)
48
129
  4. Push to the branch (`git push origin my-new-feature`)
data/Rakefile CHANGED
@@ -1,2 +1,4 @@
1
1
  require 'bundler/setup'
2
2
  require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new(:default)
@@ -61,10 +61,14 @@ module Pieces
61
61
  def save_files(files)
62
62
  FileUtils.rm_rf('build')
63
63
  Dir.mkdir('build')
64
- files.each { |name, file| save_file(name, file) }
64
+
65
+ files.each do |name, file|
66
+ save_file(name, file)
67
+ end
65
68
  end
66
69
 
67
70
  def save_file(name, file)
71
+ FileUtils.mkdir_p(File.dirname("build/#{name}"))
68
72
  File.open("build/#{name}", 'w') { |f| f.write(file[:contents]) }
69
73
  end
70
74
  end
@@ -1,3 +1,3 @@
1
1
  module Pieces
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pieces
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Morton