marfa 0.1 → 0.1.2

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: 5bfc443e4ccb0a869cccb07907d0749cc9d3df3e
4
- data.tar.gz: f745e7a1f995bf1e1856cf8b758178735075522f
3
+ metadata.gz: 665b97268b20f6f5ec311e76c976713d9d39aca4
4
+ data.tar.gz: 59c557ab53ff94ff31ca80ff35bf22c96846bdb6
5
5
  SHA512:
6
- metadata.gz: cbb28a82a8e8df3446183a02fca1839a3b88d48283d2392a3db3f2b3250c6685e3bb72add54f65d921509498760c2bde1f31a7cae4abaf39c72570a4a21424ec
7
- data.tar.gz: cac62f610452d339ee115373b2ba24bc2ac186c1535f87c3b0a6c0107cb1b5ec48b3f383e5348b53156a24604da7982a9a8d09b9b38840f988c0216f8c997a02
6
+ metadata.gz: 04f9a6f89afde128705cf3cdce767938c9e89e48ac30c78483eeb5b48cadca1a32d3d407dd2944cf1b49c204f61255f05a63411ead622ac95b4d80ce00249040
7
+ data.tar.gz: 59f0e36adaa646598ee9871d9260d58398b9bca1bc5bc5e22530a8673b54547ba737001ccd4f461d1981eb9fd76054a6251c7cc0b93c358df4651ee951ab041f
data/Rakefile CHANGED
@@ -2,7 +2,9 @@ require 'fileutils'
2
2
  require 'rake'
3
3
  require 'babel/transpiler'
4
4
  require 'closure-compiler'
5
-
5
+ # require 'sass/plugin'
6
+ # require 'sass/engine'
7
+ # require 'csso'
6
8
  include FileUtils
7
9
 
8
10
  # Default marfa configuration
@@ -119,6 +121,42 @@ def js_transpile(path, is_plain_text = true)
119
121
  result['code']
120
122
  end
121
123
 
124
+ # def device_names
125
+ # [
126
+ # 'desktop',
127
+ # 'smartphone',
128
+ # 'tablet',
129
+ # 'feature phone',
130
+ # 'console',
131
+ # 'tv',
132
+ # 'car browser',
133
+ # 'smart display',
134
+ # 'camera',
135
+ # 'portable media player',
136
+ # 'phablet'
137
+ # ]
138
+ # end
139
+
140
+ # Create styles
141
+ # @param [String] scss_path - path to scss file
142
+ # @param [String] device - device type
143
+ # def create_style(scss_path, device)
144
+ # dynamic_vars(device)
145
+ # template = File.read(scss_path)
146
+ # sass_engine = Sass::Engine.new(template, {syntax: :scss})
147
+ # output = sass_engine.render
148
+ # p output
149
+ # Csso.optimize(output)
150
+ # end
151
+ #
152
+ #
153
+ # def dynamic_vars(device, section = 'root')
154
+ # Sass::Plugin.options[:custom] ||= {}
155
+ # Sass::Plugin.options[:custom][:device] = device
156
+ # Sass::Plugin.options[:custom][:section] = section
157
+ # # Sass::Plugin.options[:custom][:contentPath] = Marfa.config.content_path
158
+ # end
159
+
122
160
  task :default do
123
161
  puts 'Please specify command'
124
162
  end
@@ -157,7 +195,12 @@ task :transpile_js, [:home_path, :search_dir, :output_dir] do |t, args|
157
195
 
158
196
  cd args[:home_path] + args[:search_dir], verbose: true
159
197
 
160
- Dir[args[:home_path] + args[:search_dir] + '/**/*.js'].each do |path|
198
+ search_dir = args[:search_dir] || ''
199
+ output_dir = args[:output_dir] || '/static/js'
200
+
201
+ cd args[:home_path] + search_dir, verbose: true
202
+
203
+ Dir[args[:home_path] + search_dir + '/**/*.js'].each do |path|
161
204
  puts "Processing #{path}"
