flowcation 0.2.17 → 0.2.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2be4a3a57e22a260a9b7891444b9a1d678b1b2e6
4
- data.tar.gz: de9f979f1f05df03a25280d072154321418ec32c
3
+ metadata.gz: c2e51ea8371dda9e9681420be1bf5952e652dca8
4
+ data.tar.gz: fa3c4f855cfd2c95a2cc2f526539ad8f9ec4bc8e
5
5
  SHA512:
6
- metadata.gz: 2799db76de616dff25748ad6c2694f3f026e3c09e0ec3cdca87459207753876a21c3e508efb11910ff714c00aedf2f6bf172dfa3fe4161436a782f0ec33fb629
7
- data.tar.gz: a9ba3d5853b870a926f22b059e6aaaa8d6716bea0a0c2a96dc1a2203a7b24d46ff387620b6274654da77bd695b54275bbd77928a9839a115d224133937a79b15
6
+ metadata.gz: 8d69ea6443345fadfd78c7cb30fd52ddffdeaad28642e2bb8cfb419899e16767a9cb4e7124384c857f1532cdb5e436bb2fad2ccf141e828b1f5a29698377731f
7
+ data.tar.gz: fb4a591712a21717ea434d007562044c4abb90433646cf9d89d95d92c2be173d179d3233c24adf51e298145946bcab8ad88af2060718a77ebd668651bed4d218
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flowcation (0.2.17)
4
+ flowcation (0.2.18)
5
5
  activesupport (~> 5.1.5)
6
6
  nokogiri (~> 1.8.2)
7
7
 
data/exe/flowcation CHANGED
@@ -1,45 +1,46 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'flowcation'
3
- require 'optparse'
4
-
5
- options = {}
6
- option_parser = OptionParser.new do |opts|
7
- opts.on("-c config","--config config", "Relative Path to Yaml Configuration File") do |config|
8
- options[:config] = File.join(Dir.pwd, config)
9
- end
10
- opts.on("-f","--force-overwrite", "Overwrite any file flowcation attempts to generate.") do
11
- options[:force_overwrite] = true
12
- end
3
+
4
+ config_file_name = "flowcation"
5
+
6
+ if arg = ARGV[0]
7
+ config_file_name = arg
8
+ end
9
+
10
+ config_file_name += ".yml"
11
+
12
+ look_up_config_paths = %w(
13
+ .
14
+ flowcation
15
+ config
16
+ config/flowcation
17
+ ).map {|p| File.join(Dir.pwd, p) }
18
+
19
+
20
+
21
+ config_path = ""
22
+ look_up_config_paths.each do |path|
23
+ next unless File.directory?(path)
24
+ entries = Dir.entries(path)
25
+ file = File.join(path, config_file_name)
26
+ config_path = file if entries.include?(config_file_name)
27
+ end
28
+
29
+ unless File.exists?(config_path)
30
+ puts "Config File Not Found"
31
+ puts "Lookup:"
32
+ puts look_up_config_paths
33
+ return 1
13
34
  end
14
- option_parser.parse!
15
-
16
- cmd = :generate
17
-
18
- case ARGV[0]
19
- when "generate"
20
- cmd = :generate
21
- when "bootstrap"
22
- cmd = :bootstrap
23
- else
24
- cmd = :generate
25
- end
26
-
27
- puts "#{cmd} #{options[:config]}"
28
-
29
- if cmd == :generate
30
- config = begin
31
- YAML.load File.new(options[:config]).read
32
- rescue Exception => e
33
- puts "Invalid Configuration."
34
- return 1
35
- end
36
- if config
37
- if overwrite = options[:force_overwrite]
38
- Flowcation::Settings.set('force-overwrite', true)
39
- end
40
-
41
- Flowcation::generate config
42
- Flowcation::Runtime.instance.write_files
43
- end
35
+
36
+ config = begin
37
+ YAML.load File.new(config_path).read
38
+ rescue Exception => e
39
+ puts "Invalid Configuration File: #{e}"
40
+ return 1
44
41
  end
