nbudin-version_fu 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ test/*.log
2
+ *.db
3
+ pkg/*
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project relativePaths="false" version="4">
3
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
+ </project>
5
+
@@ -0,0 +1,10 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0" is_locked="false">
3
+ <option name="myName" value="Project Default" />
4
+ <option name="myLocal" value="false" />
5
+ <inspection_tool class="RubyArgCount" level="ERROR" enabled="false" />
6
+ <inspection_tool class="RubyResolve" level="WARNING" enabled="false">
7
+ <option name="warnImplicitResults" value="false" />
8
+ </inspection_tool>
9
+ </profile>
10
+ </component>
@@ -0,0 +1,8 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="PROJECT_PROFILE" value="Project Default" />
4
+ <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
5
+ <scopes />
6
+ <list size="0" />
7
+ </settings>
8
+ </component>
data/.idea/misc.xml ADDED
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project relativePaths="false" version="4">
3
+ <component name="DependencyValidationManager">
4
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
5
+ </component>
6
+ <component name="ProjectDetails">
7
+ <option name="projectName" value="version_fu" />
8
+ </component>
9
+ <component name="ProjectRootManager" version="2" project-jdk-name="JRuby SDK 1.3.1 (/etc/jruby-1.3.1/bin/jruby)" project-jdk-type="JRUBY_SDK" />
10
+ <component name="SvnBranchConfigurationManager">
11
+ <option name="mySupportsUserInfoFilter" value="true" />
12
+ </component>
13
+ </project>
14
+
data/.idea/modules.xml ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project relativePaths="false" version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/version_fu.iml" filepath="$PROJECT_DIR$/.idea/version_fu.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
9
+
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project relativePaths="false" version="4">
3
+ <component name="CodeStyleSettingsManager">
4
+ <option name="PER_PROJECT_SETTINGS" />
5
+ <option name="USE_PER_PROJECT_SETTINGS" value="false" />
6
+ </component>
7
+ </project>
8
+
data/.idea/vcs.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project relativePaths="false" version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="" />
5
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
6
+ </component>
7
+ </project>
8
+
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module relativePaths="false" type="RUBY_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ <component name="RModuleSettingsStorage">
9
+ <RMODULE_SETTINGS_STORAGE_ID NAME="NUMBER" VALUE="0" />
10
+ </component>
11
+ </module>
12
+
@@ -0,0 +1,316 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project relativePaths="false" version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" readonly="true" name="Default" comment="">
5
+ <change type="DELETED" beforePath="$PROJECT_DIR$/init.rb" afterPath="" />
6
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/VERSION" afterPath="$PROJECT_DIR$/VERSION" />
7
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/Rakefile" />
8
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/version_fu/version_fu.rb" />
9
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" />
10
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/profiles_settings.xml" />
11
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/version_fu.rb" afterPath="$PROJECT_DIR$/lib/version_fu.rb" />
12
+ </list>
13
+ <ignored path="version_fu.iws" />
14
+ <ignored path=".idea/workspace.xml" />
15
+ </component>
16
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
17
+ <component name="CreatePatchCommitExecutor">
18
+ <option name="PATCH_PATH" value="" />
19
+ <option name="REVERSE_PATCH" value="false" />
20
+ </component>
21
+ <component name="DaemonCodeAnalyzer">
22
+ <disable_hints />
23
+ </component>
24
+ <component name="FavoritesManager">
25
+ <favorites_list name="version_fu" />
26
+ </component>
27
+ <component name="FileEditorManager">
28
+ <leaf>
29
+ <file leaf-file-name="Rakefile" pinned="false" current="false" current-in-tab="false">
30
+ <entry file="file://$PROJECT_DIR$/Rakefile">
31
+ <provider selected="true" editor-type-id="text-editor">
32
+ <state line="13" column="25" selection-start="591" selection-end="591" vertical-scroll-proportion="0.0">
33
+ <folding />
34
+ </state>
35
+ </provider>
36
+ </entry>
37
+ </file>
38
+ <file leaf-file-name="version_fu.gemspec" pinned="false" current="false" current-in-tab="false">
39
+ <entry file="file://$PROJECT_DIR$/version_fu.gemspec">
40
+ <provider selected="true" editor-type-id="text-editor">
41
+ <state line="7" column="16" selection-start="213" selection-end="213" vertical-scroll-proportion="0.0">
42
+ <folding />
43
+ </state>
44
+ </provider>
45
+ </entry>
46
+ </file>
47
+ <file leaf-file-name="VERSION" pinned="false" current="true" current-in-tab="true">
48
+ <entry file="file://$PROJECT_DIR$/VERSION">
49
+ <provider selected="true" editor-type-id="text-editor">
50
+ <state line="0" column="1" selection-start="1" selection-end="1" vertical-scroll-proportion="0.0">
51
+ <folding />
52
+ </state>
53
+ </provider>
54
+ </entry>
55
+ </file>
56
+ <file leaf-file-name="README.rdoc" pinned="false" current="false" current-in-tab="false">
57
+ <entry file="file://$PROJECT_DIR$/README.rdoc">
58
+ <provider selected="true" editor-type-id="text-editor">
59
+ <state line="108" column="99" selection-start="3577" selection-end="3816" vertical-scroll-proportion="0.0">
60
+ <folding />
61
+ </state>
62
+ </provider>
63
+ </entry>
64
+ </file>
65
+ </leaf>
66
+ </component>
67
+ <component name="FindManager">
68
+ <FindUsagesManager>
69
+ <setting name="OPEN_NEW_TAB" value="false" />
70
+ </FindUsagesManager>
71
+ </component>
72
+ <component name="ProjectLevelVcsManager">
73
+ <OptionsSetting value="true" id="Add" />
74
+ <OptionsSetting value="true" id="Remove" />
75
+ <OptionsSetting value="true" id="Checkout" />
76
+ <OptionsSetting value="true" id="Update" />
77
+ <OptionsSetting value="true" id="Status" />
78
+ <OptionsSetting value="true" id="Edit" />
79
+ <ConfirmationsSetting value="0" id="Add" />
80
+ <ConfirmationsSetting value="0" id="Remove" />
81
+ </component>
82
+ <component name="ProjectPane">
83
+ <subPane>
84
+ <PATH>
85
+ <PATH_ELEMENT>
86
+ <option name="myItemId" value="version_fu" />
87
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
88
+ </PATH_ELEMENT>
89
+ </PATH>
90
+ <PATH>
91
+ <PATH_ELEMENT>
92
+ <option name="myItemId" value="version_fu" />
93
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
94
+ </PATH_ELEMENT>
95
+ <PATH_ELEMENT>
96
+ <option name="myItemId" value="version_fu" />
97
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
98
+ </PATH_ELEMENT>
99
+ </PATH>
100
+ </subPane>
101
+ </component>
102
+ <component name="ProjectReloadState">
103
+ <option name="STATE" value="0" />
104
+ </component>
105
+ <component name="ProjectView">
106
+ <navigator currentView="ProjectPane" proportions="0.5" version="1" splitterProportion="0.5">
107
+ <flattenPackages />
108
+ <showMembers />
109
+ <showModules />
110
+ <showLibraryContents />
111
+ <hideEmptyPackages />
112
+ <abbreviatePackageNames />
113
+ <showStructure ProjectPane="false" />
114
+ <autoscrollToSource />
115
+ <autoscrollFromSource />
116
+ <sortByType />
117
+ </navigator>
118
+ </component>
119
+ <component name="RunManager" selected="Ruby.Rakefile">
120
+ <tempConfiguration default="false" name="Rakefile" type="RubyRunConfigurationType" factoryName="Ruby script">
121
+ <module name="version_fu" />
122
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)" />
123
+ <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$PROJECT_DIR$" />
124
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
125
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
126
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
127
+ <envs />
128
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$PROJECT_DIR$/Rakefile" />
129
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
130
+ <RunnerSettings RunnerId="RubyRunner" />
131
+ <ConfigurationWrapper RunnerId="RubyRunner" />
132
+ <method />
133
+ </tempConfiguration>
134
+ <configuration default="true" type="RSpecRunConfigurationType" factoryName="RSpec">
135
+ <module name="" />
136
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)" />
137
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
138
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
139
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
140
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
141
+ <envs />
142
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
143
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
144
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="[none]" />
145
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
146
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
147
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
148
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
149
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
150
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
151
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
152
+ </configuration>
153
+ <configuration default="true" type="TestUnitRunConfigurationType" factoryName="Ruby test">
154
+ <module name="" />
155
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)" />
156
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
157
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
158
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
159
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
160
+ <envs />
161
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
162
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
163
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_CLASS_NAME" VALUE="" />
164
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
165
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="" />
166
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
167
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="INHERITANCE_CHECK_DISABLED" VALUE="false" />
168
+ </configuration>
169
+ <configuration default="true" type="CucumberRunConfigurationType" factoryName="Cucumber">
170
+ <module name="" />
171
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)" />
172
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
173
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
174
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
175
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
176
+ <envs />
177
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*.feature" />
178
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
179
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
180
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
181
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="TEST_TAGS_FILTER" VALUE="" />
182
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="TEST_NAME_FILTER" VALUE="" />
183
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="CUCUMBER_ARGS" VALUE="" />
184
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
185
+ <CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="VERBOSE_OPTION" VALUE="false" />
186
+ </configuration>
187
+ <configuration default="true" type="RubyRunConfigurationType" factoryName="Ruby script">
188
+ <module name="" />
189
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)" />
190
+ <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="" />
191
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
192
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
193
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
194
+ <envs />
195
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="" />
196
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
197
+ </configuration>
198
+ <list size="1">
199
+ <item index="0" class="java.lang.String" itemvalue="Ruby.Rakefile" />
200
+ </list>
201
+ </component>
202
+ <component name="ShelveChangesManager" show_recycled="false" />
203
+ <component name="SvnConfiguration">
204
+ <option name="USER" value="" />
205
+ <option name="PASSWORD" value="" />
206
+ <option name="LAST_MERGED_REVISION" />
207
+ <option name="UPDATE_RUN_STATUS" value="false" />
208
+ <option name="MERGE_DRY_RUN" value="false" />
209
+ <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
210
+ <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
211
+ <option name="IGNORE_SPACES_IN_MERGE" value="false" />
212
+ <option name="DETECT_NESTED_COPIES" value="false" />
213
+ <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
214
+ <configuration useDefault="true">/home/andrew/.subversion</configuration>
215
+ <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
216
+ <supportedVersion>125</supportedVersion>
217
+ </component>
218
+ <component name="ToolWindowManager">
219
+ <frame x="0" y="25" width="1680" height="1000" extended-state="0" />
220
+ <editor active="true" />
221
+ <layout>
222
+ <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
223
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" />
224
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.6624857" order="1" side_tool="false" />
225
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.6624857" order="0" side_tool="false" />
226
+ <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
227
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" />
228
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3295325" sideWeight="0.5" order="2" side_tool="false" />
229
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
230
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" />
231
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" />
232
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" />
233
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" />
234
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" />
235
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" />
236
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" />
237
+ </layout>
238
+ </component>
239
+ <component name="VcsManagerConfiguration">
240
+ <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
241
+ <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
242
+ <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
243
+ <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
244
+ <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
245
+ <option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
246
+ <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
247
+ <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
248
+ <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
249
+ <option name="LAST_COMMIT_MESSAGE" />
250
+ <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
251
+ <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
252
+ <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
253
+ <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
254
+ <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
255
+ <option name="ACTIVE_VCS_NAME" />
256
+ <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
257
+ <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
258
+ <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
259
+ <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
260
+ </component>
261
+ <component name="XDebuggerManager">
262
+ <breakpoint-manager />
263
+ </component>
264
+ <component name="editorHistoryManager">
265
+ <entry file="file://$PROJECT_DIR$/test/fixtures/author.rb">
266
+ <provider selected="true" editor-type-id="text-editor">
267
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
268
+ <folding />
269
+ </state>
270
+ </provider>
271
+ </entry>
272
+ <entry file="file://$PROJECT_DIR$/test/test_helper.rb">
273
+ <provider selected="true" editor-type-id="text-editor">
274
+ <state line="1" column="0" selection-start="20" selection-end="20" vertical-scroll-proportion="0.0">
275
+ <folding />
276
+ </state>
277
+ </provider>
278
+ </entry>
279
+ <entry file="file://$PROJECT_DIR$/lib/version_fu.rb">
280
+ <provider selected="true" editor-type-id="text-editor">
281
+ <state line="0" column="30" selection-start="30" selection-end="30" vertical-scroll-proportion="0.0">
282
+ <folding />
283
+ </state>
284
+ </provider>
285
+ </entry>
286
+ <entry file="file://$PROJECT_DIR$/README.rdoc">
287
+ <provider selected="true" editor-type-id="text-editor">
288
+ <state line="108" column="99" selection-start="3577" selection-end="3816" vertical-scroll-proportion="0.0">
289
+ <folding />
290
+ </state>
291
+ </provider>
292
+ </entry>
293
+ <entry file="file://$PROJECT_DIR$/Rakefile">
294
+ <provider selected="true" editor-type-id="text-editor">
295
+ <state line="13" column="25" selection-start="591" selection-end="591" vertical-scroll-proportion="0.0">
296
+ <folding />
297
+ </state>
298
+ </provider>
299
+ </entry>
300
+ <entry file="file://$PROJECT_DIR$/version_fu.gemspec">
301
+ <provider selected="true" editor-type-id="text-editor">
302
+ <state line="7" column="16" selection-start="213" selection-end="213" vertical-scroll-proportion="0.0">
303
+ <folding />
304
+ </state>
305
+ </provider>
306
+ </entry>
307
+ <entry file="file://$PROJECT_DIR$/VERSION">
308
+ <provider selected="true" editor-type-id="text-editor">
309
+ <state line="0" column="1" selection-start="1" selection-end="1" vertical-scroll-proportion="0.0">
310
+ <folding />
311
+ </state>
312
+ </provider>
313
+ </entry>
314
+ </component>
315
+ </project>
316
+
data/MIT-LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ == version_fu
2
+ Copyright (c) 2008-9 Jordan McKible
3
+
4
+ == acts_as_versioned
5
+ Copyright (c) 2005 Rick Olson
6
+ ====================================================================
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
9
+ this software and associated documentation files (the "Software"), to deal in
10
+ the Software without restriction, including without limitation the rights to
11
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12
+ of the Software, and to permit persons to whom the Software is furnished to do
13
+ so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,121 @@
1
+ = version_fu
2
+
3
+ version_fu is a ActveRecord versioning plugin that takes advantage of the new dirty attribute checking available in Rails 2.1. Previous solutions like Rick Olson's acts_as_versioned are no long compatible with Rails.
4
+
5
+ nbudin-version_fu is Nat Budin's attempt to merge revo's Gemified version with jmckible's latest additions and fixes. Nat hopes to have these changes merged into mainline version_fu eventually so that it can be released as a gem.
6
+
7
+ == Installation
8
+
9
+ gem install nbudin-version_fu
10
+
11
+ === Installation in a Rails application
12
+
13
+ In your config/environment.rb, or in an initializer, add the line:
14
+
15
+ config.gem "nbudin-version_fu", :lib => "version_fu", :source => "http://gemcutter.org"
16
+
17
+ Then run:
18
+
19
+ sudo rake gems:install
20
+
21
+ == Usage
22
+
23
+ Let's say I have a pages table:
24
+
25
+ class Page < ActiveRecord::Base
26
+ # attributes: id, type, title, body, created_at, updated_at, creator_id, author_id
27
+ end
28
+
29
+ I want to track any changes made. First step will be to make a new page_versions table:
30
+
31
+ class CreatePageVersions < ActiveRecord::Migration
32
+ def self.up
33
+ create_table :page_versions do |t|
34
+ t.integer :page_id, :version, :author_id
35
+ t.string :title
36
+ t.text :body
37
+ t.timestamps
38
+ end
39
+ end
40
+
41
+ def self.down
42
+ drop_table :page_versions
43
+ end
44
+ end
45
+
46
+ In this case, the author_id column represents the last person to edit the page. We want to track this attribute with every version. However, the creator_id is the person who created the page. The will never change, so it's not part of the versioned table.
47
+
48
+ Don't forget to add a version column to your pages table. Have it default to 1 just to be safe (although the plugin should account for this):
49
+
50
+ class AddVersionToPages < ActiveRecord::Migration
51
+ def self.up
52
+ add_column :pages, :version, :integer, :default=>1
53
+ end
54
+ def self.down
55
+ remove_column :pages, :version
56
+ end
57
+ end
58
+
59
+ Of course if you're adding this plugin to a table with existing data, you'll probably want to instantiate some initial versions to start with.
60
+
61
+ Alright, so now that the database tables are in place, we can fire up version_fu. It's quite simple:
62
+
63
+ class Page < ActiveRecord::Base
64
+ version_fu
65
+ end
66
+
67
+ Thats it.
68
+
69
+
70
+ == Configuration
71
+
72
+ You can pass a few configuration options if need be. If you stick with the defaults above, you can skip all this.
73
+
74
+ class Page < ActiveRecord::Base
75
+ version_fu :class_name=>'Version', :foreign_key=>'page_id', :table_name=>'page_versions', :version_column=>'version'
76
+ end
77
+
78
+ * :class_name - The name of the versioned class. It will be a submodule of the versioning class - e.g. Page::Version
79
+
80
+ * :foreign_key - The column in the versioned table associated with the versioning class
81
+
82
+ * :table_name - The name of the versioned table
83
+
84
+ * :version_column - The name of the version column
85
+
86
+
87
+ == Extensions
88
+
89
+ Now that you've got some versions, it would be nice to use ActiveRecord associations on it. For example, Page.first.versions.latest.author wouldn't currently work because the Page::Version class doesn't know about the author method. The version_fu call does all you to pass a block which is executed by the versioned class. There is just one gotcha for associations:
90
+
91
+ class Page < ActiveRecord::Base
92
+ version_fu do
93
+ belongs_to :author, :class_name=>'::Author'
94
+ end
95
+ end
96
+
97
+ Don't forget the class name, or you'll get a warning
98
+
99
+ == When to Version
100
+
101
+ By default a new version will be saved whenever a versioned column is changed. However, you can control this at a more fine grained level. Just override the create_new_version? method. For example, let's say you only want to save a new version if both the page title and body changed. Taking advantage of the dirty attribute methods, you could do something like this:
102
+
103
+ class Page < ActiveRecord::Base
104
+ version_fu do
105
+ belongs_to :author, :class_name=>'::Author'
106
+ end
107
+ def create_new_version?
108
+ title_changed? && body_changed?
109
+ end
110
+ end
111
+
112
+
113
+ == Author
114
+
115
+ * version_fu was created by Jordan McKible http://jordan.mckible.com
116
+
117
+ * Available on GitHub at http://github.com/jmckible/version_fu/tree/master
118
+
119
+ * Hosted on Gemcutter, at least for now, at http://gemcutter.org/gems/nbudin-version_fu
120
+
121
+ * acts_as_versioned by Rick Olson http://github.com/technoweenie/acts_as_versioned/tree/master
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+ require 'rubygems'
5
+
6
+ desc 'Default: run unit tests.'
7
+ task :default=>:test
8
+
9
+ desc 'Test the version_fu plugin.'
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.libs << 'lib'
12
+ t.libs << 'test'
13
+ t.libs << 'test/models'
14
+ t.pattern = 'test/**/*_test.rb'
15
+ t.verbose = true
16
+ end
17
+
18
+ begin
19
+ require 'jeweler'
20
+ Jeweler::Tasks.new do |gemspec|
21
+ gemspec.name = "nbudin-version_fu"
22
+ gemspec.summary = "Gemified version of the version_fu plugin, tracking changes from revo and jmckible."
23
+ gemspec.description = "version_fu is a ActveRecord versioning gem that takes advantage of the new dirty attribute checking available in Rails 2.1. Previous solutions like Rick Olson's acts_as_versioned are no long compatible with Rails."
24
+ gemspec.email = ""
25
+ gemspec.homepage = "http://github.com/nbudin/version_fu"
26
+ gemspec.authors = ["Jordan McKible"]
27
+ end
28
+ rescue LoadError
29
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
30
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
data/lib/version_fu.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'version_fu/version_fu'
2
+ ActiveRecord::Base.class_eval { include VersionFu }
@@ -0,0 +1,109 @@
1
+ module VersionFu
2
+ def self.included(base)
3
+ base.extend ClassMethods
4
+ end
5
+
6
+ module ClassMethods
7
+ def version_fu(options={}, &block)
8
+ return if self.included_modules.include? VersionFu::InstanceMethods
9
+ __send__ :include, VersionFu::InstanceMethods
10
+
11
+ cattr_accessor :versioned_class_name, :versioned_foreign_key, :versioned_table_name,
12
+ :version_column, :versioned_columns
13
+
14
+ self.versioned_class_name = options[:class_name] || 'Version'
15
+ self.versioned_foreign_key = options[:foreign_key] || self.to_s.foreign_key
16
+ self.versioned_table_name = options[:table_name] || "#{table_name_prefix}#{base_class.name.demodulize.underscore}_versions#{table_name_suffix}"
17
+ self.version_column = options[:version_column] || 'version'
18
+
19
+ # Setup versions association
20
+ class_eval do
21
+ has_many :versions, :class_name => "#{self.to_s}::#{versioned_class_name}",
22
+ :foreign_key => versioned_foreign_key,
23
+ :dependent => :destroy do
24
+ def latest
25
+ find :first, :order=>'version desc'
26
+ end
27
+ end
28
+
29
+ before_save :check_for_new_version
30
+ end
31
+
32
+ # Versioned Model
33
+ const_set(versioned_class_name, Class.new(ActiveRecord::Base)).class_eval do
34
+ # find first version before the given version
35
+ def self.before(version)
36
+ find :first, :order => 'version desc',
37
+ :conditions => ["#{original_class.versioned_foreign_key} = ? and version < ?", version.send(original_class.versioned_foreign_key), version.version]
38
+ end
39
+
40
+ # find first version after the given version.
41
+ def self.after(version)
42
+ find :first, :order => 'version',
43
+ :conditions => ["#{original_class.versioned_foreign_key} = ? and version > ?", version.send(original_class.versioned_foreign_key), version.version]
44
+ end
45
+
46
+ def previous
47
+ self.class.before(self)
48
+ end
49
+
50
+ def next
51
+ self.class.after(self)
52
+ end
53
+ end
54
+
55
+ # Housekeeping on versioned class
56
+ versioned_class.cattr_accessor :original_class
57
+ versioned_class.original_class = self
58
+ versioned_class.set_table_name versioned_table_name
59
+
60
+ # Version parent association
61
+ versioned_class.belongs_to self.to_s.demodulize.underscore.to_sym,
62
+ :class_name => "::#{self.to_s}",
63
+ :foreign_key => versioned_foreign_key
64
+
65
+ # Block extension
66
+ versioned_class.class_eval &block if block_given?
67
+
68
+ if self.versioned_class.table_exists?
69
+ # Finally setup which columns to version
70
+ self.versioned_columns = versioned_class.new.attributes.keys -
71
+ [versioned_class.primary_key, versioned_foreign_key, version_column, 'created_at', 'updated_at']
72
+ else
73
+ ActiveRecord::Base.logger.warn "Version Table not found"
74
+ end
75
+ end
76
+
77
+ def versioned_class
78
+ const_get versioned_class_name
79
+ end
80
+ end
81
+
82
+
83
+ module InstanceMethods
84
+ def find_version(number)
85
+ versions.find :first, :conditions=>{:version=>number}
86
+ end
87
+
88
+ def check_for_new_version
89
+ instatiate_revision if create_new_version?
90
+ true # Never halt save
91
+ end
92
+
93
+ # This the method to override if you want to have more control over when to version
94
+ def create_new_version?
95
+ # Any versioned column changed?
96
+ self.class.versioned_columns.detect {|a| __send__ "#{a}_changed?"}
97
+ end
98
+
99
+ def instatiate_revision
100
+ new_version = versions.build
101
+ versioned_columns.each do |attribute|
102
+ new_version.__send__ "#{attribute}=", __send__(attribute)
103
+ end
104
+ version_number = new_record? ? 1 : version + 1
105
+ new_version.version = version_number
106
+ self.version = version_number
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,71 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{nbudin-version_fu}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jordan McKible"]
12
+ s.date = %q{2010-02-05}
13
+ s.description = %q{version_fu is a ActveRecord versioning gem that takes advantage of the new dirty attribute checking available in Rails 2.1. Previous solutions like Rick Olson's acts_as_versioned are no long compatible with Rails.}
14
+ s.email = %q{}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ ".idea/encodings.xml",
21
+ ".idea/inspectionProfiles/Project_Default.xml",
22
+ ".idea/inspectionProfiles/profiles_settings.xml",
23
+ ".idea/misc.xml",
24
+ ".idea/modules.xml",
25
+ ".idea/projectCodeStyle.xml",
26
+ ".idea/vcs.xml",
27
+ ".idea/version_fu.iml",
28
+ ".idea/workspace.xml",
29
+ "MIT-LICENSE",
30
+ "README.rdoc",
31
+ "Rakefile",
32
+ "VERSION",
33
+ "lib/version_fu.rb",
34
+ "lib/version_fu/version_fu.rb",
35
+ "nbudin-version_fu.gemspec",
36
+ "rails/init.rb",
37
+ "test/db/database.yml",
38
+ "test/db/schema.rb",
39
+ "test/fixtures/author_versions.yml",
40
+ "test/fixtures/authors.yml",
41
+ "test/fixtures/page_versions.yml",
42
+ "test/fixtures/pages.yml",
43
+ "test/models/author.rb",
44
+ "test/models/page.rb",
45
+ "test/test_helper.rb",
46
+ "test/version_fu_test.rb",
47
+ "version_fu.gemspec"
48
+ ]
49
+ s.homepage = %q{}
50
+ s.rdoc_options = ["--charset=UTF-8"]
51
+ s.require_paths = ["lib"]
52
+ s.rubygems_version = %q{1.3.5}
53
+ s.summary = %q{Gemified version of the version_fu plugin, tracking changes from revo and jmckible.}
54
+ s.test_files = [
55
+ "test/db/schema.rb",
56
+ "test/version_fu_test.rb",
57
+ "test/models/author.rb",
58
+ "test/models/page.rb",
59
+ "test/test_helper.rb"
60
+ ]
61
+
62
+ if s.respond_to? :specification_version then
63
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
64
+ s.specification_version = 3
65
+
66
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
67
+ else
68
+ end
69
+ else
70
+ end
71
+ end
data/rails/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'version_fu'
2
+ ActiveRecord::Base.class_eval { include VersionFu }
@@ -0,0 +1,18 @@
1
+ sqlite:
2
+ :adapter: sqlite
3
+ :dbfile: version_fu_plugin.sqlite.db
4
+ sqlite3:
5
+ :adapter: sqlite3
6
+ :dbfile: version_fu_plugin.sqlite3.db
7
+ postgresql:
8
+ :adapter: postgresql
9
+ :username: postgres
10
+ :password: postgres
11
+ :database: version_fu_plugin_test
12
+ :min_messages: ERROR
13
+ mysql:
14
+ :adapter: mysql
15
+ :host: localhost
16
+ :username: root
17
+ :password:
18
+ :database: version_fu_plugin_test
data/test/db/schema.rb ADDED
@@ -0,0 +1,37 @@
1
+ ActiveRecord::Schema.define(:version=>0) do
2
+
3
+ create_table :authors, :force=>true do |t|
4
+ t.column :version, :integer
5
+ t.column :first_name, :string, :limit=>255
6
+ t.column :last_name, :string, :limit=>255
7
+ end
8
+
9
+ create_table :author_versions, :force=>true do |t|
10
+ t.column :author_id, :integer
11
+ t.column :version, :integer
12
+ t.column :first_name, :string, :limit=>255
13
+ t.column :last_name, :string, :limit=>255
14
+ end
15
+
16
+ create_table :pages, :force=>true do |t|
17
+ t.column :type, :string
18
+ t.column :version, :integer
19
+ t.column :title, :string, :limit=>255
20
+ t.column :body, :text
21
+ t.column :created_at, :datetime
22
+ t.column :updated_at, :datetime
23
+ t.column :creator_id, :integer
24
+ t.column :author_id, :integer
25
+ end
26
+
27
+ create_table :page_versions, :force=>true do |t|
28
+ t.column :page_id, :integer
29
+ t.column :version, :integer
30
+ t.column :title, :string, :limit=>255
31
+ t.column :body, :text
32
+ t.column :created_at, :datetime
33
+ t.column :updated_at, :datetime
34
+ t.column :author_id, :integer
35
+ end
36
+
37
+ end
@@ -0,0 +1,27 @@
1
+ larry_1:
2
+ id: 1
3
+ version: 1
4
+ author_id: 1
5
+ first_name: Larry
6
+ last_name: Appleton
7
+
8
+ sara_1:
9
+ id: 2
10
+ version: 1
11
+ author_id: 2
12
+ first_name: Sara
13
+ last_name: Maiden
14
+
15
+ sara_2:
16
+ id: 4
17
+ version: 2
18
+ author_id: 2
19
+ first_name: Sara
20
+ last_name: Smiles
21
+
22
+ peter_1:
23
+ id: 3
24
+ version: 1
25
+ author_id: 3
26
+ first_name: Peter
27
+ last_name: Parker
@@ -0,0 +1,17 @@
1
+ larry:
2
+ id: 1
3
+ version: 1
4
+ first_name: Larry
5
+ last_name: Appleton
6
+
7
+ sara:
8
+ id: 2
9
+ version: 2
10
+ first_name: Sara
11
+ last_name: Smiles
12
+
13
+ peter:
14
+ id: 3
15
+ version: 1
16
+ first_name: Peter
17
+ last_name: Parker
@@ -0,0 +1,19 @@
1
+ welcome_1:
2
+ id: 1
3
+ page_id: 1
4
+ version: 1
5
+ title: Welcome
6
+ body: Initial body
7
+ created_at: <%= 1.hour.ago.to_s :db %>
8
+ updated_at: <%= 1.hour.ago.to_s :db %>
9
+ author_id: 1
10
+
11
+ welcome_2:
12
+ id: 2
13
+ page_id: 1
14
+ version: 2
15
+ title: Version 2
16
+ body: two
17
+ created_at: <%= 30.minutes.ago.to_s :db %>
18
+ updated_at: <%= 30.minutes.ago.to_s :db %>
19
+ author_id: 2
@@ -0,0 +1,10 @@
1
+ welcome:
2
+ id: 1
3
+ type: Page
4
+ version: 2
5
+ title: Version 2
6
+ body: two
7
+ created_at: <%= 1.hour.ago.to_s :db %>
8
+ updated_at: <%= 1.hour.ago.to_s :db %>
9
+ creator_id: 1
10
+ author_id: 2
@@ -0,0 +1,16 @@
1
+ class Author < ActiveRecord::Base
2
+
3
+ version_fu
4
+ def create_new_version?
5
+ first_name_change && last_name_changed?
6
+ end
7
+
8
+ def name
9
+ "#{first_name} #{last_name}"
10
+ end
11
+
12
+ def hello_world(n=1)
13
+ "Hello World #{n}"
14
+ end
15
+
16
+ end
@@ -0,0 +1,8 @@
1
+ class Page < ActiveRecord::Base
2
+ version_fu do
3
+ belongs_to :author, :class_name=>'::Author'
4
+ end
5
+
6
+ belongs_to :author
7
+ belongs_to :creator, :class_name=>'Author'
8
+ end
@@ -0,0 +1,26 @@
1
+ require 'test/unit'
2
+ require 'rubygems'
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb'))
4
+
5
+ require 'active_record'
6
+ require 'active_record/fixtures'
7
+
8
+ config = YAML::load(IO.read(File.dirname(__FILE__) + '/db/database.yml'))
9
+ ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
10
+ ActiveRecord::Base.configurations = {'test' => config[ENV['DB'] || 'sqlite3']}
11
+ ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
12
+
13
+ load(File.dirname(__FILE__) + '/db/schema.rb')
14
+
15
+ class ActiveSupport::TestCase
16
+ include ActiveRecord::TestFixtures
17
+
18
+ self.fixture_path = File.dirname(__FILE__) + '/fixtures/'
19
+
20
+ self.use_transactional_fixtures = true
21
+ self.use_instantiated_fixtures = false
22
+
23
+ fixtures :all
24
+ set_fixture_class :page_versions => Page::Version
25
+ set_fixture_class :author_versions => Author::Version
26
+ end
@@ -0,0 +1,134 @@
1
+ require 'test_helper'
2
+
3
+ class VersionFuTest < ActiveSupport::TestCase
4
+ #############################################################################
5
+ # A S S O C I A T I O N S #
6
+ #############################################################################
7
+ test 'parent has many versions' do
8
+ assert_equal page_versions(:welcome_1, :welcome_2), pages(:welcome).versions
9
+ end
10
+
11
+ test 'version belongs to parent' do
12
+ assert_equal pages(:welcome), page_versions(:welcome_1).page
13
+ end
14
+
15
+ #############################################################################
16
+ # A T T R I B U T E S #
17
+ #############################################################################
18
+ test 'version proper columns' do
19
+ assert_equal ['title', 'body', 'author_id'], Page.new.versioned_columns
20
+ end
21
+
22
+ test 'do not version non-existing columns' do
23
+ assert !Page.new.versioned_columns.include?(:creator_id)
24
+ end
25
+
26
+ #############################################################################
27
+ # C R E A T E #
28
+ #############################################################################
29
+ test 'save version on create' do
30
+ old_count = Page.count
31
+ old_version_count = Page::Version.count
32
+ page = Page.create :title=>'New', :body=>'body', :creator=>authors(:larry), :author=>authors(:larry)
33
+ assert_equal old_count + 1, Page.count
34
+ assert_equal old_version_count + 1, Page::Version.count
35
+ end
36
+
37
+ test 'wire up associations on create' do
38
+ page = Page.create :title=>'New', :body=>'body', :creator=>authors(:larry), :author=>authors(:larry)
39
+ assert_equal Page::Version.find(:first, :order=>'id desc'), page.versions.first
40
+ end
41
+
42
+ test 'begin version numbering at 1' do
43
+ page = Page.create :title=>'New', :body=>'body', :creator=>authors(:larry), :author=>authors(:larry)
44
+ assert_equal 1, page.version
45
+ assert_equal 1, page.versions.first.version
46
+ end
47
+
48
+ test 'assign attributes on create' do
49
+ page = Page.create :title=>'New', :body=>'body', :creator=>authors(:larry), :author=>authors(:larry)
50
+ version = page.versions.first
51
+ assert_equal 'New', version.title
52
+ assert_equal 'body', version.body
53
+ assert_equal authors(:larry).id, version.author_id
54
+ end
55
+
56
+ #############################################################################
57
+ # U P D A T E #
58
+ #############################################################################
59
+ test 'save version on update' do
60
+ old_count = Page::Version.count
61
+ page = pages(:welcome)
62
+ page.update_attributes :title=>'New title', :body=>'new body', :author=>authors(:sara)
63
+ assert_equal old_count + 1, Page::Version.count
64
+ end
65
+
66
+ test 'increment verson number' do
67
+ page = pages(:welcome)
68
+ old_count = page.version
69
+ page.update_attributes :title=>'New title', :body=>'new body', :author=>authors(:sara)
70
+ assert_equal old_count + 1, page.reload.version
71
+ end
72
+
73
+ test 'update version attributes' do
74
+ page = pages(:welcome)
75
+ page.update_attributes :title=>'Latest', :body=>'newest', :author=>authors(:peter)
76
+ version = page.reload.versions.latest
77
+ assert_equal 'Latest', version.title
78
+ assert_equal 'newest', version.body
79
+ assert_equal authors(:peter).id, version.author_id
80
+ end
81
+
82
+ #############################################################################
83
+ # S K I P V E R S I O N I N G #
84
+ #############################################################################
85
+ test 'do not create version if nothing changed' do
86
+ old_count = Page::Version.count
87
+ pages(:welcome).save
88
+ assert_equal old_count, Page::Version.count
89
+ end
90
+
91
+ test 'do not create version if untracked attribute changed' do
92
+ old_count = Page::Version.count
93
+ pages(:welcome).update_attributes :author=>authors(:sara)
94
+ assert_equal old_count, Page::Version.count
95
+ end
96
+
97
+ test 'do not create version if custom version check' do
98
+ old_count = Author::Version.count
99
+ authors(:larry).update_attributes :last_name=>'Lessig'
100
+ assert_equal old_count, Author::Version.count
101
+ end
102
+
103
+ test 'still save if no new version with custom version check' do
104
+ authors(:larry).update_attributes :last_name=>'Lessig'
105
+ assert_equal 'Lessig', authors(:larry).reload.last_name
106
+ end
107
+
108
+ #############################################################################
109
+ # F I N D #
110
+ #############################################################################
111
+ test 'find version given number' do
112
+ assert_equal page_versions(:welcome_1), pages(:welcome).find_version(1)
113
+ assert_equal page_versions(:welcome_2), pages(:welcome).find_version(2)
114
+ end
115
+
116
+ test 'find latest version' do
117
+ assert_equal page_versions(:welcome_2), pages(:welcome).versions.latest
118
+ end
119
+
120
+ test 'find previous version' do
121
+ assert_equal page_versions(:welcome_1), page_versions(:welcome_2).previous
122
+ end
123
+
124
+ test 'find next version' do
125
+ assert_equal page_versions(:welcome_2), page_versions(:welcome_1).next
126
+ end
127
+
128
+ #############################################################################
129
+ # B L O C K E X T E N S I O N #
130
+ #############################################################################
131
+ test 'take a block containing ActiveRecord extension' do
132
+ assert_equal authors(:larry), page_versions(:welcome_1).author
133
+ end
134
+ end
@@ -0,0 +1,57 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = %q{version_fu}
6
+ s.version = "1.0.0"
7
+
8
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
+ s.authors = ["Jordan McKible"]
10
+ s.date = %q{2009-08-13}
11
+ s.description = %q{version_fu is a ActveRecord versioning gem that takes advantage of the new dirty attribute checking available in Rails 2.1. Previous solutions like Rick Olson's acts_as_versioned are no long compatible with Rails.}
12
+ s.email = %q{}
13
+ s.extra_rdoc_files = [
14
+ "README.rdoc"
15
+ ]
16
+ s.files = [
17
+ "MIT-LICENSE",
18
+ "README.rdoc",
19
+ "RUNNING_UNIT_TESTS",
20
+ "Rakefile",
21
+ "VERSION",
22
+ "lib/version_fu.rb",
23
+ "lib/version_fu/version_fu.rb",
24
+ "test/database.yml",
25
+ "test/fixtures/author.rb",
26
+ "test/fixtures/author_versions.yml",
27
+ "test/fixtures/authors.yml",
28
+ "test/fixtures/page.rb",
29
+ "test/fixtures/page_versions.yml",
30
+ "test/fixtures/pages.yml",
31
+ "test/schema.rb",
32
+ "test/test_helper.rb",
33
+ "test/version_fu_test.rb"
34
+ ]
35
+ s.homepage = %q{}
36
+ s.rdoc_options = ["--charset=UTF-8"]
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = %q{1.3.3}
39
+ s.summary = %q{Gemified version of the version_fu plugin.}
40
+ s.test_files = [
41
+ "test/test_helper.rb",
42
+ "test/version_fu_test.rb",
43
+ "test/schema.rb",
44
+ "test/fixtures/author.rb",
45
+ "test/fixtures/page.rb"
46
+ ]
47
+
48
+ if s.respond_to? :specification_version then
49
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
50
+ s.specification_version = 3
51
+
52
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
53
+ else
54
+ end
55
+ else
56
+ end
57
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nbudin-version_fu
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jordan McKible
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-05 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: version_fu is a ActveRecord versioning gem that takes advantage of the new dirty attribute checking available in Rails 2.1. Previous solutions like Rick Olson's acts_as_versioned are no long compatible with Rails.
17
+ email: ""
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ files:
25
+ - .gitignore
26
+ - .idea/encodings.xml
27
+ - .idea/inspectionProfiles/Project_Default.xml
28
+ - .idea/inspectionProfiles/profiles_settings.xml
29
+ - .idea/misc.xml
30
+ - .idea/modules.xml
31
+ - .idea/projectCodeStyle.xml
32
+ - .idea/vcs.xml
33
+ - .idea/version_fu.iml
34
+ - .idea/workspace.xml
35
+ - MIT-LICENSE
36
+ - README.rdoc
37
+ - Rakefile
38
+ - VERSION
39
+ - lib/version_fu.rb
40
+ - lib/version_fu/version_fu.rb
41
+ - nbudin-version_fu.gemspec
42
+ - rails/init.rb
43
+ - test/db/database.yml
44
+ - test/db/schema.rb
45
+ - test/fixtures/author_versions.yml
46
+ - test/fixtures/authors.yml
47
+ - test/fixtures/page_versions.yml
48
+ - test/fixtures/pages.yml
49
+ - test/models/author.rb
50
+ - test/models/page.rb
51
+ - test/test_helper.rb
52
+ - test/version_fu_test.rb
53
+ - version_fu.gemspec
54
+ has_rdoc: true
55
+ homepage: ""
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options:
60
+ - --charset=UTF-8
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ version:
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ requirements: []
76
+
77
+ rubyforge_project:
78
+ rubygems_version: 1.3.5
79
+ signing_key:
80
+ specification_version: 3
81
+ summary: Gemified version of the version_fu plugin, tracking changes from revo and jmckible.
82
+ test_files:
83
+ - test/db/schema.rb
84
+ - test/version_fu_test.rb
85
+ - test/models/author.rb
86
+ - test/models/page.rb
87
+ - test/test_helper.rb