siteleaf 0.9.3 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -2
- data/README.md +12 -0
- data/bin/siteleaf +32 -12
- data/lib/siteleaf/server.rb +13 -9
- data/lib/siteleaf/version.rb +1 -1
- metadata +1 -1
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -51,6 +51,18 @@ Your local folder should contain at least one template file (`default.html`), fo
|
|
51
51
|
|
52
52
|
For new sites, you will also need to create at least one page or post on https://manage.siteleaf.com in order to preview.
|
53
53
|
|
54
|
+
**Download your theme:**
|
55
|
+
|
56
|
+
To download your theme (or the default theme for new sites) from Siteleaf, run the following command:
|
57
|
+
|
58
|
+
siteleaf pull theme
|
59
|
+
|
60
|
+
**Upload your theme:**
|
61
|
+
|
62
|
+
To upload your theme to Siteleaf, run the following command:
|
63
|
+
|
64
|
+
siteleaf push theme
|
65
|
+
|
54
66
|
|
55
67
|
Using this gem in your application
|
56
68
|
----------------------------------
|
data/bin/siteleaf
CHANGED
@@ -8,24 +8,43 @@ require 'securerandom'
|
|
8
8
|
require 'zip'
|
9
9
|
|
10
10
|
def help
|
11
|
-
|
11
|
+
%Q(
|
12
|
+
Usage: siteleaf [COMMAND] [OPTIONS]
|
13
|
+
|
14
|
+
Commands:
|
15
|
+
auth Login in with your credentials
|
16
|
+
s, server Starts a local server.
|
17
|
+
c, config DOMAIN Configure an existing directory
|
18
|
+
n, new DOMAIN Creates new site on siteleaf.net
|
19
|
+
pull theme Pulls theme files for configured site from Siteleaf
|
20
|
+
push theme Pushes all files in dir as theme to configured site.
|
21
|
+
help Prints this help document
|
22
|
+
version Prints the siteleaf gem version
|
23
|
+
|
24
|
+
Options:
|
25
|
+
-h, --help Prints this help document
|
26
|
+
-v, --version Prints the siteleaf gem version
|
27
|
+
-p, --port PORT Binds local server to PORT (default: 9292)
|
28
|
+
|
29
|
+
See https://github.com/siteleaf/siteleaf-gem for additional documentation.
|
30
|
+
)
|
12
31
|
end
|
13
32
|
|
14
33
|
def auth(re_auth = false)
|
15
34
|
Siteleaf.load_settings if !re_auth
|
16
|
-
|
35
|
+
|
17
36
|
if re_auth or !Siteleaf.api_key
|
18
37
|
print 'Enter your Siteleaf e-mail: '
|
19
38
|
email = $stdin.gets.chomp
|
20
|
-
|
39
|
+
|
21
40
|
print 'Enter your Siteleaf password: '
|
22
41
|
system 'stty -echo'
|
23
42
|
password = $stdin.gets.chomp
|
24
43
|
system 'stty echo'
|
25
|
-
|
44
|
+
|
26
45
|
puts "\nAuthorizing..."
|
27
|
-
|
28
|
-
if auth = Siteleaf::Client.auth(email, password) and auth.is_a?(Hash) and auth.has_key?('api_key')
|
46
|
+
|
47
|
+
if auth = Siteleaf::Client.auth(email, password) and auth.is_a?(Hash) and auth.has_key?('api_key')
|
29
48
|
File.open(Siteleaf.settings_file,'w') do|file|
|
30
49
|
Marshal.dump({:api_key => auth['api_key'], :api_secret => auth['api_secret']}, file)
|
31
50
|
end
|
@@ -42,7 +61,7 @@ def config(site)
|
|
42
61
|
|
43
62
|
require 'siteleaf'
|
44
63
|
run Siteleaf::Server.new(:site_id => '#{site.id}')" }
|
45
|
-
|
64
|
+
|
46
65
|
pow_path = File.expand_path('~/.pow')
|
47
66
|
if File.directory?(pow_path)
|
48
67
|
site_no_tld = site.domain.gsub(/\.[a-z]{0,4}$/i,'')
|
@@ -98,13 +117,14 @@ def put_theme_assets(site_id)
|
|
98
117
|
end
|
99
118
|
|
100
119
|
case ARGV[0]
|
101
|
-
when '-v', '--version'
|
120
|
+
when '-v', '--version', 'version'
|
102
121
|
puts Siteleaf::VERSION
|
103
|
-
when '-h', '--help'
|
122
|
+
when '-h', '--help', 'help'
|
104
123
|
puts help
|
105
124
|
when 's', 'server'
|
106
125
|
if File.exist?('config.ru')
|
107
|
-
|
126
|
+
port = ARGV[2] if %w[-p --port].include?(ARGV[1]) && ARGV[1]
|
127
|
+
`rackup config.ru -p #{port || '9292'}`
|
108
128
|
else
|
109
129
|
puts "No config found, run `siteleaf config yoursite.com`.\n"
|
110
130
|
end
|
@@ -147,11 +167,11 @@ when 'push'
|
|
147
167
|
put_theme_assets(site_id)
|
148
168
|
else
|
149
169
|
puts "Site not configured, run `siteleaf config yoursite.com`.\n"
|
150
|
-
end
|
170
|
+
end
|
151
171
|
else
|
152
172
|
puts "`#{ARGV[0]}` command not found.\n"
|
153
173
|
end
|
154
174
|
else
|
155
175
|
puts "`#{ARGV[0]}` command not found.\n"
|
156
176
|
puts help
|
157
|
-
end
|
177
|
+
end
|
data/lib/siteleaf/server.rb
CHANGED
@@ -12,18 +12,22 @@ module Siteleaf
|
|
12
12
|
paths = path.split("/")
|
13
13
|
templates = []
|
14
14
|
|
15
|
-
if path
|
16
|
-
templates.push(
|
15
|
+
if ['sitemap.xml','feed.xml'].include?(path)
|
16
|
+
templates.push(path)
|
17
17
|
else
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
paths.
|
23
|
-
templates.push("#{paths.join('/')}/default.html")
|
18
|
+
if path == ""
|
19
|
+
templates.push("index.html")
|
20
|
+
else
|
21
|
+
templates.push("#{paths.join('/')}.html")
|
22
|
+
templates.push("#{paths.join('/')}/index.html")
|
23
|
+
templates.push("#{paths.join('/')}/default.html")
|
24
|
+
while paths.size > 0
|
25
|
+
paths.pop
|
26
|
+
templates.push("#{paths.join('/')}/default.html") if paths.size > 0
|
27
|
+
end
|
24
28
|
end
|
29
|
+
templates.push("default.html")
|
25
30
|
end
|
26
|
-
templates.push("default.html")
|
27
31
|
|
28
32
|
templates.each do |t|
|
29
33
|
return File.read(t) if File.exist?(t)
|
data/lib/siteleaf/version.rb
CHANGED