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.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/envyous/rake.rb +65 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWRjZDYzYTk5ZjUyNWUxZDI4OTliMjc0OTFjOTVlNGU5MTQ4OTk0ZA==
4
+ NmUxYTE0NDM4MWM3ODM4ZTY2YTk5ZDQyYTZkMmFmYmFmYmNiMTFmOA==
5
5
  data.tar.gz: !binary |-
6
- ZTg3MmQ1MDRhM2ZiMmQ0MzcxOTQ4OGYzZjM2N2Y2ZTdlNDcxZGRlMw==
6
+ NjZiNmZkMDFkZjdkYTlmZmRmYmE0OTc1Y2NjZmVkZWQwNDcxYjQ4Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTQyYzZkZjY5NDBiYmE0ZmIzNDVmMGY1NDY4OTdhMTNiYTA4OTQ5NjkyZDE3
10
- N2M1YmZlYzIxM2JlMjkyNzQ2YzIwMzc2MTA5MzZiMWRlZmJkYmRkY2JhYzQ4
11
- MGQ1MDc5M2YyYTEwYzNmYmQwNTNhMGFmNGUxYjk3ZmM3M2RhMWI=
9
+ MjY2MjkzMGVmOTdjMjU0MjlkZTVmYTVkNTY3YjViMmRkY2UwZDdlZWFmYTEx
10
+ YzA3ZmIzMmI5YzcwZmUzNTEyYTlkYmNkMWZiMzM0ZTVkMjBkODk5YTdmYzQ5
11
+ YWIyZTMwMzlmMTZlN2IzNDJjMmY4MmNiYzllNDFkOTkyNGM2ZTg=
12
12
  data.tar.gz: !binary |-
13
- ZjgyZjMwMGY5ZTdmMjVhNTdmM2VlYTFkNTc3YTc4NmQ3NjMwZjI5YzhiYmJh
14
- NTY1NDRlOTMxNDFiYTEzZDAyNGVkMTk1YzgxNGZjZjNhNmNlMjQyMTcwNTgy
15
- ODM1YTFlOWNjZGYwYjVkOGZhZGJmOTBlZTFhZTBiNWY3YTU4MTU=
13
+ ZWNmNGYyZGE5MDc3MjIxZGU3MTcxYWY2Y2Y1ZTM3ZmM2MTE1MWEwYmVkZWRm
14
+ MjI0MzRmZmU0ZGY5Y2FkYzlmMWI4NDQ4ZDQ3MTcxM2VkMWNkZjg1MmI4ODQ4
15
+ M2Q0NzNlMWJkNjY4NmMzODg1YmY3ZDcyOWQ1ZmRhOTAyZWQ1YTQ=
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: envyous
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha.1
4
+ version: 1.0.0.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Lauber