pieces 0.4.1 → 0.4.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 +4 -4
- data/README.md +10 -0
- data/lib/pieces/listener.rb +3 -1
- data/lib/pieces/rails.rb +10 -4
- data/lib/pieces/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e27bdc6bd2f2f6692aa8b2ed444d5d5ce662dbf1
|
4
|
+
data.tar.gz: 7b66106ffe80f2bd44611640d60d83b8f3e27ea9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e356716b1e0d9bede9b944fdfa7fd9783c672e7d9a149064ce6e0716e6809eb12b3645ef96731021623358872acce84d215c7b3b3122bf751a375d5b9bf6053
|
7
|
+
data.tar.gz: 5ee3d4371032923872272373e0090d5a1e260a5479230a6d3c01f9916e2ef98202cf97ef386ffb4cccc27f86acbefe0273189675d46e48fdd79f4b057ed63233
|
data/README.md
CHANGED
@@ -124,6 +124,16 @@ bundle exec rails s
|
|
124
124
|
|
125
125
|
And then visit [http://localhost:3000/styleguide](http://localhost:3000/styleguide)
|
126
126
|
|
127
|
+
**Do you use vagrant?** If you do you should update Pieces::Rails in your
|
128
|
+
`config/routes.rb` as follows:
|
129
|
+
|
130
|
+
``` ruby
|
131
|
+
mount Pieces::Rails.new(force_polling: true).mount, at: '/styleguide' unless Rails.env.production?
|
132
|
+
```
|
133
|
+
|
134
|
+
This will tell `listen`, the gem that watches for changes, to poll your app
|
135
|
+
for changes. This is required for vagrant!
|
136
|
+
|
127
137
|
## Create new static site
|
128
138
|
|
129
139
|
To create a new static site with Pieces:
|
data/lib/pieces/listener.rb
CHANGED
@@ -2,15 +2,17 @@ module Pieces
|
|
2
2
|
class Listener
|
3
3
|
attr_reader :path
|
4
4
|
attr_reader :build_method
|
5
|
+
attr_reader :force_polling
|
5
6
|
|
6
7
|
def initialize(config = {})
|
7
8
|
@path = config[:path] || Dir.pwd
|
8
9
|
@build_method = config[:build_method] || :build
|
10
|
+
@force_polling = config[:force_polling] || false
|
9
11
|
build_pieces
|
10
12
|
end
|
11
13
|
|
12
14
|
def listen
|
13
|
-
Listen.to("#{path}/config/", "#{path}/app/") do
|
15
|
+
Listen.to("#{path}/config/", "#{path}/app/", force_polling: force_polling) do
|
14
16
|
print "Rebuilding #{path}... "
|
15
17
|
build_pieces
|
16
18
|
puts 'done.'
|
data/lib/pieces/rails.rb
CHANGED
@@ -2,10 +2,16 @@ require 'pieces/rails/railtie'
|
|
2
2
|
|
3
3
|
module Pieces
|
4
4
|
class Rails
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
attr_reader :path, :force_polling
|
6
|
+
|
7
|
+
def initialize(options = {})
|
8
|
+
@path = path || Dir.pwd
|
9
|
+
@force_polling = options[:force_polling]
|
10
|
+
end
|
11
|
+
|
12
|
+
def mount
|
13
|
+
Pieces::Listener.new(path: path, build_method: :build_routes, force_polling: force_polling).listen
|
14
|
+
Pieces::Server.new(path: path).app
|
9
15
|
end
|
10
16
|
end
|
11
17
|
end
|
data/lib/pieces/version.rb
CHANGED