marfa 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47f3270a50621c8708d3977e3773b2ac5aa03516
4
- data.tar.gz: 6a7512f056c10e4c2aabe283425dbf0756b72eeb
3
+ metadata.gz: a423c48b5405907fa9a6e7e782f8695dad2c3c36
4
+ data.tar.gz: 9a4ab9f1754e2bdab22f437a5928ef00f94b8fa3
5
5
  SHA512:
6
- metadata.gz: 8ec251c505738406677f431605eeb06a341d533fc7a2cec9567ee990f6c3948840392cbedd2c866ad237a90f8e35bab26519444da514b4571f2b9a64b27b35e8
7
- data.tar.gz: 0219d83d38ebe1ce727dc73d42d5c1dcae9ddaf55685bad8f6af89e74a84dc4d2c8c071393a2224040e569b79acb836189e5aa0a039b1786f47e489b7ae09d01
6
+ metadata.gz: 138fe6e3b19da6060c509eaebd92b7c7a13c6a0f39ca8a435958e9cc9faa5c6c714c9be89c28d4815e45b7ccbf0dc1939a5d97691a7f42f9d0ddc0e1c82352ff
7
+ data.tar.gz: 400b292c45fdfa2bf8218147282bc1a15dee62f1c9ea1456c229dd9f8e2e5dfcb4c0d8ae7e8ab6961d4be14dff45b10a472356c4996fb386fa878671cbd8411c
data/bin/marfa-build-js CHANGED
@@ -8,21 +8,31 @@ include FileUtils
8
8
 
9
9
  options = {
10
10
  home_path: FileUtils.pwd,
11
- search_dir: '',
12
- output_dir: '/static/js'
11
+ search_dir: '/app',
12
+ output_dir: '/static/js',
13
+ hierarchy: false,
14
+ minify: false
13
15
  }
14
16
 
15
17
  parser = OptionParser.new do |opts|
16
18
  opts.banner = 'Usage: marfa-build-js [options]'
17
19
 
18
- opts.on('-s', '--search_dir search_dir', 'Search dir') do |search_dir|
20
+ opts.on('-s', '--search-dir SEARCH_DIR', 'Search dir') do |search_dir|
19
21
  options[:search_dir] = search_dir
20
22
  end
21
23
 
22
- opts.on('-o', '--output_dir output_dir', 'Output dir') do |output_dir|
24
+ opts.on('-o', '--output-dir OUTPUT_DIR', 'Output dir') do |output_dir|
23
25
  options[:output_dir] = output_dir
24
26
  end
25
27
 
28
+ opts.on('-u', '--use_hierarchy', 'Use current dir hierarchy') do
29
+ options[:hierarchy] = true
30
+ end
31
+
32
+ opts.on('-m', '--minify', 'Minify js') do
33
+ options[:minify] = true
34
+ end
35
+
26
36
  opts.on('-h', '--help', 'Displays help') do
27
37
  puts opts
28
38
  exit
@@ -46,12 +56,14 @@ Dir[search_dir + '/**/*.js'].each do |path|
46
56
  )
47
57
 
48
58
  result = Babel::Transpiler.transform(File.read(path))
49
- code = closure.compile(result['code'])
59
+ code = (options[:minify]) ? closure.compile(result['code']) : result['code']
60
+ file_name = path.split('/').last
50
61
  output_path = options[:home_path] + options[:output_dir]
62
+ output_path += path.sub(search_dir, '').sub(file_name, '') if options[:hierarchy]
51
63
 
52
64
  mkdir_p(output_path) unless Dir.exist?(output_path)
53
65
 
54
- File.open(output_path + '/' + path.split('/').last, 'w') do |f|
66
+ File.open(output_path + '/' + file_name, 'w') do |f|
55
67
  f.puts code
56
68
  end
57
69
  end
data/lib/marfa/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # Version constant
2
2
  module Marfa
3
3
  # The version constant for the current version of Marfa
4
- VERSION = '0.1.4' unless defined?(Marfa::VERSION)
4
+ VERSION = '0.1.5' unless defined?(Marfa::VERSION)
5
5
 
6
6
  # The current Marfa version.
7
7
  # @return [String] The version number
data/marfa.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'marfa'
6
- s.version = '0.1.4'
6
+ s.version = '0.1.5'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.date = Time.now.strftime('%Y-%m-%d')
9
9
  s.summary = 'Little Sinatra-based framework'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marfa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Krechetov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-02-06 00:00:00.000000000 Z
13
+ date: 2017-02-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: haml