siteleaf 0.9.15 → 0.9.16

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/siteleaf CHANGED
@@ -43,13 +43,13 @@ def auth(re_auth = false)
43
43
 
44
44
  puts "\nAuthorizing..."
45
45
 
46
- if auth = Siteleaf::Client.auth(email, password) and auth.is_a?(Hash) and auth.has_key?('api_key')
46
+ if (auth = Siteleaf::Client.auth(email, password)) && (auth.is_a?(Hash)) && (auth.has_key?('api_key'))
47
47
  File.open(Siteleaf.settings_file,'w') do|file|
48
48
  Marshal.dump({:api_key => auth['api_key'], :api_secret => auth['api_secret']}, file)
49
49
  end
50
50
  puts "=> Gem authorized." if re_auth
51
51
  else
52
- puts "Could not authorize, check your e-mail or password."
52
+ puts auth['error'] || "Could not authorize, check your e-mail or password."
53
53
  end
54
54
  end
55
55
  end
@@ -85,7 +85,7 @@ def get_theme_assets(site_id)
85
85
  if assets = Siteleaf::Theme.assets_by_site_id(site_id)
86
86
  updated_count = 0
87
87
  assets.each do |asset|
88
- if File.exist?(asset.filename) && asset.checksum == Digest::MD5.hexdigest(File.read(asset.filename))
88
+ if File.exist?(asset.filename) && (asset.checksum == Digest::MD5.hexdigest(File.read(asset.filename)))
89
89
  # file is up to date
90
90
  else
91
91
  print "Downloading #{asset.filename}..."
@@ -173,7 +173,7 @@ when 'c', 'config', 'setup'
173
173
  end
174
174
  when 'n', 'new'
175
175
  auth
176
- if site = Siteleaf::Site.create(:title => ARGV[1], :domain => ARGV[1])
176
+ if (site = Siteleaf::Site.create(:title => ARGV[1], :domain => ARGV[1])) && (!site.error)
177
177
  dir = ARGV.size >= 3 ? ARGV[2] : ARGV[1]
178
178
  Dir.mkdir(dir) unless File.directory?(dir)
179
179
  Dir.chdir(dir)
@@ -9,7 +9,7 @@ module Siteleaf
9
9
  })
10
10
  return request.parsed_response # parse JSON
11
11
  rescue => e
12
- return e.inspect # error
12
+ return 'error' => e.message # error
13
13
  end
14
14
  end
15
15
 
@@ -43,7 +43,7 @@ module Siteleaf
43
43
  return request # raw
44
44
  end
45
45
  rescue => e
46
- return e.inspect # error
46
+ return 'error' => e.message # error
47
47
  end
48
48
  end
49
49
  end
@@ -1,5 +1,7 @@
1
1
  module Siteleaf
2
2
  class Entity
3
+
4
+ attr_reader :error
3
5
 
4
6
  def initialize(attributes = {})
5
7
  self.attributes = attributes
@@ -1,3 +1,3 @@
1
1
  module Siteleaf
2
- VERSION = "0.9.15"
2
+ VERSION = "0.9.16"
3
3
  end
data/siteleaf.gemspec CHANGED
@@ -6,6 +6,7 @@ require 'siteleaf/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "siteleaf"
8
8
  gem.version = Siteleaf::VERSION
9
+ gem.license = "MIT"
9
10
  gem.authors = ["Siteleaf"]
10
11
  gem.email = ["api@siteleaf.com"]
11
12
  gem.description = %q{A Ruby interface and command line utility for the Siteleaf API.}
@@ -14,7 +15,7 @@ Gem::Specification.new do |gem|
14
15
 
15
16
  gem.required_ruby_version = '>= 1.8'
16
17
 
17
- gem.add_dependency 'httparty'
18
+ gem.add_dependency 'httparty', '<= 0.11'
18
19
  gem.add_dependency 'httmultiparty'
19
20
  gem.add_dependency 'rack'
20
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: siteleaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.15
4
+ version: 0.9.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-11 00:00:00.000000000 Z
12
+ date: 2013-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - <=
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: '0.11'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - <=
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: '0.11'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: httmultiparty
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -86,7 +86,8 @@ files:
86
86
  - lib/siteleaf/version.rb
87
87
  - siteleaf.gemspec
88
88
  homepage: http://siteleaf.com
89
- licenses: []
89
+ licenses:
90
+ - MIT
90
91
  post_install_message:
91
92
  rdoc_options: []
92
93
  require_paths: