mogwai 0.0.22

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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/mogwai +5 -0
  3. data/lib/mogwai.rb +52 -0
  4. metadata +60 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 50d013aedee951813f0152fb8c8a0168c89e20ed
4
+ data.tar.gz: e823c67329b548372bfd22e94eb88d47686671cf
5
+ SHA512:
6
+ metadata.gz: 931a10e18f9659775cedf766ce2ab54e4e17d28fe8212a7c3e28c5cb9e0a7a1f2e790cd8810bf91f4a5d59344b30f4b989c25d4f161d089caefa6cb2ce5da5fa
7
+ data.tar.gz: 7d5dd4a1f653860c0995f60e103aa004cf650663ea7495a87ba19e9e2e606830baff8f8698815f8c37a8aa9b287d8f193aa7b25b106ebc34465cffcf4c0d0654
data/bin/mogwai ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'mogwai'
4
+
5
+ Mogwai.deploy
data/lib/mogwai.rb ADDED
@@ -0,0 +1,52 @@
1
+ require 'yaml'
2
+ require 'aws/s3'
3
+
4
+ class Mogwai
5
+ CONFIG_PATHS = ["Mogfile", "Mogfile.yml", "mogfile", "mogfile.yml"]
6
+
7
+ class Config < Hash
8
+ def read
9
+ CONFIG_PATHS.each do |path|
10
+ if File.exists? path
11
+ config = YAML.load_file path
12
+ config.each_pair do |key, value|
13
+ self[key.upcase.to_sym] = value
14
+ end
15
+ return
16
+ end
17
+ end
18
+ raise "No Mogfile found. Please make sure you have a Mogfile present."
19
+ end
20
+ end
21
+
22
+ def self.deploy
23
+ config = Mogwai::Config.new
24
+ config.read
25
+
26
+ # Deploy built assets to s3
27
+ STDOUT.sync = true
28
+ AWS::S3::Base.establish_connection!(
29
+ :access_key_id => config[:AWS_ACCESS_KEY_ID],
30
+ :secret_access_key => config[:AWS_SECRET_ACCESS_KEY]
31
+ )
32
+
33
+ build_dir = config[:BUILD_DIR].gsub(/([^\/])$/, '\1/')
34
+ build_glob = build_dir + "**/*"
35
+
36
+ Dir.glob(build_glob).each do |file|
37
+ if File.file?(file)
38
+ remote_file = file.gsub(build_dir, "")
39
+
40
+ AWS::S3::S3Object.store(
41
+ remote_file,
42
+ open(file),
43
+ config[:AWS_BUCKET],
44
+ :access => :public_read
45
+ )
46
+ end
47
+ end
48
+ STDOUT.sync = false
49
+ return true
50
+ end
51
+
52
+ end
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mogwai
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.22
5
+ platform: ruby
6
+ authors:
7
+ - Maxwell Folley
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2010-11-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-s3
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.6.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.6.3
27
+ description: A very simple s3 deployment gem.
28
+ email: maxwell@madebyflavor.com
29
+ executables:
30
+ - mogwai
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - lib/mogwai.rb
35
+ - bin/mogwai
36
+ homepage: https://github.com/maxfolley/mogwai
37
+ licenses:
38
+ - MIT
39
+ metadata: {}
40
+ post_install_message:
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ requirements: []
55
+ rubyforge_project:
56
+ rubygems_version: 2.1.10
57
+ signing_key:
58
+ specification_version: 4
59
+ summary: Mogwai.
60
+ test_files: []