one_offs 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +16 -2
- data/lib/one_offs/tasks.rb +6 -0
- data/lib/one_offs/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9891a04acea75e2f0f97a836971cdeaf0f249f49
|
4
|
+
data.tar.gz: ecc913405ed9e4eb5068fe13b711da90ea368e2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d3bc4add1df3f7351ed5d2f100825dd6b4df11f2e485f3254e1307b095a74cb39bd8c20dde05f7025638371367350404bf9c63e3f05444b94717cc25c426b13
|
7
|
+
data.tar.gz: 43101a621c2cc1ead2c0a62de4dcab8b2af9c8e725b2bc9eeb00680110bcfd0f6e6813754577cd81c49ab2327897b9ff025588ef78d09e240b77fabfdeabe25c
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -26,12 +26,26 @@ After installing the gem, In your Rakefile (/Rakefile) add the following line
|
|
26
26
|
require 'one_offs/tasks'
|
27
27
|
|
28
28
|
|
29
|
-
And setup a tracker table.
|
30
|
-
|
29
|
+
And setup a tracker table (creates migration).
|
31
30
|
|
32
31
|
rake one_offs:generate_tracker_table
|
33
32
|
|
33
|
+
OR using SQL query if you want to avoid a migration (Useful if you need to setup one off tasks before db:migrate).
|
34
|
+
|
35
|
+
rake one_offs:create_tracker_table_using_sql
|
36
|
+
|
34
37
|
Add scripts to `lib/one_offs/`
|
38
|
+
* File name should be <code>\<number\>_class_name_inside_file.rb</code> (Rails convention for file name to class name with the order number before that)
|
39
|
+
|
40
|
+
Example:
|
41
|
+
|
42
|
+
File: 1_hello_world.rb
|
43
|
+
Contents:
|
44
|
+
class HelloWorld
|
45
|
+
def self.process
|
46
|
+
puts("You may write your code in this process method").
|
47
|
+
end
|
48
|
+
end
|
35
49
|
|
36
50
|
To run pending one_off scripts.
|
37
51
|
|
data/lib/one_offs/tasks.rb
CHANGED
@@ -10,4 +10,10 @@ namespace :one_offs do
|
|
10
10
|
task :generate_tracker_table do
|
11
11
|
`rails generate migration CreateOneOffTracker name:string`
|
12
12
|
end
|
13
|
+
|
14
|
+
desc 'Create one off tracker table using SQL instead of migration'
|
15
|
+
task :create_tracker_table_using_sql => :environment do
|
16
|
+
sql = 'CREATE TABLE IF NOT EXISTS "one_off_trackers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar);'
|
17
|
+
ActiveRecord::Base.connection.execute(sql)
|
18
|
+
end
|
13
19
|
end
|
data/lib/one_offs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: one_offs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jatin Naik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -67,9 +67,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
version: '0'
|
68
68
|
requirements: []
|
69
69
|
rubyforge_project: one_offs
|
70
|
-
rubygems_version: 2.
|
70
|
+
rubygems_version: 2.4.8
|
71
71
|
signing_key:
|
72
72
|
specification_version: 4
|
73
73
|
summary: Track and manage your one off scripts
|
74
74
|
test_files: []
|
75
|
-
has_rdoc:
|