fas 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/fas +4 -0
- data/lib/fas.rb +58 -3
- metadata +46 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db6704d0b13ae564e48213adceed97658ffbf413
|
4
|
+
data.tar.gz: 4d32c676b05f94207567b6b8f1e78e998303b392
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5609d49e53d2fbe716ee20009b59ce08b53e6fce8e1831b3c5c739d7b4be7eab618e0cf587c57a47343e5c6e742145c332bba1f9fd4ec5676fca8d1dc3e585bb
|
7
|
+
data.tar.gz: cc5bfb5dab405eb27337e71822fddee19415856cd780cca31ba4d63a19310ec3c7ee9a31e2c40c4033dc2f1fe76c4500e3c2104aee69f7d88b47099c7c30b380
|
data/bin/fas
ADDED
data/lib/fas.rb
CHANGED
@@ -1,5 +1,60 @@
|
|
1
|
-
class
|
2
|
-
def self.
|
3
|
-
|
1
|
+
class Fas
|
2
|
+
def self.init(lane)
|
3
|
+
if lane.nil?
|
4
|
+
puts 'You need to define a lane'
|
5
|
+
else
|
6
|
+
# Load fas.json file
|
7
|
+
require 'json'
|
8
|
+
file = File.read('fas.json')
|
9
|
+
data_hash = JSON.parse(file)
|
10
|
+
|
11
|
+
# Require base libraries
|
12
|
+
require 'fileutils'
|
13
|
+
require 'zip'
|
14
|
+
|
15
|
+
# First of all, perform all base actions
|
16
|
+
data_hash['actions'].each do |action|
|
17
|
+
executeAction(action)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Now run lane specific actions
|
21
|
+
data_hash['lanes'].each do |currentLane|
|
22
|
+
if currentLane['name'] == lane
|
23
|
+
currentLane['actions'].each do |action|
|
24
|
+
executeAction(action)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# That is it!
|
30
|
+
puts 'Done!'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.executeAction(action)
|
35
|
+
actionType = action['type']
|
36
|
+
actionScript = action['action']
|
37
|
+
case actionType
|
38
|
+
when 'git'
|
39
|
+
system('git ' + actionScript)
|
40
|
+
when 'rm'
|
41
|
+
File.delete(*Dir.glob(actionScript))
|
42
|
+
when 'rmdir'
|
43
|
+
FileUtils.rm_rf(Dir.glob(actionScript))
|
44
|
+
when 'search'
|
45
|
+
puts Dir.glob(actionScript)
|
46
|
+
when 'unzip'
|
47
|
+
Zip::File.open(actionScript) do |zipfile|
|
48
|
+
zipfile.each do |entry|
|
49
|
+
# The 'next if...' code can go here, though I didn't use it
|
50
|
+
unless File.exist?(entry.name)
|
51
|
+
FileUtils::mkdir_p(File.dirname(entry.name))
|
52
|
+
zipfile.extract(entry, entry.name)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
else
|
57
|
+
return "puts 'Warning! Non supported type: " + actionType + "'"
|
58
|
+
end
|
4
59
|
end
|
5
60
|
end
|
metadata
CHANGED
@@ -1,21 +1,63 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felipe Plets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
12
|
-
dependencies:
|
11
|
+
date: 2016-12-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.0.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.0.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rubyzip
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.2'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.2.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.2'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.2.0
|
13
53
|
description: A simple hello world gem
|
14
54
|
email: felipe.plets@menvia.com
|
15
|
-
executables:
|
55
|
+
executables:
|
56
|
+
- fas
|
16
57
|
extensions: []
|
17
58
|
extra_rdoc_files: []
|
18
59
|
files:
|
60
|
+
- bin/fas
|
19
61
|
- lib/fas.rb
|
20
62
|
homepage: http://rubygems.org/gems/fas
|
21
63
|
licenses:
|