Class: Envs::Runner
- Inherits:
-
Object
- Object
- Envs::Runner
- Defined in:
- lib/envs/runner.rb
Instance Method Summary collapse
-
#initialize(opts) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(opts) ⇒ Runner
Returns a new instance of Runner.
5 6 7 8 9 10 |
# File 'lib/envs/runner.rb', line 5 def initialize(opts) @root = opts[:root] Sickill::Rainbow.enabled = !opts[:no_color] @count = 0 @synced_dirs = [] end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/envs/runner.rb', line 12 def run puts "Envs! #{VERSION}" gitignore = File.join(@root, ".gitignore") if File.exist?(gitignore) warn "You should probably add .env to your gitignore file fool!".foreground(:red) unless File.read(gitignore).split(/\n/).include?('.env') end Dir[File.join(@root, "**/.env")].each do |dir| sync File.dirname(dir) end Dir[File.join(@root, "**/.env.default")].each do |dir| sync File.dirname(dir) end puts "Synced #{@count.to_s.foreground(:green)} values in #{@synced_dirs.size.to_s.foreground(:green)} dirs. Your welcome." end |