roger 0.13.0 → 1.0.0

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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NTVmODQzZjA1Nzg0OGZmZWIzYmEwNDA4MGVlMjgxZWUzMjI5Njg2Yw==
5
- data.tar.gz: !binary |-
6
- ZWM0NjJiYjYzYzNmZWFmODdmMDM0MmM5ZmQxMmY1MjgyZDBjZGNkMw==
2
+ SHA1:
3
+ metadata.gz: ecc0ec2a17b553bfd87e14cfa37912f871a7dfcf
4
+ data.tar.gz: b7cfc1af54a97825b5e8e8391229c50e92db462c
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NDdmYTEzNDRlMWY3ZmQwNjU1NjcxYzY3NTJlZDk4M2QwNjUwMzE3MTE0MmJj
10
- MzMxZTQxOTBhYTI1ZmVkNzQ4YmFlZjAyZDY0OGIzODkyMDBmYmMwZjMyMGQ3
11
- ODQ1ZTdiYjliZjczMjEwYmQ4NTlkMTlkNzg4YTcwNWE0ZjllODE=
12
- data.tar.gz: !binary |-
13
- YTVhYzQyMTg0MzkxM2JmNmU0ZTQ3YjlmYTBkNzUyNGJjZjk0MmVhZDExNmI4
14
- MjRhOWJjNWRhMmY2OTg0ODIwODhjYjQyMTQyYTQ5ZDdmNWRiMDAzZGYxMzEw
15
- ZTIzMWMzOWE5YjA4YzE1OGE3NjRmMGRkYzgzMTYxNzQ1NTZlMjA=
6
+ metadata.gz: 6a7c25f086b27be5312061c869ff554521ed5a81ecd284e2311a2a3853d475e31fc51f0ae1d769fd1341df8fa051d7c818008bf57125165da9d5353057064be6
7
+ data.tar.gz: 4813688ee371de200b8797ee84edf1b5e7076e2cd88dd8663c53452ab1f41bc94cbe38175ba99a82a5216cfde9f9090c708f15f7ea23dd00e27c4700ea4090e7
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 1.0.0
4
+
5
+ There should be no breaking changes between 0.13.0 and 1.0.0
6
+
7
+ * Add support for generators giving themselves names through `self.register`
8
+ * Add support for setting hostname to listen to
9
+ * Default listening to 0.0.0.0 instead of localhost only
10
+ * Added more unittests for different CLI options
11
+ * Minor fixes
12
+
3
13
  ## Version 0.13.0
4
14
  *Attention* This is the last call version before 1.0.0 (5 years in sub 1.0.0 is more than enough)
5
15
 
