asset_sync 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/asset_sync.gemspec CHANGED
@@ -6,7 +6,7 @@ require "asset_sync/version"
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "asset_sync"
8
8
  s.version = AssetSync::VERSION
9
- s.date = "2011-08-27"
9
+ s.date = "2011-08-30"
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.authors = ["Simon Hamilton", "David Rice"]
12
12
  s.email = ["shamilton@rumblelabs.com", "me@davidjrice.co.uk"]
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.rubyforge_project = "asset_sync"
18
18
 
19
19
  s.add_dependency('fog')
20
+ s.add_dependency('activemodel')
20
21
 
21
22
  s.add_development_dependency "rspec"
22
23
  s.add_development_dependency "bundler"
data/lib/asset_sync.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'fog'
2
+ require 'active_model'
2
3
  require 'erb'
3
4
  require "asset_sync/asset_sync"
4
5
  require 'asset_sync/config'
@@ -8,7 +8,7 @@ module AssetSync
8
8
 
9
9
  def config
10
10
  @config ||= Config.new
11
- raise Config::Invalid("Your configuration in (config/asset_sync.yml or config/initializers/asset_sync.rb) is missing or invalid, please refer to the documention and emend") unless @config && @config.valid?
11
+ raise Config::Invalid.new(@config.errors.full_messages.join(', ')) unless @config && @config.valid?
12
12
  @config
13
13
  end
14
14
 
@@ -1,5 +1,6 @@
1
1
  module AssetSync
2
2
  class Config
3
+ include ActiveModel::Validations
3
4
 
4
5
  class Invalid < StandardError; end
5
6
 
@@ -9,6 +10,11 @@ module AssetSync
9
10
  attr_accessor :aws_region
10
11
  attr_accessor :existing_remote_files
11
12
 
13
+ validates :aws_access_key, :presence => true
14
+ validates :aws_access_secret, :presence => true
15
+ validates :aws_bucket, :presence => true
16
+ validates :existing_remote_files, :inclusion => {:in => %w(keep delete)}
17
+
12
18
  def initialize
13
19
  self.provider = 'AWS'
14
20
  self.aws_region = nil
@@ -57,9 +63,5 @@ module AssetSync
57
63
  return options
58
64
  end
59
65
 
60
- def valid?
61
- true
62
- end
63
-
64
66
  end
65
67
  end
@@ -1,3 +1,3 @@
1
1
  module AssetSync
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -4,6 +4,8 @@ require File.dirname(__FILE__) + '/spec_helper'
4
4
  describe AssetSync, 'with initializer' do
5
5
 
6
6
  before(:all) do
7
+ Rails.root = 'without_yml'
8
+ AssetSync.config = AssetSync::Config.new
7
9
  AssetSync.configure do |config|
8
10
  config.aws_access_key = 'aaaa'
9
11
  config.aws_access_secret = 'bbbb'
@@ -14,7 +16,7 @@ describe AssetSync, 'with initializer' do
14
16
  end
15
17
 
16
18
  it "should should keep existing remote files" do
17
- AssetSync.config.keep_existing_remote_files?.should == true
19
+ AssetSync.config.existing_remote_files?.should == true
18
20
  end
19
21
 
20
22
  it "should configure aws_access_key" do
@@ -43,6 +45,7 @@ end
43
45
  describe AssetSync, 'from yml' do
44
46
 
45
47
  before(:all) do
48
+ Rails.root = 'with_yml'
46
49
  AssetSync.config = AssetSync::Config.new
47
50
  end
48
51
 
@@ -67,3 +70,16 @@ describe AssetSync, 'from yml' do
67
70
  end
68
71
 
69
72
  end
