power-rake 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/power-rake/common.rb +26 -0
- data/lib/power-rake/helpers/config_helper.rb +29 -0
- data/lib/power-rake/models/config.rb +14 -0
- data/lib/power-rake/version.rb +3 -0
- data/lib/power-rake.rb +12 -0
- data/lib/tasks/power-rake/release.rake +13 -0
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2a30c16e9faf72e5b7ae091147ec314e718a057
|
4
|
+
data.tar.gz: 2ba5ff1f8bfd9852abf43876a8fa11a264117990
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b3c856980b00c7965cceac89878de190c5d32a86582c9bd37631212beea0e4c1307aa14a65f92f9c167531fb49997b2b139cdd28e89f6bf7f1fd4303ef1dc65
|
7
|
+
data.tar.gz: 7ee0d9713a49572e30bca0864e5a30a3372563b6a962c67c720d1b2a942986f4f4f83ec0d49d997586e7975a7c67cf3b8e6004cc3957897eb7b0b4a9ce67b60b
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Prompt with control flow
|
4
|
+
# @param [String]
|
5
|
+
def continue?(message)
|
6
|
+
abort 'Aborted!' unless prompt("#{message} (y|n)").downcase == 'y'
|
7
|
+
end
|
8
|
+
|
9
|
+
# Inline message prompt
|
10
|
+
# @param [String]
|
11
|
+
def prompt(message)
|
12
|
+
print message
|
13
|
+
STDIN.gets.strip
|
14
|
+
end
|
15
|
+
|
16
|
+
# Try a system command
|
17
|
+
# @param [string]
|
18
|
+
def try(command)
|
19
|
+
system(command) || abort("Aborted! `#{command}`")
|
20
|
+
end
|
21
|
+
|
22
|
+
# Access the config
|
23
|
+
# @return [PowerRake::Config]
|
24
|
+
def config
|
25
|
+
PowerRake.config
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PowerRake
|
4
|
+
module ConfigHelper
|
5
|
+
def config
|
6
|
+
@config ||= Config.new(data)
|
7
|
+
end
|
8
|
+
|
9
|
+
def configure
|
10
|
+
yield(config)
|
11
|
+
end
|
12
|
+
|
13
|
+
def current_env
|
14
|
+
ENV['RAKE_ENV'] || :development
|
15
|
+
end
|
16
|
+
|
17
|
+
def config_file
|
18
|
+
ENV['RAKE_CONFIG'] || 'power-rake.yml'
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def data
|
24
|
+
return {} unless File.exists? config_file
|
25
|
+
|
26
|
+
Config.read(config_file, current_env)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'erb'
|
3
|
+
require 'ostruct'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
module PowerRake
|
7
|
+
class Config < OpenStruct
|
8
|
+
def self.read(path, env)
|
9
|
+
contents = IO.read(path)
|
10
|
+
processed = ERB.new(contents).result
|
11
|
+
YAML.load(processed)[env.to_s]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/power-rake.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'power-rake/version'
|
2
|
+
|
3
|
+
desc "Release version #{PowerRake::VERSION} of the gem"
|
4
|
+
task :release do
|
5
|
+
continue? "Release version #{PowerRake::VERSION} of the gem?"
|
6
|
+
|
7
|
+
try "git tag -a v#{PowerRake::VERSION} -m 'Tagging #{PowerRake::VERSION}'"
|
8
|
+
try 'git push --tags'
|
9
|
+
|
10
|
+
try 'gem build power-rake.gemspec'
|
11
|
+
try "gem push power-rake-#{PowerRake::VERSION}.gem"
|
12
|
+
try "rm power-rake-#{PowerRake::VERSION}.gem"
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: power-rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Tulino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -29,7 +29,13 @@ email: rtulino@gmail.com
|
|
29
29
|
executables: []
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
|
-
files:
|
32
|
+
files:
|
33
|
+
- lib/power-rake.rb
|
34
|
+
- lib/power-rake/common.rb
|
35
|
+
- lib/power-rake/helpers/config_helper.rb
|
36
|
+
- lib/power-rake/models/config.rb
|
37
|
+
- lib/power-rake/version.rb
|
38
|
+
- lib/tasks/power-rake/release.rake
|
33
39
|
homepage: http://rubygems.org/gems/power-rake
|
34
40
|
licenses:
|
35
41
|
- MIT
|