envyous 1.0.0.alpha.1 → 1.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/envyous/rake.rb +65 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmUxYTE0NDM4MWM3ODM4ZTY2YTk5ZDQyYTZkMmFmYmFmYmNiMTFmOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjZiNmZkMDFkZjdkYTlmZmRmYmE0OTc1Y2NjZmVkZWQwNDcxYjQ4Yw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjY2MjkzMGVmOTdjMjU0MjlkZTVmYTVkNTY3YjViMmRkY2UwZDdlZWFmYTEx
|
10
|
+
YzA3ZmIzMmI5YzcwZmUzNTEyYTlkYmNkMWZiMzM0ZTVkMjBkODk5YTdmYzQ5
|
11
|
+
YWIyZTMwMzlmMTZlN2IzNDJjMmY4MmNiYzllNDFkOTkyNGM2ZTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWNmNGYyZGE5MDc3MjIxZGU3MTcxYWY2Y2Y1ZTM3ZmM2MTE1MWEwYmVkZWRm
|
14
|
+
MjI0MzRmZmU0ZGY5Y2FkYzlmMWI4NDQ4ZDQ3MTcxM2VkMWNkZjg1MmI4ODQ4
|
15
|
+
M2Q0NzNlMWJkNjY4NmMzODg1YmY3ZDcyOWQ1ZmRhOTAyZWQ1YTQ=
|
data/lib/envyous/rake.rb
CHANGED
@@ -1 +1,66 @@
|
|
1
|
+
require 'rake'
|
1
2
|
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module Envyous
|
6
|
+
module Rake
|
7
|
+
extend ::Rake::DSL
|
8
|
+
|
9
|
+
class AlreadyInitialized < Exception
|
10
|
+
end
|
11
|
+
|
12
|
+
class ConfigInitializer
|
13
|
+
attr_reader :src, :dest
|
14
|
+
|
15
|
+
def initialize(options = {})
|
16
|
+
@dest = options.fetch(:dest)
|
17
|
+
@src = options[:src]
|
18
|
+
|
19
|
+
unless @src
|
20
|
+
@src = "#{dest}.template"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def init(force = false)
|
25
|
+
if File.exists?(dest)
|
26
|
+
if force
|
27
|
+
FileUtils.rm_rf dest
|
28
|
+
else
|
29
|
+
raise AlreadyInitialized
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
FileUtils.cp_r src, dest
|
34
|
+
end
|
35
|
+
|
36
|
+
def soft_init
|
37
|
+
unless File.exists? dest
|
38
|
+
FileUtils.cp_r src, dest
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
def self.default!(options = {})
|
46
|
+
namespace :config do
|
47
|
+
create_tasks!(options)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.create_tasks!(options = {})
|
52
|
+
cfg_init = ConfigInitializer.new(options)
|
53
|
+
|
54
|
+
desc "Initializes envyous config"
|
55
|
+
task :init do
|
56
|
+
cfg_init.init(ENV['force'] == "true")
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Soft-initializes envyous config"
|
60
|
+
task :soft_init do
|
61
|
+
cfg_init.soft_init
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|