@@ -1,5 +1,5 @@
1
- Copyright (c) 2009 Flurin Egger, DigitPaint (http://www.digitpaint.nl)
2
-
1
+ Copyright (c) 2015 DigitPaint (http://www.digitpaint.nl)
2
+
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
5
5
  "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@ without limitation the rights to use, copy, modify, merge, publish,
7
7
  distribute, sublicense, and/or sell copies of the Software, and to
8
8
  permit persons to whom the Software is furnished to do so, subject to
9
9
  the following conditions:
10
-
10
+
11
11
  The above copyright notice and this permission notice shall be
12
12
  included in all copies or substantial portions of the Software.
13
-
13
+
14
14
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
data/README.md CHANGED
@@ -69,11 +69,18 @@ It's not it just does some things differently.
69
69
 
70
70
  [View contributors](https://github.com/digitpaint/roger/graphs/contributors)
71
71
 
72
+ ## Logos
73
+
74
+ ![Logo Black/Yellow](https://raw.githubusercontent.com/DigitPaint/roger/master/doc/images/logo_black-yellow.png)
75
+ ![Logo Plain](https://raw.githubusercontent.com/DigitPaint/roger/master/doc/images/logo_plain-square.png)
76
+
77
+ More logo's [can be found in the doc/images folder](https://github.com/DigitPaint/roger/tree/master/doc/images)
78
+
72
79
  ## License
73
80
 
74
81
  (The MIT License)
75
82
 
76
- Copyright (c) 2014 Digitpaint
83
+ Copyright (c) 2015 Digitpaint
77
84
 
78
85
  Permission is hereby granted, free of charge, to any person obtaining
79
86
  a copy of this software and associated documentation files (the
data/doc/cli.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Command Line Interface
2
2
 
3
- The easiest way to get help is through the commandline by running
3
+ The easiest way to get help is through the commandline by running
4
4
 
5
5
  ```shell
6
6
  mockup help
@@ -35,6 +35,15 @@ mockup release [options]
35
35
 
36
36
  Releases the project
37
37
 
38
+ ## Test
39
+
40
+ ```shell
41
+ mockup test [options]
42
+ ```
43
+
44
+ Tests the project
45
+
46
+
38
47
  ## Global options
39
48
 
40
49
  All commands accept these options.
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="143.699" height="143.699" viewBox="0 0 143.699 143.699"><path fill="#F8ED43" d="M0 0h143.7v143.7H0z"/><path fill="#262626" d="M71.85 21.064c-22.05 0-39.99 17.938-39.99 39.988s17.94 39.99 39.99 39.99 39.99-17.94 39.99-39.99S93.9 21.064 71.85 21.064z"/><path fill="#F8ED43" d="M93.9 86.887c-4.41 1.97-11.176 3.76-17.96.803-6.22-2.71-7.838-7.71-9.55-13-1.78-5.496-3.796-11.726-11.458-15.015-7.97-3.423-13.563-2.085-17.034-.122.788-18.047 15.712-32.488 33.95-32.488 18.743 0 33.99 15.247 33.99 33.988 0 10.332-4.64 19.595-11.937 25.834z"/><path d="M53.713 119.5v-9.94h4.2c.43 0 .824.092 1.183.273s.67.42.93.714.465.628.61 1c.145.375.217.753.217 1.135 0 .364-.054.712-.16 1.043-.108.332-.258.63-.45.896s-.42.49-.692.68c-.27.18-.57.31-.91.37l2.44 3.84h-1.11l-2.33-3.66H54.7v3.67h-.98zm.98-4.536h3.248c.29 0 .56-.062.8-.188s.44-.297.61-.512c.17-.214.3-.457.39-.728.1-.27.14-.556.14-.854 0-.298-.05-.585-.16-.86-.1-.275-.25-.516-.43-.722-.18-.205-.39-.368-.64-.49-.25-.12-.5-.182-.77-.182H54.7v4.536zm10.865 4.676c-.532 0-1.018-.1-1.456-.3-.44-.2-.82-.475-1.14-.82-.323-.345-.573-.746-.75-1.203-.177-.458-.266-.938-.266-1.442 0-.514.09-1 .273-1.456.18-.46.43-.86.75-1.21s.7-.62 1.14-.83c.44-.21.92-.31 1.44-.31.52 0 1 .1 1.45.31.44.2.82.48 1.14.82.32.34.57.74.75 1.2.18.45.27.94.27 1.45 0 .5-.09.98-.27 1.44-.18.45-.43.85-.75 1.2-.32.34-.71.62-1.15.82-.44.2-.93.3-1.46.3zm-2.646-3.752c0 .41.07.79.21 1.142.14.35.33.657.567.924.23.266.51.474.84.623.32.15.66.224 1.02.224s.7-.07 1.03-.23c.32-.15.6-.36.84-.63.24-.26.43-.57.57-.93.14-.35.21-.73.21-1.14 0-.4-.07-.78-.21-1.14s-.33-.67-.58-.93c-.24-.26-.53-.47-.85-.63-.32-.15-.67-.23-1.03-.23s-.71.08-1.02.23c-.32.16-.6.37-.84.64s-.44.59-.58.95c-.14.36-.21.75-.21 1.16zm10.793 3.71c-.504 0-.963-.104-1.378-.314-.416-.21-.775-.488-1.078-.833-.31-.34-.54-.74-.71-1.19s-.25-.91-.25-1.38c0-.5.08-.98.24-1.45.16-.46.39-.86.69-1.21.3-.34.65-.62 1.07-.82.41-.2.87-.31 1.38-.31.62 0 1.16.16 1.62.47.46.32.85.71 1.17 1.19v-1.52h.85v7.32c0 .51-.1.95-.29 1.34-.19.39-.45.71-.77.97s-.7.46-1.14.59-.9.2-1.38.2c-.84 0-1.52-.15-2.03-.45s-.93-.7-1.25-1.2l.582-.46c.29.47.672.81 1.15 1.03.48.22.99.33 1.54.33.355 0 .69-.05 1.01-.15.316-.09.594-.24.832-.43.233-.19.423-.43.563-.73.14-.29.21-.63.21-1.02v-1.44c-.28.465-.665.834-1.15 1.104s-.99.406-1.524.406zm.266-.798c.28 0 .56-.05.83-.153.27-.104.52-.24.74-.413.22-.173.4-.366.56-.58.15-.216.25-.436.3-.66v-2.253c-.1-.26-.24-.5-.42-.72-.17-.22-.37-.41-.6-.57-.22-.16-.46-.28-.72-.38-.25-.09-.51-.14-.77-.14-.41 0-.78.09-1.1.26-.32.18-.59.4-.82.68-.22.28-.39.6-.51.95-.12.36-.17.72-.17 1.08 0 .39.07.77.21 1.12.14.36.336.67.58.93.25.27.537.48.864.63.33.16.68.23 1.066.23zm8.62.84c-.53 0-1.02-.1-1.46-.3-.44-.2-.83-.477-1.15-.827-.32-.35-.58-.753-.76-1.21-.18-.458-.27-.948-.27-1.47 0-.515.09-.997.27-1.45.19-.452.44-.85.76-1.19.32-.34.71-.61 1.16-.81.45-.2.94-.302 1.46-.302.537 0 1.02.11 1.468.31.44.2.82.48 1.14.82.317.35.565.74.74 1.19.177.45.267.93.267 1.43v.23c0 .08-.007.13-.015.16h-6.25c.027.4.12.76.27 1.09s.354.62.596.86c.24.24.52.43.834.57.31.14.643.2 1 .2.23 0 .464-.03.7-.1s.445-.15.64-.27c.2-.11.377-.25.537-.41.155-.16.28-.34.36-.54l.82.23c-.12.27-.28.514-.48.73-.21.22-.44.41-.71.574-.27.164-.57.29-.9.38-.33.09-.67.133-1.02.133zm2.69-4.172c-.03-.392-.12-.75-.27-1.07-.15-.322-.35-.6-.59-.833s-.51-.416-.82-.547c-.31-.13-.64-.195-1-.195-.35 0-.69.065-1.01.195-.31.13-.59.313-.83.547s-.43.513-.57.84c-.14.326-.23.68-.26 1.063h5.37zm6.02-2.422c-.64.02-1.2.196-1.68.532-.47.336-.81.798-1.01 1.386v4.536h-.95v-7.294h.9v1.75c.27-.56.64-1 1.1-1.316.46-.316.95-.476 1.47-.476.08 0 .14.005.18.014v.868z" fill="#262626"/><path fill="#EDDA11" d="M71.85 95.042c-18.06 0-32.867-14.157-33.923-31.955 2.504-1.94 7.583-4.19 15.822-.656 6.41 2.76 8.05 7.82 9.78 13.19 1.84 5.69 3.75 11.58 11.21 14.83 3.04 1.33 6.05 1.84 8.88 1.84.6 0 1.2-.02 1.78-.07-4.16 1.82-8.75 2.84-13.57 2.84z"/></svg>
Binary file
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="79.979" height="101.558" viewBox="0 0 79.979 101.558"><path fill="#262626" d="M39.99 0C17.94 0 0 17.938 0 39.988s17.94 39.99 39.99 39.99 39.99-17.94 39.99-39.99S62.04 0 39.99 0z"/><path fill="#F8ED43" d="M62.04 65.822c-4.41 1.97-11.176 3.76-17.96.803-6.22-2.71-7.838-7.71-9.55-13C32.75 48.13 30.734 41.9 23.072 38.61c-7.97-3.423-13.563-2.085-17.034-.122C6.826 20.44 21.75 6 39.988 6c18.743 0 33.99 15.247 33.99 33.988 0 10.332-4.64 19.596-11.937 25.834z"/><path d="M21.853 98.436v-9.94h4.2c.43 0 .824.092 1.183.273s.67.42.93.71.465.63.61 1c.145.37.217.75.217 1.13 0 .36-.054.71-.16 1.04-.108.33-.258.63-.45.89s-.42.49-.692.67c-.27.18-.57.3-.91.37l2.44 3.83h-1.11l-2.33-3.67h-2.94v3.67h-.98zm.98-4.537h3.248c.29 0 .56-.07.8-.19s.44-.3.61-.51c.17-.22.3-.46.39-.73.1-.27.14-.56.14-.86 0-.3-.05-.59-.16-.86-.1-.28-.25-.52-.43-.72-.18-.21-.39-.37-.64-.49s-.5-.18-.77-.18h-3.17v4.54zm10.864 4.67c-.532 0-1.018-.1-1.456-.3-.43-.2-.81-.48-1.14-.82-.32-.35-.57-.75-.75-1.21-.17-.46-.26-.94-.26-1.44 0-.52.09-1 .28-1.46.18-.46.44-.86.76-1.21s.7-.62 1.14-.83c.44-.21.92-.31 1.45-.31.52 0 1.01.1 1.45.31.44.2.83.48 1.15.82.32.34.57.74.76 1.2.19.45.28.94.28 1.45 0 .5-.09.98-.264 1.44-.174.45-.424.86-.75 1.2-.32.35-.7.62-1.144.82-.44.2-.93.3-1.46.3zm-2.647-3.75c0 .41.07.79.21 1.14.14.35.33.65.57.92.24.26.52.47.84.62.32.15.666.22 1.03.22s.707-.08 1.03-.23c.32-.16.603-.37.846-.63.242-.27.434-.58.574-.93.14-.36.21-.74.21-1.15 0-.4-.07-.79-.21-1.15s-.333-.67-.575-.94c-.243-.27-.525-.48-.847-.63-.322-.16-.665-.23-1.03-.23-.363 0-.704.07-1.02.23-.32.15-.6.36-.84.63s-.435.59-.575.95c-.14.36-.21.74-.21 1.15zm10.796 3.71c-.504 0-.963-.11-1.378-.32-.416-.21-.775-.49-1.078-.84-.304-.35-.54-.74-.708-1.19s-.25-.91-.25-1.39c0-.51.08-.99.245-1.45.163-.46.394-.87.693-1.21.298-.35.656-.62 1.07-.83.417-.21.876-.31 1.38-.31.625 0 1.166.15 1.623.47.46.31.85.7 1.178 1.18v-1.52h.86v7.32c0 .5-.09.95-.28 1.33-.19.39-.45.71-.77.97s-.7.454-1.13.59-.89.2-1.38.2c-.84 0-1.51-.15-2.03-.45s-.93-.7-1.24-1.2l.59-.46c.29.462.67.81 1.15 1.03.48.22.99.33 1.54.33.36 0 .69-.05 1.01-.15.32-.1.6-.246.84-.438.24-.19.43-.44.57-.73.14-.297.21-.64.21-1.03V97c-.28.466-.66.835-1.146 1.105s-.996.403-1.53.403zm.267-.8c.28 0 .558-.05.827-.16.27-.11.515-.24.735-.42.22-.18.402-.37.553-.59.148-.22.246-.44.293-.66v-2.25c-.1-.26-.24-.51-.42-.73-.17-.23-.37-.42-.6-.57-.22-.16-.46-.29-.72-.38-.26-.1-.51-.14-.78-.14-.41 0-.77.08-1.1.26-.32.17-.59.4-.82.68-.22.28-.39.59-.51.95-.11.35-.17.71-.17 1.08 0 .39.07.76.21 1.12.14.35.34.66.58.93.25.26.54.47.86.63.33.15.68.23 1.07.23zm8.61.84c-.532 0-1.02-.1-1.463-.3-.444-.2-.83-.48-1.156-.83-.326-.35-.58-.76-.763-1.21-.18-.46-.27-.95-.27-1.47s.09-1 .27-1.45c.18-.45.44-.85.76-1.19.32-.34.71-.61 1.16-.81.45-.2.94-.3 1.46-.3.53 0 1.02.1 1.47.3.45.2.83.47 1.14.82.32.34.57.74.75 1.19.18.44.27.92.27 1.43v.22c0 .07 0 .12-.01.15H48.1c.03.39.12.75.272 1.08s.35.62.594.86.52.43.834.56c.31.13.644.2 1 .2.23 0 .465-.04.7-.1s.446-.16.64-.27c.195-.11.37-.25.53-.41.16-.17.28-.35.36-.54l.83.22c-.112.27-.27.52-.48.73-.2.22-.44.41-.71.575-.27.163-.57.29-.892.38-.323.09-.664.133-1.02.133zm2.69-4.17c-.03-.39-.12-.75-.274-1.07-.16-.32-.35-.6-.59-.83s-.52-.42-.83-.55c-.31-.13-.65-.2-1-.2-.36 0-.69.06-1.01.19-.32.13-.6.31-.83.55s-.43.51-.58.84c-.15.32-.23.68-.26 1.06h5.36zm6.018-2.42c-.64.02-1.2.19-1.68.53-.47.33-.81.8-1 1.38v4.53h-.95v-7.29h.9v1.75c.27-.56.64-1 1.1-1.32.46-.32.95-.48 1.47-.48.08 0 .14 0 .18.01v.87z" fill="#262626"/><path fill="#EDDA11" d="M39.99 73.978c-18.06 0-32.867-14.157-33.923-31.955 2.504-1.94 7.583-4.19 15.822-.656 6.41 2.753 8.05 7.818 9.78 13.182 1.84 5.69 3.75 11.57 11.21 14.82 3.04 1.32 6.05 1.84 8.88 1.84.6 0 1.2-.03 1.78-.07-4.16 1.81-8.75 2.83-13.57 2.83z"/></svg>
@@ -47,21 +47,26 @@ module Roger
47
47
  end
48
48
  end
49
49
 
50
- class_option :path,
50
+ class_option :path,
51
51
  :desc => "Project root path",
52
- :type => :string,
53
- :required => false,
52
+ :type => :string,
53
+ :required => false,
54
54
  :default => "."
55
55
 
56
56
  class_option :html_path,
57
57
  :desc => 'The document root, defaults to "[directory]/html"',
58
58
  :type => :string
59
59
 
60
-
61
60
  class_option :partial_path,
62
61
  :desc => 'Defaults to [directory]/partials',
63
62
  :type => :string
64
-
63
+
64
+ class_option :verbose,
65
+ :desc => "Sets verbose output",
66
+ :aliases => ["-v"],
67
+ :default => false,
68
+ :type => :boolean
69
+
65
70
  desc "test [COMMAND]", "Run one or more tests. Test can be 'all' for all defined tests or a specific test name"
66
71
  subcommand "test", Cli::Test
67
72
 
@@ -73,7 +78,7 @@ module Roger
73
78
 
74
79
  register Cli::Release, "release", "release #{Cli::Release.arguments.map{ |arg| arg.banner }.join(" ")}", Cli::Release.desc
75
80
  self.tasks["release"].options = Cli::Release.class_options
76
-
81
+
77
82
  protected
78
83
 
79
84
  # TODO: handle options
@@ -82,10 +87,10 @@ module Roger
82
87
  puts "[ERROR]: Don't use the \"html\" path, use the project base path instead"
83
88
  exit(1)
84
89
  end
85
-
90
+
86
91
  Project.new(options[:path], {:shell => self.shell}.update(options))
87
92
  end
88
-
93
+
89
94
  end
90
95
 
91
96
  end
@@ -4,12 +4,6 @@ module Roger
4
4
  def self.exit_on_failure?
5
5
  true
6
6
  end
7
-
8
- class_option :verbose,
9
- :desc => "Set's verbose output",
10
- :aliases => ["-v"],
11
- :default => false,
12
- :type => :boolean
13
7
 
14
8
 
15
9
  def initialize_project
@@ -1,7 +1,7 @@
1
- module Roger
2
- class Cli::Generate < Thor
1
+ module Roger::Cli
2
+ class Generate < Thor
3
3
  def self.exit_on_failure?
4
4
  true
5
5
  end
6
6
  end
7
- end
7
+ end
@@ -5,25 +5,28 @@ module Roger
5
5
  desc "Serve the current project"
6
6
 
7
7
  class_options :port => :string, # Defaults to 9000
8
- :handler => :string, # The handler to use (defaults to mongrel)
9
- :validate => :boolean # Run validation?
8
+ :host => :string, # Defaults to 0.0.0.0
9
+ :handler => :string # The handler to use (defaults to mongrel)
10
10
 
11
11
  def serve
12
-
13
- server_options = {}
12
+ server_options = {}
14
13
  options.each{|k,v| server_options[k.to_sym] = v }
15
14
  server_options[:server] = {}
16
- [:port, :handler, :validate].each do |k|
15
+ [:port, :handler, :host].each do |k|
17
16
  server_options[:server][k] = server_options.delete(k) if server_options.has_key?(k)
18
17
  end
19
-
18
+
20
19
  server = @project.server
21
20
  server.set_options(server_options[:server])
22
-
23
- puts "Running Roger with #{server.handler.inspect} on port #{server.port}"
24
- puts project_banner(@project)
25
-
26
- server.run!
21
+
22
+ puts "Running Roger with #{server.handler.inspect} on #{server.host}:#{server.port}"
23
+ puts project_banner(@project)
24
+ end
25
+
26
+ # Hack so we can override it in tests.
27
+ def start
28
+ @project.server.run!
27
29
  end
28
30
  end
29
- end
31
+ end
32
+
@@ -7,11 +7,22 @@ module Roger
7
7
  class Base < Cli::Command
8
8
  end
9
9
 
10
- def self.register(sub)
11
- name = sub.to_s.sub(/Generator$/, "").sub(/^.*Generators::/,"").downcase
10
+ def self.register(name, sub = nil)
11
+ # Hack to not break old tasks
12
+ if name.kind_of?(Class)
13
+ sub = name
14
+ name = sub.to_s.sub(/Generator$/, "").sub(/^.*Generators::/,"").downcase
15
+ else
16
+ raise ArgumentError, "Name must be a symbol" unless name.kind_of?(Symbol)
17
+ end
18
+
19
+ name = name.to_s
20
+
21
+ raise ArgumentError, "Another generator has already claimed the name #{name.inspect}" if Cli::Generate.tasks.has_key?(name)
22
+
12
23
  usage = "#{name} #{sub.arguments.map{ |arg| arg.banner }.join(" ")}"
13
24
  long_desc = sub.desc || "Run #{name} generator"
14
-
25
+
15
26
  Cli::Generate.register sub, name, usage, long_desc
16
27
  Cli::Generate.tasks[name].options = sub.class_options if sub.class_options
17
28
  end
@@ -15,16 +15,16 @@ module Roger
15
15
  end
16
16
  end
17
17
  end
18
-
18
+
19
19
  def debug(part, msg, &block)
20
20
  self.log(part, msg, true, &block)
21
21
  end
22
-
22
+
23
23
  # Write out a warning message
24
24
  def warn(part, msg)
25
25
  self.project.shell.say "\033[37m#{part.class.to_s}\033[0m" + " : " + "\033[31m#{msg.to_s}\033[0m", nil, true
26
26
  end
27
-
27
+
28
28
  end
29
29
  end
30
30
  end
@@ -1,28 +1,28 @@
1
1
  module Roger
2
2
  # Loader for mockupfile
3
3
  class Mockupfile
4
-
4
+
5
5
  # This is the context for the mockupfile evaluation. It should be empty except for the
6
6
  # #mockup method.
7
7
  class Context
8
-
8
+
9
9
  def initialize(mockupfile)
10
10
  @_mockupfile = mockupfile
11
11
  end
12
-
12
+
13
13
  def mockup
14
14
  @_mockupfile
15
15
  end
16
-
16
+
17
17
  def binding
18
18
  ::Kernel.binding
19
19
  end
20
-
20
+
21
21
  end
22
-
22
+
23
23
  # @attr :path [Pathname] The path of the Mockupfile for this project
24
24
  attr_accessor :path, :project
25
-
25
+
26
26
  def initialize(project, path = nil)
27
27
  @project = project
28
28
  @path = (path && Pathname.new(path)) || Pathname.new(project.path + "Mockupfile")
@@ -35,26 +35,26 @@ module Roger
35
35
  context = Context.new(self)
36
36
  eval @source, context.binding, @path.to_s, 1
37
37
  @loaded = true
38
- end
38
+ end
39
39
  end
40
-
40
+
41
41
  # Wether or not the Mockupfile has been loaded
42
42
  def loaded?
43
43
  @loaded
44
44
  end
45
-
45
+
46
46
  def release
47
47
  if block_given?
48
48
  yield(self.project.release)
49
49
  end
50
- self.project.release
50
+ self.project.release
51
51
  end
52
-
52
+
53
53
  def serve
54
54
  if block_given?
55
55
  yield(self.project.server)
56
56
  end
57
- self.project.server
57
+ self.project.server
58
58
  end
59
59
 
60
60
  alias :server :serve
@@ -65,6 +65,6 @@ module Roger
65
65
  end
66
66
  self.project.test
67
67
  end
68
-
68
+
69
69
  end
70
70
  end
@@ -7,37 +7,37 @@ require File.dirname(__FILE__) + "/mockupfile"
7
7
  module Roger
8
8
  # Loader for mockupfile and project dependencies
9
9
  class Project
10
-
10
+
11
11
  # @attr :path [Pathname] The project path
12
12
  # @attr :html_path [Pathname] The path of the HTML mockup
13
13
  # @attr :partial_path [Pathname] The path for the partials for this mockup
14
14
  # @attr :mockupfile [Mockupfile] The Mockupfile for this project
15
15
  # @attr :mockupfile_path [Pathname] The path to the Mockupfile
16
16
  attr_accessor :path, :html_path, :partial_path, :layouts_path, :mockupfile, :mockupfile_path
17
-
17
+
18
18
  attr_accessor :shell
19
-
19
+
20
20
  attr_accessor :options
21
-
21
+
22
22
  def initialize(path, options={})
23
23
  @path = Pathname.new(path)
24
-
24
+
25
25
  @options = {
26
26
  :html_path => @path + "html",
27
27
  :partial_path => @path + "partials",
28
28
  :layouts_path => @path + "layouts",
29
29
  :mockupfile_path => @path + "Mockupfile"
30
30
  }
31
-
31
+
32
32
  # Clumsy string to symbol key conversion
33
33
  options.each{|k,v| @options[k.is_a?(String) ? k.to_sym : k] = v }
34
-
34
+
35
35
  self.html_path = @options[:html_path]
36
36
  self.partial_path = @options[:partials_path] || @options[:partial_path] || self.html_path + "../partials/"
37
37
  self.layouts_path = @options[:layouts_path]
38
38
  self.mockupfile_path = @options[:mockupfile_path]
39
39
  self.shell = @options[:shell]
40
-
40
+
41
41
  if self.mockupfile_path
42
42
  @mockupfile = Mockupfile.new(self, self.mockupfile_path)
43
43
  @mockupfile.load
@@ -46,18 +46,18 @@ module Roger
46
46
  end
47
47
 
48
48
  end
49
-
49
+
50
50
  def shell
51
51
  @shell ||= Thor::Base.shell.new
52
52
  end
53
-
53
+
54
54
  def server
55
55
  options = @options[:server] || {}
56
56
  @server ||= Server.new(self, options)
57
57
  end
58
-
58
+
59
59
  def release
60
- options = @options[:release] || {}
60
+ options = @options[:release] || {}
61
61
  @release ||= Release.new(self, options)
62
62
  end
63
63
 
@@ -65,21 +65,21 @@ module Roger
65
65
  options = @options[:test] || {}
66
66
  @test ||= Test.new(self, options)
67
67
  end
68
-
68
+
69
69
  def html_path=(p)
70
70
  @html_path = self.realpath_or_path(p)
71
71
  end
72
-
72
+
73
73
  def partial_path=(p)
74
74
  @partial_path = self.single_or_multiple_paths(p)
75
75
  end
76
76
  alias :partials_path :partial_path
77
77
  alias :partials_path= :partial_path=
78
-
78
+
79
79
  def layouts_path=(p)
80
80
  @layouts_path = self.single_or_multiple_paths(p)
81
81
  end
82
-
82
+
83
83
  protected
84
84
 
85
85
  def single_or_multiple_paths(p)
@@ -89,15 +89,15 @@ module Roger
89
89
  self.realpath_or_path(p)
90
90
  end
91
91
  end
92
-
92
+
93
93
  def realpath_or_path(path)
94
94
  path = Pathname.new(path)
95
95
  if path.exist?
96
96
  path.realpath
97
97
  else
98
98
  path
99
- end
99
+ end
100
100
  end
101
-
101
+
102
102
  end
103
103
  end