73
+
74
+ describe AssetSync, 'with no configuration' do
75
+
76
+ before(:all) do
77
+ Rails.root = 'without_yml'
78
+ AssetSync.config = AssetSync::Config.new
79
+ end
80
+
81
+ it "should be invalid" do
82
+ lambda{ AssetSync.config.valid?.should == false }.should raise_error(AssetSync::Config::Invalid)
83
+ end
84
+
85
+ end
data/spec/spec_helper.rb CHANGED
@@ -14,12 +14,18 @@ require 'asset_sync'
14
14
 
15
15
  class Rails
16
16
 
17
+ @@path = 'without_yml'
18
+
17
19
  def self.env
18
20
  "test"
19
21
  end
20
22
 
23
+ def self.root=(path)
24
+ @@path = path
25
+ end
26
+
21
27
  def self.root
22
- File.expand_path(File.join('spec', 'rails_app'))
28
+ File.expand_path(File.join('spec', @@path))
23
29
  end
24
30
 
25
31
  end
File without changes
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: asset_sync
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.3
5
+ version: 0.1.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Simon Hamilton
@@ -11,7 +11,8 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-08-27 00:00:00 Z
14
+ date: 2011-08-30 00:00:00 +01:00
15
+ default_executable:
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
17
18
  name: fog
@@ -25,7 +26,7 @@ dependencies:
25
26
  type: :runtime
26
27
  version_requirements: *id001
27
28
  - !ruby/object:Gem::Dependency
28
- name: rspec
29
+ name: activemodel
29
30
  prerelease: false
30
31
  requirement: &id002 !ruby/object:Gem::Requirement
31
32
  none: false
@@ -33,10 +34,10 @@ dependencies:
33
34
  - - ">="
34
35
  - !ruby/object:Gem::Version
35
36
  version: "0"
36
- type: :development
37
+ type: :runtime
37
38
  version_requirements: *id002
38
39
  - !ruby/object:Gem::Dependency
39
- name: bundler
40
+ name: rspec
40
41
  prerelease: false
41
42
  requirement: &id003 !ruby/object:Gem::Requirement
42
43
  none: false
@@ -47,7 +48,7 @@ dependencies:
47
48
  type: :development
48
49
  version_requirements: *id003
49
50
  - !ruby/object:Gem::Dependency
50
- name: jeweler
51
+ name: bundler
51
52
  prerelease: false
52
53
  requirement: &id004 !ruby/object:Gem::Requirement
53
54
  none: false
@@ -57,6 +58,17 @@ dependencies:
57
58
  version: "0"
58
59
  type: :development
59
60
  version_requirements: *id004
61
+ - !ruby/object:Gem::Dependency
62
+ name: jeweler
63
+ prerelease: false
64
+ requirement: &id005 !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ type: :development
71
+ version_requirements: *id005
60
72
  description: After you run assets:precompile your assets will be synchronised with your S3 bucket, deleting unused files and only uploading the files it needs to.
61
73
  email:
62
74
  - shamilton@rumblelabs.com
@@ -83,8 +95,9 @@ files:
83
95
  - lib/generators/asset_sync/templates/asset_sync.rb
84
96
  - lib/generators/asset_sync/templates/asset_sync.yml
85
97
  - spec/asset_sync_spec.rb
86
- - spec/rails_app/config/asset_sync.yml
87
98
  - spec/spec_helper.rb
99
+ - spec/with_yml/config/asset_sync.yml
100
+ has_rdoc: true
88
101
  homepage: https://github.com/rumblelabs/asset_sync
89
102
  licenses: []
90
103
 
@@ -108,11 +121,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
121
  requirements: []
109
122
 
110
123
  rubyforge_project: asset_sync
111
- rubygems_version: 1.8.7
124
+ rubygems_version: 1.6.2
112
125
  signing_key:
113
126
  specification_version: 3
114
127
  summary: Synchronises Assets between Rails and S3
115
128
  test_files:
116
129
  - spec/asset_sync_spec.rb
117
- - spec/rails_app/config/asset_sync.yml
118
130
  - spec/spec_helper.rb
131
+ - spec/with_yml/config/asset_sync.yml