rateaux 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rateaux/file_task.rb +44 -0
- data/lib/rateaux/namespaced.rb +3 -3
- data/lib/rateaux/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d35a40979ebccab6d39c121caf02501c5a3d88e
|
4
|
+
data.tar.gz: f623f92d286d5f9891660f44f326c6538f3db62f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f5d1279645b765c2fbdae49b5816ac606d388c05eb130363d5af09549604b027c42f16eb73625cce658251b9d0c4e21f1134fe93c3e2c505d68316e8da81e90
|
7
|
+
data.tar.gz: b2a003b6e0b3d5375295cc33e04ddf6c636032079dafc5e0d62ac7d61ea606eba1de3d1777458aeebba102b7489aaf7caddbb4d4c18dfc00387a7f1b5d0c2b44
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# File Task
|
4
|
+
#
|
5
|
+
# Adds a task and a file task. The file depends on the task that it creates.
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# For example:
|
9
|
+
#
|
10
|
+
# require "rateaux/file_task"
|
11
|
+
# include Rateaux::FileTask
|
12
|
+
#
|
13
|
+
# file_task "foo.txt", create: :environment do
|
14
|
+
# touch "foo.txt"
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
# You can then:
|
18
|
+
#
|
19
|
+
# $ rake foo.txt # Will create the file only if it does not exist
|
20
|
+
# $ rake create # Will create the file all the time
|
21
|
+
#
|
22
|
+
# Your tasks can now depend on the file beeing present or create them :
|
23
|
+
#
|
24
|
+
# task send: "foo.txt"
|
25
|
+
#
|
26
|
+
# With file_task you don't have to add this block to the file task:
|
27
|
+
#
|
28
|
+
# file "foo.txt" do
|
29
|
+
# Rake::Task["create"]
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
module Rateaux
|
33
|
+
module FileTask
|
34
|
+
def file_task(path, definition)
|
35
|
+
t = task(definition) do
|
36
|
+
yield
|
37
|
+
end
|
38
|
+
|
39
|
+
file(path) do
|
40
|
+
Rake::Task[t.name].invoke
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/rateaux/namespaced.rb
CHANGED
@@ -32,18 +32,18 @@
|
|
32
32
|
# Both definitions add a task "export" that cals "export:a" and "export:b"
|
33
33
|
# without having to add:
|
34
34
|
#
|
35
|
-
# task export: [
|
35
|
+
# task export: ["export:a", "export:b"]
|
36
36
|
#
|
37
37
|
module Rateaux
|
38
38
|
module Namespaced
|
39
39
|
def namespaced(name, defaults = :default)
|
40
40
|
case defaults
|
41
41
|
when Symbol, String
|
42
|
-
task name =>
|
42
|
+
task name => "#{name}:#{defaults}"
|
43
43
|
when nil
|
44
44
|
task name
|
45
45
|
else
|
46
|
-
task name => defaults.to_a.map { |t|
|
46
|
+
task name => defaults.to_a.map { |t| "#{name}:#{t}" }
|
47
47
|
end
|
48
48
|
|
49
49
|
namespace name do
|
data/lib/rateaux/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rateaux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sunny Ripert
|
@@ -73,6 +73,7 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- lib/rateaux/file_task.rb
|
76
77
|
- lib/rateaux/namespaced.rb
|
77
78
|
- lib/rateaux/version.rb
|
78
79
|
- lib/rateaux.rb
|