162
205
 
163
206
  closure = Closure::Compiler.new(
@@ -167,8 +210,8 @@ task :transpile_js, [:home_path, :search_dir, :output_dir] do |t, args|
167
210
 
168
211
  code = js_transpile(path, false)
169
212
  code = closure.compile(code)
170
- output_path = args[:home_path] + args[:output_dir]
171
- mkdir_p(output_path)
213
+ output_path = args[:home_path] + output_dir
214
+ mkdir_p(output_path) unless Dir.exist?(output_path)
172
215
 
173
216
  File.open(output_path + '/' + path.split('/').last, 'w') do |f|
174
217
  f.puts code
@@ -176,3 +219,30 @@ task :transpile_js, [:home_path, :search_dir, :output_dir] do |t, args|
176
219
  end
177
220
 
178
221
  end
222
+
223
+ # task :compile_css, [:home_path, :search_dir, :output_dir] do |t, args|
224
+ # search_dir = args[:search_dir] || ''
225
+ # output_dir = args[:output_dir] || '/static/css'
226
+ #
227
+ # Dir[args[:home_path] + search_dir + '/**/*.scss'].each do |path|
228
+ # puts "Processing #{path}"
229
+ #
230
+ # output_path = args[:home_path] + output_dir
231
+ # mkdir_p(output_path) unless Dir.exist?(output_path)
232
+ #
233
+ # device_names.each do |device|
234
+ # full_path =
235
+ # output_path +
236
+ # '/' +
237
+ # path.split('/')
238
+ # .last
239
+ # .gsub('scss', '') +
240
+ # "#{device}.css"
241
+ #
242
+ # styles = create_style(path, device)
243
+ # File.write(full_path, styles)
244
+ # end
245
+ #
246
+ # end
247
+ #
248
+ # end
@@ -47,7 +47,7 @@ module Marfa
47
47
  # @example
48
48
  # render_block('index/index', ['tag1', 'tag2'])
49
49
  # @return [String] rendered block
50
- def render_component(path, tags = [])
50
+ def render_component(path, tags = [], query = {})
51
51
  # TODO: Improve caching with parameters
52
52
  content = get_cached_content('block', path, tags)
53
53
  return content unless content.nil?
@@ -57,7 +57,7 @@ module Marfa
57
57
 
58
58
  attrs = {
59
59
  user_data: @user_data || {},
60
- query: params.to_h
60
+ query: query
61
61
  }
62
62
 
63
63
  block = Object.const_get(classname).new
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' unless defined?(Marfa::VERSION)
4
+ VERSION = '0.1.2' 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'
6
+ s.version = '0.1.2'
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'
@@ -32,4 +32,5 @@ Gem::Specification.new do |s|
32
32
  s.add_dependency('csso-rails', '~> 0.5.0')
33
33
  s.add_dependency('yard')
34
34
  s.add_dependency('yard-sinatra')
35
+ s.add_dependency('compass')
35
36
  end
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
+ version: 0.1.2
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-01 00:00:00.000000000 Z
13
+ date: 2017-02-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: haml
@@ -236,6 +236,20 @@ dependencies:
236
236
  - - ">="
237
237
  - !ruby/object:Gem::Version
238
238
  version: '0'
239
+ - !ruby/object:Gem::Dependency
240
+ name: compass
241
+ requirement: !ruby/object:Gem::Requirement
242
+ requirements:
243
+ - - ">="
244
+ - !ruby/object:Gem::Version
245
+ version: '0'
246
+ type: :runtime
247
+ prerelease: false
248
+ version_requirements: !ruby/object:Gem::Requirement
249
+ requirements:
250
+ - - ">="
251
+ - !ruby/object:Gem::Version
252
+ version: '0'
239
253
  description: Little Sinatra-based framework
240
254
  email: mvkrechetov@gmail.com
241
255
  executables: