rehearsal 1.3.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/generators/rehearsal/install/install_generator.rb +30 -0
- data/lib/generators/rehearsal/{initializer → install}/templates/initializer.rb +0 -0
- data/lib/generators/rehearsal/install/templates/rehearsal.yml +3 -0
- data/lib/rehearsal.rb +0 -2
- data/lib/rehearsal/configuration.rb +23 -1
- data/lib/rehearsal/version.rb +1 -1
- metadata +5 -4
- data/lib/generators/rehearsal/initializer/initializer_generator.rb +0 -9
@@ -0,0 +1,30 @@
|
|
1
|
+
module Rehearsal
|
2
|
+
class InstallGenerator < ::Rails::Generators::Base
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
argument :type, :as => :string, :default => 'global'
|
5
|
+
|
6
|
+
def remove_other_config
|
7
|
+
case type
|
8
|
+
when 'global'
|
9
|
+
remove_file ".rehearsal"
|
10
|
+
when 'user'
|
11
|
+
remove_file "config/initializers/rehearsal.rb"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def copy_initializer_file
|
16
|
+
case type
|
17
|
+
when 'global'
|
18
|
+
copy_file "initializer.rb", "config/initializers/rehearsal.rb"
|
19
|
+
when 'user'
|
20
|
+
copy_file "rehearsal.yml", ".rehearsal"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_config_to_gitignore
|
25
|
+
if type == 'user'
|
26
|
+
append_file(".gitignore", ".rehearsal")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
File without changes
|
data/lib/rehearsal.rb
CHANGED
@@ -3,9 +3,31 @@ module Rehearsal
|
|
3
3
|
attr_accessor :auth_envs, :banner_envs, :enabled
|
4
4
|
|
5
5
|
def initialize
|
6
|
+
initialize_from_hidden_file!
|
7
|
+
|
6
8
|
@auth_envs ||= [:staging]
|
7
9
|
@banner_envs ||= [:staging]
|
8
|
-
@enabled =
|
10
|
+
@enabled = true if enabled.nil?
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
def initialize_from_hidden_file!
|
15
|
+
return unless File.exist?(hidden_file_path)
|
16
|
+
|
17
|
+
file = File.open(hidden_file_path)
|
18
|
+
config = YAML.load(file)
|
19
|
+
|
20
|
+
config.each do |attr, value|
|
21
|
+
if value.respond_to?(:split)
|
22
|
+
value = value.split(',').map(&:strip).map(&:to_sym)
|
23
|
+
end
|
24
|
+
|
25
|
+
self.send("#{attr}=", value)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def hidden_file_path
|
30
|
+
"#{Rails.root}/.rehearsal"
|
9
31
|
end
|
10
32
|
end
|
11
33
|
end
|
data/lib/rehearsal/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rehearsal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -40,8 +40,9 @@ executables: []
|
|
40
40
|
extensions: []
|
41
41
|
extra_rdoc_files: []
|
42
42
|
files:
|
43
|
-
- lib/generators/rehearsal/
|
44
|
-
- lib/generators/rehearsal/
|
43
|
+
- lib/generators/rehearsal/install/install_generator.rb
|
44
|
+
- lib/generators/rehearsal/install/templates/initializer.rb
|
45
|
+
- lib/generators/rehearsal/install/templates/rehearsal.yml
|
45
46
|
- lib/rehearsal.rb
|
46
47
|
- lib/rehearsal/configuration.rb
|
47
48
|
- lib/rehearsal/engine.rb
|