maglevrecord 0.0.3 → 0.1.1
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.
- data/.gitignore +35 -0
- data/.travis.yml +19 -0
- data/Gemfile +13 -0
- data/README.md +89 -0
- data/Rakefile +22 -0
- data/install.sh +238 -0
- data/lib/maglev_record/base.rb +10 -62
- data/lib/maglev_record/enumerable.rb +13 -24
- data/lib/maglev_record/errors.rb +10 -0
- data/lib/maglev_record/integration.rb +7 -0
- data/lib/maglev_record/maglev_record.rb +13 -0
- data/lib/maglev_record/maglev_support/active_support_patch.rb +31 -0
- data/lib/maglev_record/maglev_support/concern.rb +19 -0
- data/lib/maglev_record/maglev_support/maglev_support.rb +15 -0
- data/lib/maglev_record/maglev_support/secure_password.rb +39 -0
- data/lib/maglev_record/migration/loader.rb +38 -0
- data/lib/maglev_record/migration/migration.rb +142 -0
- data/lib/maglev_record/migration/migrator.rb +40 -0
- data/lib/maglev_record/migration/operations.rb +92 -0
- data/lib/maglev_record/migration.rb +5 -0
- data/lib/maglev_record/persistence.rb +23 -48
- data/lib/maglev_record/raketasks.rb +9 -0
- data/lib/maglev_record/read_write.rb +20 -10
- data/lib/maglev_record/rooted_base.rb +8 -0
- data/lib/maglev_record/rooted_enumerable.rb +25 -0
- data/lib/maglev_record/rooted_persistence.rb +36 -0
- data/lib/maglev_record/sensible.rb +28 -0
- data/lib/maglev_record/snapshot/change.rb +53 -0
- data/lib/maglev_record/snapshot/snapshot.rb +67 -0
- data/lib/maglev_record/snapshot/snapshotable.rb +58 -0
- data/lib/maglev_record/snapshot.rb +5 -0
- data/lib/maglev_record/tools/object_reference.rb +189 -0
- data/lib/maglev_record/tools/submodule_finder.rb +42 -0
- data/lib/maglev_record/tools.rb +2 -0
- data/lib/maglev_record.rb +60 -4
- data/lib/tasks/database.rake +38 -0
- data/maglevrecord.gemspec +17 -0
- data/rails/init.rb +1 -0
- data/test/_test_object_reference.rb +70 -0
- data/test/example_model.rb +26 -13
- data/test/migration/dummy_migrations/migration_1.rb +8 -0
- data/test/migration/dummy_migrations/migration_2.rb +8 -0
- data/test/migration/dummy_migrations/migration_3.rb +8 -0
- data/test/migration/migrations/migration_1.rb +12 -0
- data/test/migration/migrations/migration_2.rb +12 -0
- data/test/migration/migrations/migration_3.rb +12 -0
- data/test/migration/operation_setup.rb +91 -0
- data/test/migration/projects/project1/.gitignore +15 -0
- data/test/migration/projects/project1/Gemfile +43 -0
- data/test/migration/projects/project1/Gemfile.lock +114 -0
- data/test/migration/projects/project1/README.rdoc +261 -0
- data/test/migration/projects/project1/Rakefile +17 -0
- data/test/migration/projects/project1/app/assets/images/rails.png +0 -0
- data/test/migration/projects/project1/app/assets/javascripts/application.js +15 -0
- data/test/migration/projects/project1/app/assets/stylesheets/application.css +13 -0
- data/test/migration/projects/project1/app/controllers/application_controller.rb +3 -0
- data/test/migration/projects/project1/app/helpers/application_helper.rb +2 -0
- data/test/migration/projects/project1/app/mailers/.gitkeep +0 -0
- data/test/migration/projects/project1/app/models/.gitkeep +0 -0
- data/test/migration/projects/project1/app/views/layouts/application.html.erb +14 -0
- data/test/migration/projects/project1/config/application.rb +62 -0
- data/test/migration/projects/project1/config/boot.rb +6 -0
- data/test/migration/projects/project1/config/database.yml +25 -0
- data/test/migration/projects/project1/config/environment.rb +5 -0
- data/test/migration/projects/project1/config/environments/development.rb +37 -0
- data/test/migration/projects/project1/config/environments/production.rb +67 -0
- data/test/migration/projects/project1/config/initializers/backtrace_silencers.rb +7 -0
- data/test/migration/projects/project1/config/initializers/inflections.rb +15 -0
- data/test/migration/projects/project1/config/initializers/mime_types.rb +5 -0
- data/test/migration/projects/project1/config/initializers/secret_token.rb +7 -0
- data/test/migration/projects/project1/config/initializers/session_store.rb +8 -0
- data/test/migration/projects/project1/config/initializers/wrap_parameters.rb +14 -0
- data/test/migration/projects/project1/config/locales/en.yml +5 -0
- data/test/migration/projects/project1/config/routes.rb +58 -0
- data/test/migration/projects/project1/config.ru +4 -0
- data/test/migration/projects/project1/db/seeds.rb +7 -0
- data/test/migration/projects/project1/lib/assets/.gitkeep +0 -0
- data/test/migration/projects/project1/lib/tasks/.gitkeep +0 -0
- data/test/migration/projects/project1/log/.gitkeep +0 -0
- data/test/migration/projects/project1/public/404.html +26 -0
- data/test/migration/projects/project1/public/422.html +26 -0
- data/test/migration/projects/project1/public/500.html +25 -0
- data/test/migration/projects/project1/public/favicon.ico +0 -0
- data/test/migration/projects/project1/public/index.html +241 -0
- data/test/migration/projects/project1/public/robots.txt +5 -0
- data/test/migration/projects/project1/script/rails +6 -0
- data/test/migration/projects/project2/.gitignore +15 -0
- data/test/migration/projects/project2/Gemfile +44 -0
- data/test/migration/projects/project2/Gemfile.lock +115 -0
- data/test/migration/projects/project2/README.rdoc +261 -0
- data/test/migration/projects/project2/Rakefile +17 -0
- data/test/migration/projects/project2/app/assets/images/rails.png +0 -0
- data/test/migration/projects/project2/app/assets/javascripts/application.js +15 -0
- data/test/migration/projects/project2/app/assets/stylesheets/application.css +13 -0
- data/test/migration/projects/project2/app/controllers/application_controller.rb +3 -0
- data/test/migration/projects/project2/app/helpers/application_helper.rb +2 -0
- data/test/migration/projects/project2/app/mailers/.gitkeep +0 -0
- data/test/migration/projects/project2/app/models/.gitkeep +0 -0
- data/test/migration/projects/project2/app/models/project_model.rb +8 -0
- data/test/migration/projects/project2/app/views/layouts/application.html.erb +14 -0
- data/test/migration/projects/project2/config/application.rb +62 -0
- data/test/migration/projects/project2/config/boot.rb +6 -0
- data/test/migration/projects/project2/config/database.yml +25 -0
- data/test/migration/projects/project2/config/environment.rb +5 -0
- data/test/migration/projects/project2/config/environments/development.rb +37 -0
- data/test/migration/projects/project2/config/environments/production.rb +67 -0
- data/test/migration/projects/project2/config/initializers/backtrace_silencers.rb +7 -0
- data/test/migration/projects/project2/config/initializers/inflections.rb +15 -0
- data/test/migration/projects/project2/config/initializers/mime_types.rb +5 -0
- data/test/migration/projects/project2/config/initializers/secret_token.rb +7 -0
- data/test/migration/projects/project2/config/initializers/session_store.rb +8 -0
- data/test/migration/projects/project2/config/initializers/wrap_parameters.rb +14 -0
- data/test/migration/projects/project2/config/locales/en.yml +5 -0
- data/test/migration/projects/project2/config/routes.rb +58 -0
- data/test/migration/projects/project2/config.ru +4 -0
- data/test/migration/projects/project2/db/seeds.rb +7 -0
- data/test/migration/projects/project2/lib/assets/.gitkeep +0 -0
- data/test/migration/projects/project2/lib/tasks/.gitkeep +0 -0
- data/test/migration/projects/project2/log/.gitkeep +0 -0
- data/test/migration/projects/project2/migrations/migration_2013-04-Apr-23_17.31.38.rb +16 -0
- data/test/migration/projects/project2/migrations/migration_2013-04-Apr-23_17.31.52.rb +16 -0
- data/test/migration/projects/project2/migrations/migration_2013-04-Apr-23_17.32.07.rb +16 -0
- data/test/migration/projects/project2/public/404.html +26 -0
- data/test/migration/projects/project2/public/422.html +26 -0
- data/test/migration/projects/project2/public/500.html +25 -0
- data/test/migration/projects/project2/public/favicon.ico +0 -0
- data/test/migration/projects/project2/public/index.html +241 -0
- data/test/migration/projects/project2/public/robots.txt +5 -0
- data/test/migration/projects/project2/script/rails +6 -0
- data/test/migration/test_loader.rb +78 -0
- data/test/migration/test_migration.rb +127 -0
- data/test/migration/test_nonexistent_classes.rb +120 -0
- data/test/migration/test_operations_fit_together.rb +68 -0
- data/test/migration/test_project.rb +105 -0
- data/test/migration/test_project1.slow.rb +58 -0
- data/test/migration/test_project2.slow.rb +34 -0
- data/test/migration/test_remove.rb +219 -0
- data/test/migration/test_rename.rb +238 -0
- data/test/migration/test_scenario.rb +37 -0
- data/test/migration/todo.txt +17 -0
- data/test/more_asserts.rb +63 -0
- data/test/snapshot/test_snapshot.rb +99 -0
- data/test/snapshot/test_snapshot_attributes.slow.rb +57 -0
- data/test/snapshot/test_snapshot_classes.slow.rb +32 -0
- data/test/snapshot/test_snapshotable.rb +53 -0
- data/test/test_accessors.rb +46 -0
- data/test/test_active_model_like_interface.rb +1 -1
- data/test/test_model_timestamps.rb +22 -0
- data/test/test_more_asserts.rb +68 -0
- data/test/test_naming.rb +22 -0
- data/test/test_persistence.rb +127 -0
- data/test/test_query_interface.rb +20 -25
- data/test/test_sensibles.rb +38 -0
- data/test/test_validation.rb +20 -57
- data/todo.txt +1 -0
- data/update.sh +180 -0
- metadata +156 -12
- data/lib/maglev_record/model_not_saved_or_reset.rb +0 -15
- data/test/test_dirty_object.rb +0 -50
- data/test/test_maglev_record_base.rb +0 -22
- data/test/test_maglev_simple_persistance.rb +0 -45
data/update.sh
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#! /bin/bash
|
|
2
|
+
|
|
3
|
+
#=========================================================================
|
|
4
|
+
# Copyright (C) GemStone Systems, Inc. 2010.
|
|
5
|
+
#
|
|
6
|
+
# Name - update.sh
|
|
7
|
+
#
|
|
8
|
+
# Purpose - Automatically update to a new version of GemStone
|
|
9
|
+
# in an existing git repository cloned from MagLev on github.
|
|
10
|
+
# Be both verbose and idempotent, so we can easily diagnose
|
|
11
|
+
# any problems.
|
|
12
|
+
#
|
|
13
|
+
# $Id:$
|
|
14
|
+
#
|
|
15
|
+
# Description:
|
|
16
|
+
# Updates GemStone to a version corresponsing to $MAGLEV_HOME/version.txt
|
|
17
|
+
# Safe to run multiple times. Only saves one prior backup repository though.
|
|
18
|
+
#
|
|
19
|
+
# Actions:
|
|
20
|
+
# Download the GemStone archive into the parent directory
|
|
21
|
+
# Uncompress the GemStone archive in the parent directory
|
|
22
|
+
# Update the gemstone link to point to the new GemStone
|
|
23
|
+
# Backup any existing 'maglev' repository
|
|
24
|
+
# Wipeout any previous 'maglev' configuration file
|
|
25
|
+
# Create a new default repository called 'maglev'
|
|
26
|
+
# Generate the MagLev HTML documentation
|
|
27
|
+
# Print build version information
|
|
28
|
+
# Remind user to setup environment variables
|
|
29
|
+
#=========================================================================
|
|
30
|
+
|
|
31
|
+
if [ -x bin/maglev-ruby ]; then
|
|
32
|
+
# echo "[Info] using $PWD as MAGLEV_HOME"
|
|
33
|
+
export MAGLEV_HOME=$PWD
|
|
34
|
+
else
|
|
35
|
+
echo "[Error] $PWD is not a valid MagLev directory"
|
|
36
|
+
echo "To fix this, 'clone git://github.com:MagLev/maglev.git'"
|
|
37
|
+
echo "then run install.sh from the resulting directory."
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Check that the parent directory is writable
|
|
42
|
+
if [ ! -w ".." ]; then
|
|
43
|
+
echo "[Error] This script requires write permission on the MagLev parent directory."
|
|
44
|
+
/bin/ls -ld ..
|
|
45
|
+
echo "To fix this, 'chmod u+w ..'"
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# We should run this as a normal user, not root.
|
|
50
|
+
if [ `id | cut -f2 -d= | cut -f1 -d\(` -eq 0 ]; then
|
|
51
|
+
echo "[Error] This script should be run as a normal user, not root."
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
# Detect operating system
|
|
56
|
+
PLATFORM="`uname -sm | tr ' ' '-'`"
|
|
57
|
+
# Macs with Core i7 use the same software as older Macs
|
|
58
|
+
[ $PLATFORM = "Darwin-x86_64" ] && PLATFORM="Darwin-i386"
|
|
59
|
+
gsvers=`grep ^GEMSTONE version.txt | cut -f2 -d-`
|
|
60
|
+
gss_name="GemStone-${gsvers}.${PLATFORM}"
|
|
61
|
+
gss_file=${gss_name}.tar.gz
|
|
62
|
+
|
|
63
|
+
# We're good to go. Let user know.
|
|
64
|
+
machine_name="`uname -n`"
|
|
65
|
+
echo "[Info] Installing $gss_name on $machine_name"
|
|
66
|
+
|
|
67
|
+
# Look for either wget or curl to download GemStone
|
|
68
|
+
if [ -e "`which wget 2>/dev/null`" ]; then
|
|
69
|
+
cmd="`which wget` --quiet"
|
|
70
|
+
elif [ -e "`which curl 2>/dev/null`" ]; then
|
|
71
|
+
cmd="`which curl` -s -O"
|
|
72
|
+
else
|
|
73
|
+
echo "[Error] Neither wget nor curl is available. Install one of them and rerun this script."
|
|
74
|
+
exit 1
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# IMPORTANT: Move to the parent directory of the MagLev git repository
|
|
78
|
+
cd $MAGLEV_HOME/..
|
|
79
|
+
|
|
80
|
+
# Download appropriate version of GemStone
|
|
81
|
+
if [ ! -e $gss_file ]; then
|
|
82
|
+
echo "[Info] Downloading $gss_file using ${cmd}"
|
|
83
|
+
$cmd http://glass-downloads.gemstone.com/maglev/$gss_file
|
|
84
|
+
else
|
|
85
|
+
echo "[Info] $gss_file already exists"
|
|
86
|
+
echo "to replace it, remove or rename it and rerun this script"
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
# Uncompress the downloaded GemStone archive in the current directory
|
|
90
|
+
echo "[Info] Uncompressing $gss_file in $PWD"
|
|
91
|
+
if [ ! -e $gss_name ]; then
|
|
92
|
+
gunzip -c $gss_file | tar xf -
|
|
93
|
+
else
|
|
94
|
+
echo "[Warning] $gss_name already exists"
|
|
95
|
+
echo "to replace it, remove or rename it and rerun this script"
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
# Create a link to the GemStone directory
|
|
99
|
+
echo "[Info] Linking $gss_name to ${MAGLEV_HOME}/gemstone"
|
|
100
|
+
rm -f $MAGLEV_HOME/gemstone
|
|
101
|
+
ln -sf ${PWD}/$gss_name $MAGLEV_HOME/gemstone
|
|
102
|
+
|
|
103
|
+
# Finally get back to the MagLev directory
|
|
104
|
+
cd $MAGLEV_HOME
|
|
105
|
+
|
|
106
|
+
# Make sure we have a locks directory
|
|
107
|
+
mkdir -p locks
|
|
108
|
+
# and the correct updated keyfile
|
|
109
|
+
rm -f etc/maglev.demo.key
|
|
110
|
+
ln -sf maglev.demo.key-$PLATFORM etc/maglev.demo.key
|
|
111
|
+
# Make sure we have specs and benchmarks.
|
|
112
|
+
echo "[Info] updating MSpec and RubySpec submodules"
|
|
113
|
+
git submodule --quiet update --init
|
|
114
|
+
|
|
115
|
+
# Create a default repository called "maglev" and generate the MagLev HTML documentation
|
|
116
|
+
# Check for existence of required executable rake
|
|
117
|
+
if [ -e "`which rake 2>/dev/null`" ]; then
|
|
118
|
+
# Backup any existing maglev repository
|
|
119
|
+
if [ -e data/maglev/extent/extent0.ruby.dbf ]; then
|
|
120
|
+
echo "[Info] Backing up existing 'maglev' repository to backups/previous_maglev_extent.tgz"
|
|
121
|
+
rake maglev:take_snapshot >/dev/null
|
|
122
|
+
mv backups/maglev_extent.tgz backups/previous_maglev_extent.tgz
|
|
123
|
+
fi
|
|
124
|
+
# create a clean slate
|
|
125
|
+
if [ -e etc/conf.d/maglev.conf ]; then
|
|
126
|
+
echo "[Info] Removing existing 'maglev' configuration file."
|
|
127
|
+
rake stone:destroy[maglev] >/dev/null
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
if [ ! -e bin/extent0.ruby.dbf ]; then
|
|
131
|
+
extent0='gemstone/bin/extent0.dbf'
|
|
132
|
+
echo "[Info] Building new extent0.ruby.dbf from $extent0 and creating default maglev stone"
|
|
133
|
+
echo "This could take a while..."
|
|
134
|
+
if [ -e $extent0 ]; then
|
|
135
|
+
# NOTE: build:maglev will also create the maglev stone
|
|
136
|
+
if rake build:maglev ; then
|
|
137
|
+
echo "[Info] Generating the MagLev HTML documentation"
|
|
138
|
+
rake rdoc >/dev/null 2>&1
|
|
139
|
+
else
|
|
140
|
+
echo "[Warning] Could not build new ruby extent"
|
|
141
|
+
fi
|
|
142
|
+
else
|
|
143
|
+
echo "[Warning] Can't find ${extent0}: Skip building ruby extent"
|
|
144
|
+
fi
|
|
145
|
+
else
|
|
146
|
+
if [ ! -e etc/conf.d/maglev.conf ]; then
|
|
147
|
+
echo "[Info] Creating new default 'maglev' repository"
|
|
148
|
+
rake stone:create[maglev] >/dev/null
|
|
149
|
+
fi
|
|
150
|
+
fi
|
|
151
|
+
echo "[Info] Starting MagLev stone (loading kernel classes)"
|
|
152
|
+
rake maglev:start
|
|
153
|
+
else
|
|
154
|
+
echo "[Warning] rake not found!"
|
|
155
|
+
echo "Skipping creation of default 'maglev' repository and HTML documentation."
|
|
156
|
+
fi
|
|
157
|
+
|
|
158
|
+
echo
|
|
159
|
+
echo "[Info] Finished upgrade to $gss_name on $machine_name"
|
|
160
|
+
echo ""
|
|
161
|
+
echo "[Info] MagLev version information:"
|
|
162
|
+
cat version.txt
|
|
163
|
+
echo "[Info] GemStone version information:"
|
|
164
|
+
cat gemstone/version.txt
|
|
165
|
+
|
|
166
|
+
# Reminder to setup environment variables
|
|
167
|
+
echo ""
|
|
168
|
+
echo "[Info] Adding these to your .bashrc will make it easier to run MagLev"
|
|
169
|
+
echo "export MAGLEV_HOME=${PWD}"
|
|
170
|
+
echo 'export PATH=$MAGLEV_HOME/bin:$PATH'
|
|
171
|
+
|
|
172
|
+
# Reminder to generate Smalltalk FFI
|
|
173
|
+
echo ""
|
|
174
|
+
echo "[Info] If you want to call GemStone Smalltalk methods from Ruby, run"
|
|
175
|
+
echo " rake stwrappers"
|
|
176
|
+
echo "after this upgrade has finished. This will generate .rb files you can use"
|
|
177
|
+
echo "in \$MAGLEV_HOME/lib/ruby/site_ruby/1.8/smalltalk/"
|
|
178
|
+
|
|
179
|
+
# End of script
|
|
180
|
+
exit 0
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: maglevrecord
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -13,7 +13,7 @@ authors:
|
|
|
13
13
|
autorequire:
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
|
-
date: 2013-
|
|
16
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
|
17
17
|
dependencies: []
|
|
18
18
|
description: Library for using to MagLev to persist your data in a Rails app.
|
|
19
19
|
email: bp2012h1@hpi.uni-potsdam.de
|
|
@@ -21,20 +21,163 @@ executables: []
|
|
|
21
21
|
extensions: []
|
|
22
22
|
extra_rdoc_files: []
|
|
23
23
|
files:
|
|
24
|
-
-
|
|
24
|
+
- .gitignore
|
|
25
|
+
- .travis.yml
|
|
26
|
+
- Gemfile
|
|
27
|
+
- README.md
|
|
28
|
+
- Rakefile
|
|
29
|
+
- install.sh
|
|
30
|
+
- lib/maglev_record.rb
|
|
31
|
+
- lib/maglev_record/base.rb
|
|
25
32
|
- lib/maglev_record/enumerable.rb
|
|
26
|
-
- lib/maglev_record/
|
|
33
|
+
- lib/maglev_record/errors.rb
|
|
34
|
+
- lib/maglev_record/integration.rb
|
|
35
|
+
- lib/maglev_record/maglev_record.rb
|
|
36
|
+
- lib/maglev_record/maglev_support/active_support_patch.rb
|
|
37
|
+
- lib/maglev_record/maglev_support/concern.rb
|
|
38
|
+
- lib/maglev_record/maglev_support/maglev_support.rb
|
|
39
|
+
- lib/maglev_record/maglev_support/secure_password.rb
|
|
40
|
+
- lib/maglev_record/migration.rb
|
|
41
|
+
- lib/maglev_record/migration/loader.rb
|
|
42
|
+
- lib/maglev_record/migration/migration.rb
|
|
43
|
+
- lib/maglev_record/migration/migrator.rb
|
|
44
|
+
- lib/maglev_record/migration/operations.rb
|
|
27
45
|
- lib/maglev_record/persistence.rb
|
|
28
|
-
- lib/maglev_record/
|
|
29
|
-
- lib/maglev_record.rb
|
|
46
|
+
- lib/maglev_record/raketasks.rb
|
|
47
|
+
- lib/maglev_record/read_write.rb
|
|
48
|
+
- lib/maglev_record/rooted_base.rb
|
|
49
|
+
- lib/maglev_record/rooted_enumerable.rb
|
|
50
|
+
- lib/maglev_record/rooted_persistence.rb
|
|
51
|
+
- lib/maglev_record/sensible.rb
|
|
52
|
+
- lib/maglev_record/snapshot.rb
|
|
53
|
+
- lib/maglev_record/snapshot/change.rb
|
|
54
|
+
- lib/maglev_record/snapshot/snapshot.rb
|
|
55
|
+
- lib/maglev_record/snapshot/snapshotable.rb
|
|
56
|
+
- lib/maglev_record/tools.rb
|
|
57
|
+
- lib/maglev_record/tools/object_reference.rb
|
|
58
|
+
- lib/maglev_record/tools/submodule_finder.rb
|
|
59
|
+
- lib/tasks/database.rake
|
|
60
|
+
- maglevrecord.gemspec
|
|
61
|
+
- rails/init.rb
|
|
62
|
+
- test/_test_object_reference.rb
|
|
30
63
|
- test/example_model.rb
|
|
31
|
-
- test/test_validation.rb
|
|
32
|
-
- test/test_maglev_simple_persistance.rb
|
|
33
|
-
- test/test_maglev_record_base.rb
|
|
34
64
|
- test/lint.rb
|
|
35
|
-
- test/
|
|
36
|
-
- test/
|
|
65
|
+
- test/migration/dummy_migrations/migration_1.rb
|
|
66
|
+
- test/migration/dummy_migrations/migration_2.rb
|
|
67
|
+
- test/migration/dummy_migrations/migration_3.rb
|
|
68
|
+
- test/migration/migrations/migration_1.rb
|
|
69
|
+
- test/migration/migrations/migration_2.rb
|
|
70
|
+
- test/migration/migrations/migration_3.rb
|
|
71
|
+
- test/migration/operation_setup.rb
|
|
72
|
+
- test/migration/projects/project1/.gitignore
|
|
73
|
+
- test/migration/projects/project1/Gemfile
|
|
74
|
+
- test/migration/projects/project1/Gemfile.lock
|
|
75
|
+
- test/migration/projects/project1/README.rdoc
|
|
76
|
+
- test/migration/projects/project1/Rakefile
|
|
77
|
+
- test/migration/projects/project1/app/assets/images/rails.png
|
|
78
|
+
- test/migration/projects/project1/app/assets/javascripts/application.js
|
|
79
|
+
- test/migration/projects/project1/app/assets/stylesheets/application.css
|
|
80
|
+
- test/migration/projects/project1/app/controllers/application_controller.rb
|
|
81
|
+
- test/migration/projects/project1/app/helpers/application_helper.rb
|
|
82
|
+
- test/migration/projects/project1/app/mailers/.gitkeep
|
|
83
|
+
- test/migration/projects/project1/app/models/.gitkeep
|
|
84
|
+
- test/migration/projects/project1/app/views/layouts/application.html.erb
|
|
85
|
+
- test/migration/projects/project1/config.ru
|
|
86
|
+
- test/migration/projects/project1/config/application.rb
|
|
87
|
+
- test/migration/projects/project1/config/boot.rb
|
|
88
|
+
- test/migration/projects/project1/config/database.yml
|
|
89
|
+
- test/migration/projects/project1/config/environment.rb
|
|
90
|
+
- test/migration/projects/project1/config/environments/development.rb
|
|
91
|
+
- test/migration/projects/project1/config/environments/production.rb
|
|
92
|
+
- test/migration/projects/project1/config/initializers/backtrace_silencers.rb
|
|
93
|
+
- test/migration/projects/project1/config/initializers/inflections.rb
|
|
94
|
+
- test/migration/projects/project1/config/initializers/mime_types.rb
|
|
95
|
+
- test/migration/projects/project1/config/initializers/secret_token.rb
|
|
96
|
+
- test/migration/projects/project1/config/initializers/session_store.rb
|
|
97
|
+
- test/migration/projects/project1/config/initializers/wrap_parameters.rb
|
|
98
|
+
- test/migration/projects/project1/config/locales/en.yml
|
|
99
|
+
- test/migration/projects/project1/config/routes.rb
|
|
100
|
+
- test/migration/projects/project1/db/seeds.rb
|
|
101
|
+
- test/migration/projects/project1/lib/assets/.gitkeep
|
|
102
|
+
- test/migration/projects/project1/lib/tasks/.gitkeep
|
|
103
|
+
- test/migration/projects/project1/log/.gitkeep
|
|
104
|
+
- test/migration/projects/project1/public/404.html
|
|
105
|
+
- test/migration/projects/project1/public/422.html
|
|
106
|
+
- test/migration/projects/project1/public/500.html
|
|
107
|
+
- test/migration/projects/project1/public/favicon.ico
|
|
108
|
+
- test/migration/projects/project1/public/index.html
|
|
109
|
+
- test/migration/projects/project1/public/robots.txt
|
|
110
|
+
- test/migration/projects/project1/script/rails
|
|
111
|
+
- test/migration/projects/project2/.gitignore
|
|
112
|
+
- test/migration/projects/project2/Gemfile
|
|
113
|
+
- test/migration/projects/project2/Gemfile.lock
|
|
114
|
+
- test/migration/projects/project2/README.rdoc
|
|
115
|
+
- test/migration/projects/project2/Rakefile
|
|
116
|
+
- test/migration/projects/project2/app/assets/images/rails.png
|
|
117
|
+
- test/migration/projects/project2/app/assets/javascripts/application.js
|
|
118
|
+
- test/migration/projects/project2/app/assets/stylesheets/application.css
|
|
119
|
+
- test/migration/projects/project2/app/controllers/application_controller.rb
|
|
120
|
+
- test/migration/projects/project2/app/helpers/application_helper.rb
|
|
121
|
+
- test/migration/projects/project2/app/mailers/.gitkeep
|
|
122
|
+
- test/migration/projects/project2/app/models/.gitkeep
|
|
123
|
+
- test/migration/projects/project2/app/models/project_model.rb
|
|
124
|
+
- test/migration/projects/project2/app/views/layouts/application.html.erb
|
|
125
|
+
- test/migration/projects/project2/config.ru
|
|
126
|
+
- test/migration/projects/project2/config/application.rb
|
|
127
|
+
- test/migration/projects/project2/config/boot.rb
|
|
128
|
+
- test/migration/projects/project2/config/database.yml
|
|
129
|
+
- test/migration/projects/project2/config/environment.rb
|
|
130
|
+
- test/migration/projects/project2/config/environments/development.rb
|
|
131
|
+
- test/migration/projects/project2/config/environments/production.rb
|
|
132
|
+
- test/migration/projects/project2/config/initializers/backtrace_silencers.rb
|
|
133
|
+
- test/migration/projects/project2/config/initializers/inflections.rb
|
|
134
|
+
- test/migration/projects/project2/config/initializers/mime_types.rb
|
|
135
|
+
- test/migration/projects/project2/config/initializers/secret_token.rb
|
|
136
|
+
- test/migration/projects/project2/config/initializers/session_store.rb
|
|
137
|
+
- test/migration/projects/project2/config/initializers/wrap_parameters.rb
|
|
138
|
+
- test/migration/projects/project2/config/locales/en.yml
|
|
139
|
+
- test/migration/projects/project2/config/routes.rb
|
|
140
|
+
- test/migration/projects/project2/db/seeds.rb
|
|
141
|
+
- test/migration/projects/project2/lib/assets/.gitkeep
|
|
142
|
+
- test/migration/projects/project2/lib/tasks/.gitkeep
|
|
143
|
+
- test/migration/projects/project2/log/.gitkeep
|
|
144
|
+
- test/migration/projects/project2/migrations/migration_2013-04-Apr-23_17.31.38.rb
|
|
145
|
+
- test/migration/projects/project2/migrations/migration_2013-04-Apr-23_17.31.52.rb
|
|
146
|
+
- test/migration/projects/project2/migrations/migration_2013-04-Apr-23_17.32.07.rb
|
|
147
|
+
- test/migration/projects/project2/public/404.html
|
|
148
|
+
- test/migration/projects/project2/public/422.html
|
|
149
|
+
- test/migration/projects/project2/public/500.html
|
|
150
|
+
- test/migration/projects/project2/public/favicon.ico
|
|
151
|
+
- test/migration/projects/project2/public/index.html
|
|
152
|
+
- test/migration/projects/project2/public/robots.txt
|
|
153
|
+
- test/migration/projects/project2/script/rails
|
|
154
|
+
- test/migration/test_loader.rb
|
|
155
|
+
- test/migration/test_migration.rb
|
|
156
|
+
- test/migration/test_nonexistent_classes.rb
|
|
157
|
+
- test/migration/test_operations_fit_together.rb
|
|
158
|
+
- test/migration/test_project.rb
|
|
159
|
+
- test/migration/test_project1.slow.rb
|
|
160
|
+
- test/migration/test_project2.slow.rb
|
|
161
|
+
- test/migration/test_remove.rb
|
|
162
|
+
- test/migration/test_rename.rb
|
|
163
|
+
- test/migration/test_scenario.rb
|
|
164
|
+
- test/migration/todo.txt
|
|
165
|
+
- test/more_asserts.rb
|
|
166
|
+
- test/snapshot/test_snapshot.rb
|
|
167
|
+
- test/snapshot/test_snapshot_attributes.slow.rb
|
|
168
|
+
- test/snapshot/test_snapshot_classes.slow.rb
|
|
169
|
+
- test/snapshot/test_snapshotable.rb
|
|
170
|
+
- test/test_accessors.rb
|
|
37
171
|
- test/test_active_model_like_interface.rb
|
|
172
|
+
- test/test_model_timestamps.rb
|
|
173
|
+
- test/test_more_asserts.rb
|
|
174
|
+
- test/test_naming.rb
|
|
175
|
+
- test/test_persistence.rb
|
|
176
|
+
- test/test_query_interface.rb
|
|
177
|
+
- test/test_sensibles.rb
|
|
178
|
+
- test/test_validation.rb
|
|
179
|
+
- todo.txt
|
|
180
|
+
- update.sh
|
|
38
181
|
homepage: https://github.com/knub/maglevrecord
|
|
39
182
|
licenses: []
|
|
40
183
|
post_install_message:
|
|
@@ -55,8 +198,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
55
198
|
version: '0'
|
|
56
199
|
requirements: []
|
|
57
200
|
rubyforge_project:
|
|
58
|
-
rubygems_version: 1.8.
|
|
201
|
+
rubygems_version: 1.8.24
|
|
59
202
|
signing_key:
|
|
60
203
|
specification_version: 3
|
|
61
204
|
summary: MagLev persistence with an ActiveRecord-like interface!
|
|
62
205
|
test_files: []
|
|
206
|
+
has_rdoc:
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Maglev.persistent do
|
|
2
|
-
# Object.remove_const(:NotSavedOnReset)
|
|
3
|
-
# end
|
|
4
|
-
# Maglev.commit_transaction
|
|
5
|
-
|
|
6
|
-
module MaglevRecord
|
|
7
|
-
Maglev.transient do
|
|
8
|
-
class ModelNotSavedOrReset
|
|
9
|
-
@instance = self.new
|
|
10
|
-
def self.new
|
|
11
|
-
@instance
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
data/test/test_dirty_object.rb
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Maglev.persistent do
|
|
2
|
-
# Object.remove_const(:NotSavedOnReset)
|
|
3
|
-
# end
|
|
4
|
-
# Maglev.commit_transaction
|
|
5
|
-
|
|
6
|
-
# Maglev.transient do
|
|
7
|
-
# class ModelNotSavedOrReset
|
|
8
|
-
# end
|
|
9
|
-
# end
|
|
10
|
-
|
|
11
|
-
# Maglev::PERSISTENT_ROOT['tmp'] = NotSavedOnReset.new
|
|
12
|
-
# Maglev.commit_transaction
|
|
13
|
-
|
|
14
|
-
require 'rubygems'
|
|
15
|
-
require 'test/unit'
|
|
16
|
-
|
|
17
|
-
class DirtyObjectTest < Test::Unit::TestCase
|
|
18
|
-
|
|
19
|
-
def setup
|
|
20
|
-
Maglev.abort_transaction
|
|
21
|
-
@book = Book.dummy
|
|
22
|
-
@book.save
|
|
23
|
-
Maglev.commit_transaction
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def test_no_save_or_reset_throws_error
|
|
27
|
-
@book.author = "Shakespeare"
|
|
28
|
-
assert_raise TransactionError do
|
|
29
|
-
Maglev.commit_transaction
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def test_reset_throws_no_error
|
|
34
|
-
@book.author = "Shakespeare"
|
|
35
|
-
@book.reset!
|
|
36
|
-
assert_nothing_raised Exception do
|
|
37
|
-
Maglev.commit_transaction
|
|
38
|
-
end
|
|
39
|
-
assert_equal "Joanne K. Rowling", @book.author
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def test_save_throws_no_error
|
|
43
|
-
@book.author = "Shakespeare"
|
|
44
|
-
@book.save
|
|
45
|
-
assert_nothing_raised Exception do
|
|
46
|
-
Maglev.commit_transaction
|
|
47
|
-
end
|
|
48
|
-
assert_equal @book.author, "Shakespeare"
|
|
49
|
-
end
|
|
50
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#require 'bacon'
|
|
2
|
-
#require 'maglev_record'
|
|
3
|
-
|
|
4
|
-
#class ExampleStudent
|
|
5
|
-
# include Maglev::Base
|
|
6
|
-
#
|
|
7
|
-
# attr_accessible :name
|
|
8
|
-
#
|
|
9
|
-
# def initialize(name)
|
|
10
|
-
# name = name
|
|
11
|
-
# end
|
|
12
|
-
#end
|
|
13
|
-
|
|
14
|
-
#describe 'ExampleStudent' do
|
|
15
|
-
# let(:student) { ExampleStudent.new('Ferdinand') }
|
|
16
|
-
#
|
|
17
|
-
# it "should know its name" do
|
|
18
|
-
# subject.name.should equal('Ferdinand')
|
|
19
|
-
# end
|
|
20
|
-
#
|
|
21
|
-
#end
|
|
22
|
-
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
require "test/unit"
|
|
2
|
-
require "maglev_record"
|
|
3
|
-
require "example_model"
|
|
4
|
-
|
|
5
|
-
class MaglevSimplePersistanceTest < Test::Unit::TestCase
|
|
6
|
-
|
|
7
|
-
def run_with_new_transaction
|
|
8
|
-
Maglev.abort_transaction
|
|
9
|
-
yield
|
|
10
|
-
Maglev.commit_transaction
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def test_model_is_persisted
|
|
14
|
-
run_with_new_transaction do
|
|
15
|
-
book = Book.new(:title => "The Magician's Guild", :author => "Trudi Canavan")
|
|
16
|
-
book.save
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
run_with_new_transaction do
|
|
20
|
-
assert_equal Book.find { |b| b.title == "The Magician's Guild"}.author, "Trudi Canavan"
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def test_model_is_deleted
|
|
25
|
-
run_with_new_transaction do
|
|
26
|
-
book = Book.new(:title => "Harry Potter and the Philosopher's stone", :author => "Joanne K. Rowling")
|
|
27
|
-
book.save
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
run_with_new_transaction do
|
|
31
|
-
Book.find { |b| b.title == "Harry Potter and the Philosopher's stone"}.delete
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
run_with_new_transaction do
|
|
35
|
-
assert_nil Book.find { |b| b.title == "Harry Potter and the Philosopher's stone"}
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def teardown
|
|
40
|
-
run_with_new_transaction do
|
|
41
|
-
Book.clear
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
end
|