jeremyboles-graffic 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ class GrafficGenerator < Rails::Generator::Base
2
+
3
+ def manifest
4
+ record do |m|
5
+ m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => 'create_graffics'
6
+ end
7
+ end
8
+
9
+ end
@@ -0,0 +1,17 @@
1
+ class CreateGraffics < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :graffics do |t|
4
+ t.belongs_to :resource, :polymorphic => true
5
+ t.string :format, :name, :state, :type
6
+ t.integer :height, :width
7
+ t.datetime :created_at
8
+ end
9
+ add_index :graffics, [:resource_id, :resource_type]
10
+ add_index :graffics, [:resource_id, :resource_type, :name]
11
+ add_index :graffics, :state
12
+ end
13
+
14
+ def self.down
15
+ drop_table :graffics
16
+ end
17
+ end
data/lib/graffic.rb CHANGED
@@ -1,3 +1,7 @@
1
+ require 'rmagick'
2
+ require 'state_machine'
3
+ require 'graffic/aws'
4
+
1
5
  # Graffic
2
6
  class Graffic < ActiveRecord::Base
3
7
  attr_writer :file
@@ -0,0 +1,24 @@
1
+ require 'right_aws'
2
+
3
+ class Graffic::Aws
4
+ cattr_accessor :access_key
5
+ cattr_accessor :secret_key
6
+
7
+ def self.s3
8
+ RightAws::S3.new(access_key, secret_key, defaults)
9
+ end
10
+
11
+ def self.sqs
12
+ RightAws::SqsGen2.new(access_key, secret_key, defaults)
13
+ end
14
+
15
+ private
16
+
17
+ def self.defaults(options = {})
18
+ { :logger => Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}_aws.log"),
19
+ :port => 80,
20
+ :protocol => 'http'
21
+ }.merge(options)
22
+ end
23
+
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeremyboles-graffic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Boles
@@ -50,22 +50,22 @@ extensions: []
50
50
 
51
51
  extra_rdoc_files:
52
52
  - README.rdoc
53
- - LICENSE
53
+ - MIT-LICENSE
54
54
  - CHANGELOG.rdoc
55
55
  files:
56
+ - CHANGELOG.rdoc
56
57
  - MIT-LICENSE
57
- - README
58
+ - README.rdoc
58
59
  - Rakefile
60
+ - generators/graffic/graffic_generator.rb
61
+ - generators/graffic/templates/migration.rb
59
62
  - init.rb
60
- - install.rb
61
63
  - lib/graffic.rb
64
+ - lib/graffic/aws.rb
62
65
  - tasks/graffic_tasks.rake
63
66
  - test/graffic_test.rb
64
67
  - test/test_helper.rb
65
68
  - uninstall.rb
66
- - README.rdoc
67
- - LICENSE
68
- - CHANGELOG.rdoc
69
69
  has_rdoc: true
70
70
  homepage: http://github.com/jeremyboles/graffic/wikis
71
71
  post_install_message: