stastic 0.2.6 → 0.2.7
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/lib/stastic.rb +1 -1
- data/lib/stastic/client.rb +3 -2
- data/lib/stastic/commands/base.rb +14 -12
- data/lib/stastic/commands/create.rb +3 -1
- data/lib/stastic/commands/rename.rb +2 -0
- data/lib/stastic/config.rb +1 -1
- data/lib/stastic/generator.rb +1 -1
- metadata +3 -3
data/lib/stastic.rb
CHANGED
data/lib/stastic/client.rb
CHANGED
@@ -44,12 +44,13 @@ module Stastic
|
|
44
44
|
request(:delete, "/sites/#{site_id}/domains/#{domain_name}")
|
45
45
|
end
|
46
46
|
|
47
|
-
def initialize
|
47
|
+
def initialize
|
48
48
|
if Stastic::Config.exists?
|
49
49
|
self.user = Stastic::Config.user
|
50
50
|
self.token = Stastic::Config.token
|
51
|
+
self.host = Stastic::Config.host
|
51
52
|
end
|
52
|
-
self.host
|
53
|
+
self.host ||= "https://stastic.com"
|
53
54
|
end
|
54
55
|
|
55
56
|
def request(method, uri, payload = nil, headers = {})
|
@@ -50,6 +50,17 @@ module Stastic::Command
|
|
50
50
|
return password
|
51
51
|
end
|
52
52
|
|
53
|
+
def print_error_and_exit(e)
|
54
|
+
puts "Error."
|
55
|
+
puts "There was an error with the request:"
|
56
|
+
puts
|
57
|
+
JSON.parse(e.response)['errors'].each do |msg|
|
58
|
+
printf(" * %s\n", msg)
|
59
|
+
end
|
60
|
+
puts
|
61
|
+
exit -1
|
62
|
+
end
|
63
|
+
|
53
64
|
def with_valid_user
|
54
65
|
request_credentials unless Stastic::Config.credentials?
|
55
66
|
begin
|
@@ -58,13 +69,7 @@ module Stastic::Command
|
|
58
69
|
request_credentials
|
59
70
|
retry
|
60
71
|
rescue RestClient::UnprocessableEntity => e
|
61
|
-
|
62
|
-
puts
|
63
|
-
JSON.parse(e.response)['errors'].each do |msg|
|
64
|
-
printf(" * %s\n", msg)
|
65
|
-
end
|
66
|
-
puts
|
67
|
-
exit -1
|
72
|
+
print_error_and_exit(e)
|
68
73
|
end
|
69
74
|
end
|
70
75
|
|
@@ -77,10 +82,7 @@ module Stastic::Command
|
|
77
82
|
request_credentials
|
78
83
|
retry
|
79
84
|
rescue RestClient::UnprocessableEntity => e
|
80
|
-
|
81
|
-
puts e.response.to_s
|
82
|
-
puts
|
83
|
-
exit
|
85
|
+
print_error_and_exit(e)
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
@@ -89,7 +91,7 @@ module Stastic::Command
|
|
89
91
|
puts
|
90
92
|
puts " stastic create"
|
91
93
|
puts
|
92
|
-
exit
|
94
|
+
exit -1
|
93
95
|
end
|
94
96
|
|
95
97
|
def print_site_info(site, marker = " ")
|
@@ -27,6 +27,7 @@ module Stastic::Command
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def index
|
30
|
+
print "Creating site... "
|
30
31
|
if template
|
31
32
|
copy_template("#{File.dirname(__FILE__)}/../../../templates/#{template}/")
|
32
33
|
end
|
@@ -41,7 +42,8 @@ module Stastic::Command
|
|
41
42
|
|
42
43
|
if response["name"]
|
43
44
|
Stastic::Config.add(:name => response["name"])
|
44
|
-
print "
|
45
|
+
print "Success!\n"
|
46
|
+
print "Your site has been created.\n\n"
|
45
47
|
print " Site Name: #{Stastic::Config.name}\n"
|
46
48
|
print " Site URL: #{Stastic::Config.name}.stastic.com\n\n"
|
47
49
|
print "Use `stastic publish` to publish your site whenever you're ready.\n"
|
data/lib/stastic/config.rb
CHANGED
data/lib/stastic/generator.rb
CHANGED
@@ -30,7 +30,7 @@ module Stastic
|
|
30
30
|
|
31
31
|
def package(dir)
|
32
32
|
tmpfile = Tempfile.new('st-archive')
|
33
|
-
system "cd #{dir} && tar -cjf #{tmpfile.path} -X #{exclude_file(dir)} . "
|
33
|
+
system "cd \"#{dir}\" && tar -cjf \"#{tmpfile.path}\" -X #{exclude_file(dir)} . "
|
34
34
|
tmpfile.path
|
35
35
|
end
|
36
36
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 7
|
9
|
+
version: 0.2.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Brian Smith
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-03-
|
17
|
+
date: 2011-03-30 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|