pieces 0.4.4 → 0.4.5

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: 0100e4191227f786c1b1d9e0f96a6bd0d2bd67de
4
- data.tar.gz: f196376bc297bfd8317c76f48e2f9823122e3b86
3
+ metadata.gz: 8f0c78f26ae344a81c5411d901d551640d01f82f
4
+ data.tar.gz: d152e4834db8415e043ff06dcb7209a58529d556
5
5
  SHA512:
6
- metadata.gz: 4af3ce1aa233f0d3a4e85fdc495413c6b397d64237b57450a0ff29ad54b85fe7b9d8289f6a5b1af04819c42b09af5e96e55450843f67026d47451430ce5450ba
7
- data.tar.gz: a8ead97393bd224aa2a8d978a9395d58c15e40dd72acbb44a544b6c87aabefa99be05c24a2efc9177414d17aa502fa6f045ad1fe8e048fb52215fdcb3747512e
6
+ metadata.gz: 7f29b7ed87aa9b7e673a84496ba7b67167da61db87119fd22c0879be2124633310c2ed5ca3ab50a5699c3b53534cb8fe2fc1964fbd89a609b3217bbfe58fb95c
7
+ data.tar.gz: fe0bc48abc9d6bdee5746af430a56d33f7ec16b7ec7d68afcd8f6bed5b8e44502c97082d29783c1cab24877df0b199aa90583220fb3c8dec321aa6dfcc6416a7
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>{{title}} {{title_suffix}}</title>
5
- <link rel="stylesheet" href="compiled.css" />
5
+ <link rel="stylesheet" href="/assets/pieces.css" />
6
6
  </head>
7
7
 
8
8
  <body>
@@ -16,6 +16,13 @@ module Pieces
16
16
 
17
17
  def initialize(config)
18
18
  @path = config[:path]
19
+
20
+ unless File.exists?("#{path}/config/pieces.yml")
21
+ puts "We could not find pieces.yml in #{path}/config/"
22
+ puts 'Sorry about that!'
23
+ exit(1)
24
+ end
25
+
19
26
  @route_config ||= YAML.load_file("#{path}/config/pieces.yml")
20
27
  end
21
28
 
@@ -27,7 +27,7 @@ module Pieces
27
27
  end
28
28
 
29
29
  def rebuild_pieces
30
- print "\n[pieces]: Rebuilding #{File.basename(path)}... "
30
+ print "\nRebuilding #{File.basename(path)}... "
31
31
  Pieces::Builder.new(path: path).send(build_method)
32
32
  puts 'done.'
33
33
  rescue => e
@@ -37,15 +37,18 @@ module Pieces
37
37
  end
38
38
 
39
39
  def output_backtrace(exception)
40
- puts "[pieces]: Exception occured: #{exception.message}"
41
- puts '[pieces]:'
40
+ puts "Exception<#{exception.class.name}>: #{exception.message}"
41
+ puts ''
42
42
 
43
43
  if defined?(::Rails)
44
44
  trace = ::Rails.backtrace_cleaner.clean(exception.backtrace)
45
- puts trace.map { |line| "[pieces]: #{line}" }
46
45
  else
47
- puts exception.backtrace.map { |line| "[pieces]: #{line}" }
46
+ trace = exception.backtrace
47
+ .delete_if { |line| !line.include?(path) }
48
+ .map { |line| line.sub("#{path}/", '') }
48
49
  end
50
+
51
+ puts trace.map { |line| " #{line}" }
49
52
  end
50
53
  end
51
54
  end
data/lib/pieces/server.rb CHANGED
@@ -21,17 +21,19 @@ module Pieces
21
21
  Sprockets::Environment.new.tap do |env|
22
22
  env.append_path 'app/assets/javascripts'
23
23
  env.append_path 'app/assets/stylesheets'
24
+ env.append_path 'app/views'
24
25
  end
25
26
  end
26
27
 
27
28
  def app
28
29
  urls = files_to_serve(path)
29
30
  build_path = "#{path}/build"
31
+ assets_app = sprockets_env
30
32
 
31
33
  Rack::Builder.app do
32
34
  use Rack::Reloader
33
35
  use Rack::Static, urls: urls, root: build_path, index: 'index.html'
34
- map('/assets') { run sprockets_env } unless defined? ::Rails
36
+ map('/assets') { run assets_app } unless defined? ::Rails
35
37
  run Proc.new { |env| [404, {}, ['Not found']] }
36
38
  end
37
39
  end
@@ -1,3 +1,3 @@
1
1
  module Pieces
2
- VERSION = '0.4.4'
2
+ VERSION = '0.4.5'
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.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Morton