buttercms 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 791d5af2a7da43fc63cec4c2e9c98537b5fad58b
4
- data.tar.gz: e06028b7a6df2e89d9273d12f5e391da4d6d9ef9
3
+ metadata.gz: ffae362326c854f4c71b6b211a56dd618adba2e1
4
+ data.tar.gz: afb3417b99243d4399c41374b6940d75d101a50c
5
5
  SHA512:
6
- metadata.gz: 28951af34e703b3f9e1c10245ae9b5f096c1b06403431efd6affacbd653f1ec78e82b79820033a5d6db6b94868f3c4dc1ccf93ce3066feed5f7f01295c43a7c1
7
- data.tar.gz: fee0f123668d11988fcf6592bfe79e3f6b78b2409a03c6b641c291179e1033133f8a1f124777966c99fbdc4d057596fa13ce8c9351b244dd014ab21873dec6af
6
+ metadata.gz: b01327d77dc814e3079875a3d4b1dcee22d00b0d8a8269a8c2569137ac0705a0d7d31ac825b662294eba4df349dda1cea23be2028274980ba68332678bf4ca78
7
+ data.tar.gz: 4708804b8006672435d02b8e5f4d6cc80a8ab4e8c6ddac95f52636663dfb942f1273bed19d481236b317f248d2e4928c3354d1cf5ab37c1f650523d1bb525c65
data/.gitignore CHANGED
@@ -8,6 +8,7 @@ capybara-*.html
8
8
  /public/system
9
9
  /coverage/
10
10
  /spec/tmp
11
+ /Gemfile.lock
11
12
  **.orig
12
13
  rerun.txt
13
14
  pickle-email-*.html
@@ -20,9 +21,6 @@ config/secrets.yml
20
21
  /.bundle
21
22
  /vendor/bundle
22
23
 
23
- # these should all be checked in to normalise the environment:
24
- # Gemfile.lock, .ruby-version, .ruby-gemset
25
-
26
24
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
27
25
  .rvmrc
28
26
 
@@ -36,4 +34,4 @@ bower.json
36
34
 
37
35
  pkg/*
38
36
 
39
- .DS_Store
37
+ .DS_Store
@@ -6,6 +6,27 @@ module Buttercms
6
6
 
7
7
  API_URL = 'https://buttercms.com/api/'
8
8
 
9
+ class Error < StandardError
10
+ end
11
+
12
+ class ConnectionError < Error
13
+ def message
14
+ "Unable to connect to ButterCms. Please double check your internet connection."
15
+ end
16
+ end
17
+
18
+ class TokenError < Error
19
+ def message
20
+ "This token has not been registered. Please register one @ https://buttercms.com/api_token/"
21
+ end
22
+ end
23
+
24
+ class InvalidResponseError < Error
25
+ def message
26
+ "An error occured retrieving blog. Please try again later."
27
+ end
28
+ end
29
+
9
30
  class BlogController < ApplicationController
10
31
  layout :get_butter_layout
11
32
  helper Rails.application.helpers
@@ -39,9 +60,11 @@ module Buttercms
39
60
 
40
61
  def make_butter_request(path)
41
62
  begin
42
- response = RestClient.get path, {:Authorization => "Token #{get_butter_token}"}
63
+ # Get the content. If it takes longer than 10 seconds timeout.
64
+ # TODO(jlumetta): Make :timeout configurable.
65
+ response = RestClient.get path, {:Authorization => "Token #{get_butter_token}", :timeout => 10}
43
66
  rescue SocketError => e
44
- raise Exception.new("Unable to connect to ButterCms. Please double check your internet connection.")
67
+ raise Buttercms::ConnectionError
45
68
  rescue => e
46
69
  puts e.message
47
70
 
@@ -49,9 +72,9 @@ module Buttercms
49
72
  when 404
50
73
  butter_not_found
51
74
  when 401
52
- raise Exception.new("This token has not been registered. Please register one @ https://buttercms.com/api_token/")
75
+ raise Buttercms::TokenError
53
76
  else
54
- raise Exception.new("An error occured retrieving blog. Please try again later.")
77
+ raise Buttercms::InvalidResponseError
55
78
  end
56
79
  end
57
80
 
Binary file
data/buttercms.gemspec CHANGED
@@ -20,10 +20,9 @@ Gem::Specification.new do |spec|
20
20
  spec.files = `git ls-files -z`.split("\x0")
21
21
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
22
 
23
- spec.add_dependency "bundler", "~> 1.7"
24
- spec.add_dependency "rake", "~> 10.0"
25
- spec.add_dependency "json"
26
- spec.add_dependency "rest-client"
23
+ spec.add_runtime_dependency "json", "~> 1.8"
24
+ spec.add_runtime_dependency "rest-client", "~> 1.8"
27
25
 
28
-
29
- end
26
+ spec.add_development_dependency "bundler", "~> 1.7"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ end
@@ -1,3 +1,3 @@
1
1
  module Buttercms
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buttercms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - ButterCms
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-04 00:00:00.000000000 Z
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: '1.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: '1.8'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '1.8'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '1.8'
41
41
  - !ruby/object:Gem::Dependency
42
- name: json
42
+ name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
47
+ version: '1.7'
48
+ type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '1.7'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rest-client
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
61
+ version: '10.0'
62
+ type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '10.0'
69
69
  description: Butter makes setting up a company blog on Rails insanely easy. It's built
70
70
  for developers to save us from hosting, DB setup, themeing, maintaining yet another
71
71
  Wordpress install. It's designed to be quickly integrated to an existing Rails project.
@@ -77,7 +77,6 @@ extra_rdoc_files: []
77
77
  files:
78
78
  - .gitignore
79
79
  - Gemfile
80
- - Gemfile.lock
81
80
  - MIT-LICENSE
82
81
  - README.rst
83
82
  - Rakefile
@@ -93,7 +92,7 @@ files:
93
92
  - app/views/buttercms/blog/butter_home.html.erb
94
93
  - app/views/buttercms/blog/butter_post.html.erb
95
94
  - app/views/layouts/buttercms/application.html.erb
96
- - bin/rails
95
+ - buttercms-0.1.6.gem
97
96
  - buttercms.gemspec
98
97
  - config/routes.rb
99
98
  - lib/buttercms.rb
data/Gemfile.lock DELETED
@@ -1,33 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- buttercms (0.0.1)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- domain_name (0.5.24)
10
- unf (>= 0.0.5, < 1.0.0)
11
- http-cookie (1.0.2)
12
- domain_name (~> 0.5)
13
- json (1.8.2)
14
- mime-types (2.4.3)
15
- netrc (0.10.3)
16
- rake (10.4.2)
17
- rest-client (1.8.0)
18
- http-cookie (>= 1.0.2, < 2.0)
19
- mime-types (>= 1.16, < 3.0)
20
- netrc (~> 0.7)
21
- unf (0.1.4)
22
- unf_ext
23
- unf_ext (0.0.7.1)
24
-
25
- PLATFORMS
26
- ruby
27
-
28
- DEPENDENCIES
29
- bundler (~> 1.7)
30
- buttercms!
31
- json
32
- rake (~> 10.0)
33
- rest-client
data/bin/rails DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
3
-
4
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
- ENGINE_PATH = File.expand_path('../../lib/buttercms/engine', __FILE__)
6
-
7
- # Set up gems listed in the Gemfile.
8
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
9
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
10
-
11
- require 'rails/all'
12
- require 'rails/engine/commands'