45
42
 
43
+ if config
44
+ Flowcation::generate config
45
+ Flowcation::Runtime.instance.write_files
46
+ end
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+ require 'flowcation'
3
+ require 'optparse'
4
+
5
+ options = {}
6
+ option_parser = OptionParser.new do |opts|
7
+ opts.on("-c config","--config config", "Relative Path to Yaml Configuration File") do |config|
8
+ options[:config] = File.join(Dir.pwd, config)
9
+ end
10
+ opts.on("-f","--force-overwrite", "Overwrite any file flowcation attempts to generate.") do
11
+ options[:force_overwrite] = true
12
+ end
13
+ end
14
+ option_parser.parse!
15
+
16
+ cmd = :generate
17
+
18
+ case ARGV[0]
19
+ when "generate"
20
+ cmd = :generate
21
+ when "bootstrap"
22
+ cmd = :bootstrap
23
+ else
24
+ cmd = :generate
25
+ end
26
+
27
+ puts "#{cmd} #{options[:config]}"
28
+
29
+ if cmd == :generate
30
+ config = begin
31
+ YAML.load File.new(options[:config]).read
32
+ rescue Exception => e
33
+ puts "Invalid Configuration."
34
+ return 1
35
+ end
36
+ if config
37
+ if overwrite = options[:force_overwrite]
38
+ Flowcation::Settings.set('force-overwrite', true)
39
+ end
40
+
41
+ Flowcation::generate config
42
+ Flowcation::Runtime.instance.write_files
43
+ end
44
+ end
45
+
data/lib/flowcation.rb CHANGED
@@ -28,6 +28,7 @@ module Flowcation
28
28
  def self.generate(config)
29
29
  Flowcation::Settings.from_config(config['flowcation'])
30
30
  Flowcation::Assets.from_config(config['assets'])
31
+ Flowcation::Assets.from_config(config['files'])
31
32
 
32
33
  Flowcation::Runtime.register_layouts_from_config(config['layouts'])
33
34
  Flowcation::Runtime.register_templates_from_config(config['templates'])
@@ -2,7 +2,7 @@ module Flowcation
2
2
  class Assets
3
3
 
4
4
  def self.from_config(config={})
5
- config.each do |name, options|
5
+ config&.each do |name, options|
6
6
  options['folders'].each do |path, asset_folder_name|
7
7
  asset_folder_path = File.join(options['output'], asset_folder_name)
8
8
  FileUtils.mkdir_p(asset_folder_path)
@@ -11,6 +11,12 @@ module Flowcation
11
11
  source: File.join(options['input'], path),
12
12
  target: asset_folder
13
13
  end
14
+ options['files'].each do |file_name|
15
+ output_folder_path = File.join(options['output'])
16
+ FileUtils.mkdir_p(output_folder_path)
17
+ output_folder = File.new(output_folder_path)
18
+ FileUtils.cp(File.join(options['input'], file_name), output_folder)
19
+ end
14
20
  end
15
21
  end
16
22
 
@@ -13,7 +13,7 @@ module Flowcation
13
13
  end
14
14
 
15
15
  def self.from_config(options={})
16
- options.each do |k,v|
16
+ options&.each do |k,v|
17
17
  instance.register_setting k,v
18
18
  end
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module Flowcation
2
- VERSION = "0.2.17"
2
+ VERSION = "0.2.18"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flowcation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.17
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Hennemeyer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-10 00:00:00.000000000 Z
11
+ date: 2018-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -99,6 +99,7 @@ files:
99
99
  - bin/console
100
100
  - bin/setup
101
101
  - exe/flowcation
102
+ - exe/flowcation_with_options
102
103
  - flowcation.gemspec
103
104
  - lib/flowcation.rb
104
105
  - lib/flowcation/assets.rb