scharfie-bones 0.2.5 → 0.2.6
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.
- data/bin/bones +3 -2
- data/lib/bones/bones.rb +22 -1
- data/lib/bones/cache.rb +2 -2
- data/lib/bones/extensions.rb +18 -2
- data/lib/bones/release.rb +2 -2
- data/lib/bones/server.rb +2 -2
- data/lib/bones/static.rb +2 -2
- data/lib/bones.rb +23 -1
- data/lib/tasks/bones.rb +9 -9
- data/pushables/Rakefile +1 -1
- data/pushables/boot.rb +4 -5
- data/scharfie-bones.gemspec +12 -5
- data/test/test_helper.rb +2 -2
- metadata +44 -17
- data/lib/bones/boot.rb +0 -38
data/bin/bones
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '../lib/bones.rb'))
|
3
4
|
require File.expand_path(File.join(File.dirname(__FILE__), '../lib/bones/initializer.rb'))
|
4
5
|
path = ARGV.shift
|
5
6
|
|
@@ -12,4 +13,4 @@ end
|
|
12
13
|
path = File.expand_path(path)
|
13
14
|
FileUtils.mkdir(path) unless File.directory?(path)
|
14
15
|
|
15
|
-
Bones::Initializer.run(path)
|
16
|
+
Bones::Initializer.run(path)
|
data/lib/bones/bones.rb
CHANGED
@@ -37,6 +37,27 @@ class Bones
|
|
37
37
|
def booted?
|
38
38
|
@booted
|
39
39
|
end
|
40
|
+
|
41
|
+
def directories(base)
|
42
|
+
Dir.chdir(base) do
|
43
|
+
Dir.entries(base).map do |e|
|
44
|
+
next if e =~ /^\.+$/
|
45
|
+
File.directory?(base / e) ? '/' + e : nil
|
46
|
+
end.compact
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def page_directories
|
51
|
+
directories(Bones.root / 'pages')
|
52
|
+
end
|
53
|
+
|
54
|
+
def versioned_directories
|
55
|
+
Bones::VersionedRelease.directories
|
56
|
+
end
|
57
|
+
|
58
|
+
def public_directories
|
59
|
+
directories(Bones.root / 'public') - page_directories - versioned_directories
|
60
|
+
end
|
40
61
|
end
|
41
62
|
|
42
63
|
# Resets root, pages, and layouts paths and the base setting
|
@@ -70,4 +91,4 @@ class Bones
|
|
70
91
|
end.compact
|
71
92
|
end
|
72
93
|
end
|
73
|
-
end
|
94
|
+
end
|
data/lib/bones/cache.rb
CHANGED
@@ -162,7 +162,7 @@ class Bones
|
|
162
162
|
# # => /some_folder/page_path.html
|
163
163
|
def normalize_url(path)
|
164
164
|
@known_pairs ||= {}
|
165
|
-
@public_directories_regex ||= Regexp.new(public_directories.join('|'))
|
165
|
+
@public_directories_regex ||= Regexp.new(Bones.public_directories.join('|'))
|
166
166
|
|
167
167
|
if v = @known_pairs[path]
|
168
168
|
return v
|
@@ -192,4 +192,4 @@ end
|
|
192
192
|
|
193
193
|
if __FILE__ == $0
|
194
194
|
Bones::Cache.run(ARGV)
|
195
|
-
end
|
195
|
+
end
|
data/lib/bones/extensions.rb
CHANGED
@@ -6,6 +6,13 @@ class String
|
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
+
|
10
|
+
class Object
|
11
|
+
def self.remove
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
9
16
|
# Loads filename, removing the associated
|
10
17
|
# class if defined
|
11
18
|
#
|
@@ -20,7 +27,16 @@ end
|
|
20
27
|
# and then load the application.rb file
|
21
28
|
def force_load(map={})
|
22
29
|
map.each do |klass, filename|
|
23
|
-
|
30
|
+
if defined?(klass.name)
|
31
|
+
basename = klass.to_s.split("::").last
|
32
|
+
parent = klass.parent
|
33
|
+
|
34
|
+
# Skip this class if it does not match the current one bound to this name
|
35
|
+
next unless parent.const_defined?(basename) && klass = parent.const_get(basename)
|
36
|
+
|
37
|
+
parent.instance_eval { remove_const basename } unless parent == klass
|
38
|
+
end
|
39
|
+
|
24
40
|
load filename
|
25
41
|
end
|
26
|
-
end
|
42
|
+
end
|
data/lib/bones/release.rb
CHANGED
@@ -20,9 +20,9 @@ class Bones
|
|
20
20
|
|
21
21
|
# Copies all public directories to the new release directory
|
22
22
|
def copy_public_directories
|
23
|
-
public_directories.each do |src|
|
23
|
+
Bones.public_directories.each do |src|
|
24
24
|
FileUtils.copy_entry Bones.root / 'public' / src, destination / src
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|
data/lib/bones/server.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class Bones
|
2
2
|
class Server
|
3
3
|
def self.run
|
4
|
-
statics = public_directories
|
4
|
+
statics = Bones.public_directories
|
5
5
|
app = Rack::Builder.new do
|
6
6
|
use Rack::CommonLogger
|
7
7
|
use Rack::ShowExceptions
|
@@ -21,4 +21,4 @@ class Bones
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
Bones::Server.run if __FILE__ == $0
|
24
|
+
Bones::Server.run if __FILE__ == $0
|
data/lib/bones/static.rb
CHANGED
data/lib/bones.rb
CHANGED
@@ -1 +1,23 @@
|
|
1
|
-
require
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
gem 'activesupport', '>= 2.3.10'
|
4
|
+
gem 'rack', '>= 0.3.0'
|
5
|
+
|
6
|
+
require 'rack'
|
7
|
+
require 'active_support'
|
8
|
+
require 'active_support/dependencies'
|
9
|
+
require 'active_support/core_ext'
|
10
|
+
require 'pathname'
|
11
|
+
require 'yaml'
|
12
|
+
require 'fileutils'
|
13
|
+
require 'optparse'
|
14
|
+
require 'ostruct'
|
15
|
+
require 'erb'
|
16
|
+
|
17
|
+
require Pathname.new(__FILE__).dirname.join('bones/bones.rb')
|
18
|
+
require Pathname.new(__FILE__).dirname.join('bones/extensions.rb')
|
19
|
+
|
20
|
+
ActiveSupport::Dependencies.autoload_paths.push Bones.system_path
|
21
|
+
$:.push Bones.system_path
|
22
|
+
|
23
|
+
Bones.booted = true
|
data/lib/tasks/bones.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '../bones
|
1
|
+
require File.join(File.dirname(__FILE__), '../bones.rb')
|
2
2
|
|
3
3
|
task :default => :server
|
4
4
|
|
@@ -22,13 +22,13 @@ namespace :cache do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def generate_options_from_environment(extra={})
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
options = Bones::Cache::Options.new
|
26
|
+
destination = destination_from_environment
|
27
|
+
options.base = ENV['BASE'] unless ENV['BASE'].blank?
|
28
|
+
options.destination = destination unless destination.blank?
|
29
|
+
options.noop = true if ENV['NOOP']
|
30
|
+
options.merge extra
|
31
|
+
options
|
32
32
|
end
|
33
33
|
|
34
34
|
task :simple do
|
@@ -48,4 +48,4 @@ task :clean do
|
|
48
48
|
# ARGV.shift
|
49
49
|
# ARGV.unshift '--clean'
|
50
50
|
# load File.join(File.dirname(__FILE__), 'cache.rb')
|
51
|
-
end
|
51
|
+
end
|
data/pushables/Rakefile
CHANGED
data/pushables/boot.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
|
1
|
+
vendor_bones = File.join(File.dirname(__FILE__), 'vendor/bones/lib/bones.rb')
|
2
2
|
|
3
|
-
if File.file?(
|
4
|
-
require
|
3
|
+
if File.file?(vendor_bones)
|
4
|
+
require vendor_bones
|
5
5
|
else
|
6
6
|
require 'rubygems'
|
7
7
|
require 'bones'
|
8
|
-
require 'bones/boot'
|
9
8
|
end
|
10
9
|
|
11
|
-
Bones.root = File.expand_path(File.dirname(__FILE__))
|
10
|
+
Bones.root = File.expand_path(File.dirname(__FILE__))
|
data/scharfie-bones.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "scharfie-bones"
|
3
|
-
s.version = "0.2.
|
4
|
-
s.date = "
|
3
|
+
s.version = "0.2.6"
|
4
|
+
s.date = "2011-02-15"
|
5
5
|
s.authors = ["Chris Scharf", "Ryan Heath"]
|
6
6
|
s.email = "scharfie@gmail.com"
|
7
7
|
|
@@ -29,7 +29,6 @@ Gem::Specification.new do |s|
|
|
29
29
|
'lib/bones/template.rb',
|
30
30
|
'lib/bones/versioned_release.rb',
|
31
31
|
'lib/bones/bones.rb',
|
32
|
-
'lib/bones/boot.rb',
|
33
32
|
'lib/bones/extensions.rb',
|
34
33
|
'lib/bones.rb',
|
35
34
|
'lib/helpers',
|
@@ -77,7 +76,15 @@ Gem::Specification.new do |s|
|
|
77
76
|
'pushables/Rakefile'
|
78
77
|
]
|
79
78
|
|
79
|
+
s.test_files = [
|
80
|
+
'test/test_bones.rb',
|
81
|
+
'test/test_cache.rb',
|
82
|
+
'test/test_template.rb',
|
83
|
+
'test/test_example_site.rb',
|
84
|
+
'test/test_helper.rb'
|
85
|
+
]
|
86
|
+
|
80
87
|
# Dependencies
|
81
88
|
s.add_dependency("rack", [">= 0.3.0"])
|
82
|
-
s.add_dependency("activesupport", [">= 2.
|
83
|
-
end
|
89
|
+
s.add_dependency("activesupport", [">= 2.3.10"])
|
90
|
+
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scharfie-bones
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 6
|
10
|
+
version: 0.2.6
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Chris Scharf
|
@@ -10,29 +16,41 @@ autorequire:
|
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
18
|
|
13
|
-
date:
|
19
|
+
date: 2011-02-15 00:00:00 -05:00
|
14
20
|
default_executable: bones
|
15
21
|
dependencies:
|
16
22
|
- !ruby/object:Gem::Dependency
|
17
23
|
name: rack
|
18
|
-
|
19
|
-
|
20
|
-
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
21
27
|
requirements:
|
22
28
|
- - ">="
|
23
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 19
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
- 3
|
34
|
+
- 0
|
24
35
|
version: 0.3.0
|
25
|
-
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
26
38
|
- !ruby/object:Gem::Dependency
|
27
39
|
name: activesupport
|
28
|
-
|
29
|
-
|
30
|
-
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
31
43
|
requirements:
|
32
44
|
- - ">="
|
33
45
|
- !ruby/object:Gem::Version
|
34
|
-
|
35
|
-
|
46
|
+
hash: 23
|
47
|
+
segments:
|
48
|
+
- 2
|
49
|
+
- 3
|
50
|
+
- 10
|
51
|
+
version: 2.3.10
|
52
|
+
type: :runtime
|
53
|
+
version_requirements: *id002
|
36
54
|
description: Simple HTML mockup framework for designers using ERB
|
37
55
|
email: scharfie@gmail.com
|
38
56
|
executables:
|
@@ -53,7 +71,6 @@ files:
|
|
53
71
|
- lib/bones/template.rb
|
54
72
|
- lib/bones/versioned_release.rb
|
55
73
|
- lib/bones/bones.rb
|
56
|
-
- lib/bones/boot.rb
|
57
74
|
- lib/bones/extensions.rb
|
58
75
|
- lib/bones.rb
|
59
76
|
- lib/helpers/application_helper.rb
|
@@ -92,23 +109,33 @@ rdoc_options: []
|
|
92
109
|
require_paths:
|
93
110
|
- lib
|
94
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
95
113
|
requirements:
|
96
114
|
- - ">="
|
97
115
|
- !ruby/object:Gem::Version
|
116
|
+
hash: 3
|
117
|
+
segments:
|
118
|
+
- 0
|
98
119
|
version: "0"
|
99
|
-
version:
|
100
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
101
122
|
requirements:
|
102
123
|
- - ">="
|
103
124
|
- !ruby/object:Gem::Version
|
125
|
+
hash: 3
|
126
|
+
segments:
|
127
|
+
- 0
|
104
128
|
version: "0"
|
105
|
-
version:
|
106
129
|
requirements: []
|
107
130
|
|
108
131
|
rubyforge_project:
|
109
|
-
rubygems_version: 1.3.
|
132
|
+
rubygems_version: 1.3.7
|
110
133
|
signing_key:
|
111
134
|
specification_version: 3
|
112
135
|
summary: Simple HTML mockup framework for designers using ERB
|
113
|
-
test_files:
|
114
|
-
|
136
|
+
test_files:
|
137
|
+
- test/test_bones.rb
|
138
|
+
- test/test_cache.rb
|
139
|
+
- test/test_template.rb
|
140
|
+
- test/test_example_site.rb
|
141
|
+
- test/test_helper.rb
|
data/lib/bones/boot.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'activesupport'
|
3
|
-
require 'rack'
|
4
|
-
require 'pathname'
|
5
|
-
require Pathname.new(__FILE__).dirname.join('bones.rb')
|
6
|
-
require Pathname.new(__FILE__).dirname.join('extensions.rb')
|
7
|
-
|
8
|
-
ActiveSupport::Dependencies.load_paths.push Bones.system_path
|
9
|
-
$:.push Bones.system_path
|
10
|
-
|
11
|
-
require 'yaml'
|
12
|
-
require 'fileutils'
|
13
|
-
require 'optparse'
|
14
|
-
require 'ostruct'
|
15
|
-
require 'erb'
|
16
|
-
|
17
|
-
Bones.booted = true
|
18
|
-
|
19
|
-
def directories(base)
|
20
|
-
Dir.chdir(base) do
|
21
|
-
Dir.entries(base).map do |e|
|
22
|
-
next if e =~ /^\.+$/
|
23
|
-
File.directory?(base / e) ? '/' + e : nil
|
24
|
-
end.compact
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def page_directories
|
29
|
-
directories(Bones.root / 'pages')
|
30
|
-
end
|
31
|
-
|
32
|
-
def versioned_directories
|
33
|
-
Bones::VersionedRelease.directories
|
34
|
-
end
|
35
|
-
|
36
|
-
def public_directories
|
37
|
-
directories(Bones.root / 'public') - page_directories - versioned_directories
|
38
|
-
end
|