snapshotar 0.0.2 → 0.0.3

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: c9dce45f3945faf3abb06e4519cebb35fa7ea70a
4
- data.tar.gz: d7b40e2306e8e32480ff02bf2071022e2a035531
3
+ metadata.gz: 6c9f9365f7e01ff0a219df26f250c42bc0bc2480
4
+ data.tar.gz: 0c3a2802ad5a5a379ff8b3088b55de2b1a710d56
5
5
  SHA512:
6
- metadata.gz: dbf284de18e77b28bcf0f63b87ea6e76dd627983c3d29c02bdf1d00d084dc8791137bdbad27a673c7c2dd0aa9e0908778e231e6567e848d0429e1f5ffdd9109d
7
- data.tar.gz: 0ff2656d88e83b4ed87863f5f063d10823c1ec99438cf13f57e383bcfeb9cd09b6b15baa08e5cf9f728ada348f6e82cba346faaba321c9b1b279ab837d10e1bd
6
+ metadata.gz: 21f902d6bc838fcbb758956486d851a38dd3d837fc9271098f5e97d08238a73c5ef17ef5cd304e1ebb364fb60c86f37673f47a4ad066b54ad12ead1b4d35cb6b
7
+ data.tar.gz: 49c80784904e76e46c0477c7f82c25ec4a14ecdb1cbf5e4cedd0eeec6e42ad6c64ff98a567490096a67a24a13d3cc9a4856c6ad94738728c323cd0da80f5271e
data/README.md CHANGED
@@ -20,6 +20,12 @@ Or install it yourself as:
20
20
 
21
21
  $ gem install snapshotar
22
22
 
23
+ Run install generator:
24
+
25
+ $ rails generate snapshotar:install
26
+
27
+ Lookup *config/initializers/snapshotar.rb* and configure snapshotar.
28
+
23
29
  ## What snapshotar can...
24
30
 
25
31
  1. serializing your rails models to json
@@ -33,8 +39,7 @@ Or install it yourself as:
33
39
  instead of...
34
40
 
35
41
  - **database backup?** Because image attachments causing trouble!!
36
- - **fixtures/factories/fakers?** Because this requires coding. Let the
37
- others fill up your app with sample data.
42
+ - **fixtures/factories/fakers?** Because this requires coding. Don't spend time coding test data - it's boring.
38
43
 
39
44
  ## When to use snapshotar?
40
45
 
@@ -44,17 +49,67 @@ others fill up your app with sample data.
44
49
  ## Requirements
45
50
 
46
51
  - Ruby >= 1.9.3
47
- - Rails ?
52
+ - tested with *Mongoid*, but *ActiveRecord* should work as well.
48
53
 
49
54
  ## Usage
50
55
 
51
- - one option for snapshotar is **rake**
56
+ ### rake
57
+
58
+ rake snapshotar:create # create a snapshots
59
+ rake snapshotar:delete # delete a snapshots
60
+ rake snapshotar:list # list available snapshots
61
+ rake snapshotar:load # load a snapshots
62
+
63
+ ### controller action
64
+
65
+ You can also integrate snapshotar into your administration backend and let app
66
+ users create snapshots. A sample controller is provided below
67
+
68
+ *app/controllers/admin/snapshots_controller.rb*
69
+
70
+ class Admin::SnapshotsController < Admin::AdminController
71
+
72
+ def index
73
+ @snapshots = Snapshotar.list
74
+ end
75
+
76
+ def load
77
+ Mongoid.purge!
78
+ Snapshotar.load(params[:name])
79
+ redirect_to admin_snapshots_path
80
+ end
81
+
82
+ def new
83
+ end
84
+
85
+ def create
86
+ Snapshotar.create
87
+ redirect_to admin_snapshots_path
88
+ end
89
+
90
+ def delete
91
+ Snapshotar.delete(params[:name])
92
+ redirect_to admin_snapshots_path
93
+ end
94
+ end
52
95
 
53
- - you can also integrate snapshotar into your administration backend and let app
54
- users create snapshots.
55
96
 
56
97
  ## Configuration Options
57
98
 
99
+ For **AWS S3**, you have to provide the following ENV variables provisioning your S3 bucket. For development environments look at this wonderful dot-env gem https://github.com/bkeepers/dotenv.
100
+
101
+ config.storage_type = :s3
102
+
103
+ AWS_ACCESS_KEY_ID=<your id>
104
+ AWS_SECRET_ACCESS_KEY=<your secret>
105
+ AWS_SNAPSHOTAR_BUCKET=<a bucket name>
106
+
107
+ **Files**
108
+
109
+ config.storage_type = :file
110
+
111
+ Snapshots are stored in the rails *tmp/* directory
112
+
58
113
  ## Testing
59
114
  This repository is under continuous integration testing on travis-ci.org.
60
115
 
@@ -0,0 +1,9 @@
1
+ class Snapshotar::InstallGenerator < Rails::Generators::Base
2
+ source_root File.expand_path("../templates", __FILE__)
3
+
4
+ desc "This generator creates a snapshotar initializer file with default configuration at config/initializers"
5
+ def create_initializer_file
6
+ # initializer "snapshotar.rb", "puts 'this is the beginning'"
7
+ copy_file 'initializer.rb', File.join('config', 'initializers', 'snapshotar.rb')
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ # Snapshotar Gem
2
+ # https://github.com/elchbenny/snapshotar
3
+ # Benjamin Müller
4
+ # 2014
5
+
6
+ Snapshotar.configure do |config|
7
+
8
+
9
+ # Where to store your snapshots?
10
+ # :s3 -> for amazon s3 service
11
+ # :file -> local directory (default)
12
+ config.storage_type = :file
13
+
14
+ # Provide the models and their attributes to seralize in a nested array like this:
15
+ # [[ModelName1, :attribute1, :attribute2,...],[ModelName2, :attribute1]]
16
+ #
17
+ # or even better to read like this
18
+ # config.models << [Cinema, :id, :name, :coordinates, :cinema_more_images, :district_id]
19
+ # config.models << [District, :id, :name]
20
+ config.models << []
21
+
22
+ end
@@ -1,3 +1,3 @@
1
1
  module Snapshotar
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/snapshotar.gemspec CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "snapshotar"
8
8
  spec.version = Snapshotar::VERSION
9
9
  spec.authors = ["Benjamin Müller"]
10
- spec.email = ["benjamin@boxar.de"]
11
- spec.description = %q{Make a snapshot of your rails database by serializing all objects.}
10
+ spec.email = ["benjamin@berlab.io"]
11
+ spec.description = %q{Make a snapshot of your rails database.}
12
12
  spec.summary = %q{In contrast to a database backup, snapshotAR is able to manage image references made with paperclip or carrierwave correctly. You are able to save your entire application or only parts of it and e.g. seed your test environments. }
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snapshotar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Müller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-12 00:00:00.000000000 Z
11
+ date: 2014-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,9 +122,9 @@ dependencies:
122
122
  - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- description: Make a snapshot of your rails database by serializing all objects.
125
+ description: Make a snapshot of your rails database.
126
126
  email:
127
- - benjamin@boxar.de
127
+ - benjamin@berlab.io
128
128
  executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
@@ -136,6 +136,8 @@ files:
136
136
  - LICENSE.txt
137
137
  - README.md
138
138
  - Rakefile
139
+ - lib/generators/snapshotar/install_generator.rb
140
+ - lib/generators/snapshotar/templates/initializer.rb
139
141
  - lib/snapshotar.rb
140
142
  - lib/snapshotar/configuration.rb
141
143
  - lib/snapshotar/core.rb