fit_js 0.94.10 → 0.94.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/Rakefile +5 -3
  4. data/{app/assets → assets}/.DS_Store +0 -0
  5. data/assets/javascripts/.DS_Store +0 -0
  6. data/{app/assets/javascripts → assets/javascripts/fitjs}/accumulator.js +0 -0
  7. data/{app/assets/javascripts → assets/javascripts/fitjs}/bit-stream.js +0 -0
  8. data/{app/assets/javascripts → assets/javascripts/fitjs}/crc-calculator.js +0 -0
  9. data/{app/assets/javascripts → assets/javascripts/fitjs}/decoder.js +0 -0
  10. data/{app/assets/javascripts → assets/javascripts/fitjs}/fit.js +0 -0
  11. data/{app/assets/javascripts → assets/javascripts/fitjs}/index.js +0 -0
  12. data/{app/assets/javascripts → assets/javascripts/fitjs}/profile.js +0 -0
  13. data/{app/assets/javascripts → assets/javascripts/fitjs}/stream.js +0 -0
  14. data/{app/assets/javascripts → assets/javascripts/fitjs}/utils-hr-mesg.js +0 -0
  15. data/{app/assets/javascripts → assets/javascripts/fitjs}/utils-internal.js +0 -0
  16. data/{app/assets/javascripts → assets/javascripts/fitjs}/utils.js +0 -0
  17. data/{app/assets → assets}/javascripts/fitjs.js +0 -0
  18. data/bower.json +24 -0
  19. data/fit_js.gemspec +13 -14
  20. data/{app → lib}/.DS_Store +0 -0
  21. data/lib/fitjs/.DS_Store +0 -0
  22. data/lib/fitjs/engine.rb +11 -0
  23. data/lib/fitjs/version.rb +4 -0
  24. data/lib/fitjs.rb +42 -7
  25. data/tasks/.DS_Store +0 -0
  26. data/tasks/bower.rake +25 -0
  27. data/tasks/converter/js_conversion.rb +34 -0
  28. data/tasks/converter.rb +48 -0
  29. data/templates/project/manifest.rb +14 -0
  30. metadata +79 -28
  31. data/lib/fitjs/rails/version.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08226e4f4afbae74c55f61e823fe1952fd3c5333f4cc26dbaa79dd050e666f8d'
4
- data.tar.gz: 50a9cd789404a10ed47af53352f3ed741b5248fcee513c7cf56579b80dc39162
3
+ metadata.gz: a97c9ff814b0c0f64bca577b7eef8c3c4d13c34fa516d860602c54c383e3e5e0
4
+ data.tar.gz: 9606356baa0d7e63c27954120873b7e947d138d0be1b93b5e60c6bae88796a51
5
5
  SHA512:
6
- metadata.gz: 136f4bd542f214b95b7afe737f1a1c9b945e3aabfdcc21ead1de5fea010548175cac317092d34aa717e1fbdde48e7906a253339950d1740ef2669f11370c993a
7
- data.tar.gz: 67def842cd7144302ed26e9a4d54a9de0a660a6cf363a7082c1674daa88d14bc9aa42fd4ea223a9b9fbceec0703e27923ae0fb29deddfd60ef9323321736d8bf
6
+ metadata.gz: b99c8f5b822215c133fa1cd644969939193cd7b57c0bb4f2a538d9c4367545a410146336803301f4dcc272f7c1a3ab1c171a7b23d9caacc6fcade4fb3ea68311
7
+ data.tar.gz: a8e29c61e525628bcdd652af577e550565f6f5079aef5c423827c94e587b84bfaf353dd264876a32c6d6ffc2f45c3b6306b68c2798347c2f8cf4aaf1cfb615e0
data/.DS_Store CHANGED
Binary file
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
- # frozen_string_literal: true
1
+ require 'bundler/gem_tasks'
2
2
 
3
- require "bundler/gem_tasks"
4
- task default: %i[]
3
+ lib_path = File.join(__dir__, 'lib')
4
+ $:.unshift(lib_path) unless $:.include?(lib_path)
5
+
6
+ load './tasks/bower.rake'
Binary file
Binary file
File without changes
data/bower.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "fitjs",
3
+ "homepage": "https://github.com/justindunn/fit_js",
4
+ "authors": [
5
+ "Justin Dunn"
6
+ ],
7
+ "description": "Fitjs rails fit file js library.",
8
+ "moduleType": "globals",
9
+ "main": [
10
+ "assets/javascripts/bootstrap.js"
11
+ ],
12
+ "keywords": [
13
+ "fitjs"
14
+ ],
15
+ "license": "MIT",
16
+ "ignore": [
17
+ "**/.*",
18
+ "lib",
19
+ "tasks",
20
+ "*.gemspec",
21
+ "Rakefile",
22
+ "Gemfile"
23
+ ]
24
+ }
data/fit_js.gemspec CHANGED
@@ -1,26 +1,25 @@
1
- # coding: utf-8
2
1
  lib = File.expand_path('../lib', __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'fitjs/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "fit_js"
7
- s.version = "0.94.10"
7
+ s.version = Fitjs::VERSION
8
8
  s.summary = "Javascript Wrapper for FIT Files"
9
9
  s.description = "The javascript library for the Garmin FIT file format"
10
10
  s.authors = ["Justin Dunn"]
11
11
  s.email = "axeouse@gmail.com"
12
- s.files = ["lib", "app/assets/javascript"]
13
- s.homepage =
14
- "https://rubygems.org/gems/fit_js"
15
- s.license = "MIT"
16
- s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
17
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- end
19
- s.bindir = "exe"
20
- s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
- s.require_paths = ["lib"]
12
+ s.homepage = "https://github.com/justindunn/fit_js"
13
+ s.license = "MIT"
14
+
15
+
16
+ # Dummy Rails app dependencies
17
+ s.add_development_dependency 'actionpack', '>= 4.1.5'
18
+ s.add_development_dependency 'activesupport', '>= 4.1.5'
19
+ s.add_development_dependency 'json', '>= 1.8.1'
20
+ s.add_development_dependency 'slim-rails'
21
+ s.add_development_dependency 'uglifier'
22
22
 
23
- s.add_development_dependency "bundler", "~> 1.16"
24
- s.add_development_dependency "rake", "~> 10.0"
25
23
  s.add_runtime_dependency 'autoprefixer-rails', '~> 9.1', '>= 9.1.0'
24
+ s.files = `git ls-files`.split("\n")
26
25
  end
Binary file
Binary file
@@ -0,0 +1,11 @@
1
+ module Fitjs
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ initializer 'fitjs.assets.precompile' do |app|
5
+ %w(javascripts).each do |sub|
6
+ app.config.assets.paths << root.join('assets', sub).to_s
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ module Fitjs
2
+ VERSION = "0.94.12"
3
+ API_VERSION = "0.94.0"
4
+ end
data/lib/fitjs.rb CHANGED
@@ -1,14 +1,49 @@
1
1
  require "fitjs/rails/version"
2
2
 
3
3
  module Fitjs
4
- class Fitjs < Rails::Railtie
5
- end
6
-
7
- class Engine < ::Rails::Engine
8
- initializer 'fitjs.assets.precompile' do |app|
9
- %w(javascripts).each do |sub|
10
- app.config.assets.paths << root.join('assets', sub).to_s
4
+ class << self
5
+ # Inspired by Bootstrap
6
+ def load!
7
+ if rails?
8
+ register_rails_engine
9
+ elsif sprockets?
10
+ register_sprockets
11
11
  end
12
12
  end
13
+
14
+ # Paths
15
+ def gem_path
16
+ @gem_path ||= File.expand_path '..', File.dirname(__FILE__)
17
+ end
18
+
19
+ def javascripts_path
20
+ File.join assets_path, 'javascripts'
21
+ end
22
+
23
+ def assets_path
24
+ @assets_path ||= File.join gem_path, 'assets'
25
+ end
26
+
27
+ # Environment detection helpers
28
+ def sprockets?
29
+ defined?(::Sprockets)
30
+ end
31
+
32
+ def rails?
33
+ defined?(::Rails)
34
+ end
35
+
36
+ private
37
+
38
+ def register_rails_engine
39
+ require 'fitjs/engine'
40
+ end
41
+
42
+ def register_sprockets
43
+ Sprockets.append_path(javascripts_path)
44
+ end
13
45
  end
46
+ end
47
+
48
+ Fitjs.load!
14
49
  end
data/tasks/.DS_Store ADDED
Binary file
data/tasks/bower.rake ADDED
@@ -0,0 +1,25 @@
1
+ require 'find'
2
+ require 'json'
3
+ require 'pathname'
4
+
5
+ namespace :bower do
6
+
7
+ find_files = ->(path) {
8
+ Find.find(Pathname.new(path).relative_path_from(Pathname.new Dir.pwd).to_s).map do |path|
9
+ path if File.file?(path)
10
+ end.compact
11
+ }
12
+
13
+ desc 'update main and version in bower.json'
14
+ task :generate do
15
+ Dir.chdir Fitjs.gem_path do
16
+ spec = JSON.parse(File.read 'bower.json')
17
+ spec['main'] = %w(assets/javascripts/fitjs.js)
18
+ spec['version'] = Fitjs::VERSION
19
+
20
+ File.open('bower.json', 'w') do |f|
21
+ f.puts JSON.pretty_generate(spec)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,34 @@
1
+ class Converter
2
+ module JsConversion
3
+ def process_javascript_assets
4
+ log_status 'Processing javascripts...'
5
+ save_to = @save_to[:js]
6
+ contents = {}
7
+ read_files('js', js_files).each do |name, file|
8
+ contents[name] = file
9
+ save_file("#{save_to}/#{name}", file)
10
+ end
11
+ log_processed "#{js_files * ' '}"
12
+
13
+ log_status 'Updating javascript manifest'
14
+ manifest = ''
15
+ js_files.each do |name|
16
+ name = name.gsub(/\.js$/, '')
17
+ manifest << "//= require ./fitjs/#{name}\n"
18
+ end
19
+ dist_js = read_files('/', %w(fitjs.js))
20
+ {
21
+ 'assets/javascripts/fit-compiled.js' => manifest,
22
+ 'assets/javascripts/fitjs.js' => dist_js['fitjs.js']
23
+ }.each do |path, content|
24
+ save_file path, content
25
+ end
26
+ end
27
+
28
+ def js_files
29
+ @js_files ||= begin
30
+ files = get_paths_by_type('js', /\.js$/).reject { |path| path =~ %r(^tests/) }
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,48 @@
1
+ # coding: utf-8
2
+ # Based on convert script from vwall/compass-twitter-bootstrap gem.
3
+ # https://github.com/vwall/compass-twitter-bootstrap/blob/master/build/convert.rb
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this work except in compliance with the License.
7
+ # You may obtain a copy of the License in the LICENSE file, or at:
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'open-uri'
18
+ require 'json'
19
+ require 'fileutils'
20
+
21
+ require_relative 'converter/js_conversion'
22
+
23
+ class Converter
24
+ include JsConversion
25
+
26
+ def initialize(save_to: {}, cache_path: 'tmp/converter-cache-fitjs')
27
+ @cache_path = cache_path
28
+ @save_to = {
29
+ js: 'assets/javascripts/fitjs'}.merge(save_to)
30
+ end
31
+
32
+ def process_bootstrap
33
+ puts " save to: #{@save_to.to_json}"
34
+ puts " twbs cache: #{@cache_path}"
35
+ puts '-' * 60
36
+
37
+ @save_to.each { |_, v| FileUtils.mkdir_p(v) }
38
+
39
+ process_javascript_assets
40
+ end
41
+
42
+ def save_file(path, content, mode='w')
43
+ dir = File.dirname(path)
44
+ FileUtils.mkdir_p(dir) unless File.directory?(dir)
45
+ File.open(path, mode) { |file| file.write(content) }
46
+ end
47
+
48
+ end
@@ -0,0 +1,14 @@
1
+ description 'FIT FILE JS LIBRARY'
2
+
3
+ manifest = Pathname.new(File.dirname(__FILE__))
4
+ assets = File.expand_path('../../assets', manifest)
5
+ {
6
+ :javascript => 'javascripts'
7
+ }.each do |method, dir|
8
+ root = Pathname.new(assets).join(dir)
9
+ Dir.glob root.join('**', '*.*') do |path|
10
+ path = Pathname.new(path)
11
+ send method, path.relative_path_from(manifest).to_s, :to => path.relative_path_from(root).to_s
12
+ end
13
+ end
14
+
metadata CHANGED
@@ -1,43 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fit_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.94.10
4
+ version: 0.94.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Dunn
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2023-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: actionpack
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: 4.1.5
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: 4.1.5
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 4.1.5
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 4.1.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.8.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.8.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: slim-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: uglifier
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
39
81
  - !ruby/object:Gem::Version
40
- version: '10.0'
82
+ version: '0'
41
83
  - !ruby/object:Gem::Dependency
42
84
  name: autoprefixer-rails
43
85
  requirement: !ruby/object:Gem::Requirement
@@ -72,27 +114,36 @@ files:
72
114
  - LICENSE.txt
73
115
  - README.md
74
116
  - Rakefile
75
- - app/.DS_Store
76
- - app/assets/.DS_Store
77
- - app/assets/javascripts/accumulator.js
78
- - app/assets/javascripts/bit-stream.js
79
- - app/assets/javascripts/crc-calculator.js
80
- - app/assets/javascripts/decoder.js
81
- - app/assets/javascripts/fit.js
82
- - app/assets/javascripts/fitjs.js
83
- - app/assets/javascripts/index.js
84
- - app/assets/javascripts/profile.js
85
- - app/assets/javascripts/stream.js
86
- - app/assets/javascripts/utils-hr-mesg.js
87
- - app/assets/javascripts/utils-internal.js
88
- - app/assets/javascripts/utils.js
117
+ - assets/.DS_Store
118
+ - assets/javascripts/.DS_Store
119
+ - assets/javascripts/fitjs.js
120
+ - assets/javascripts/fitjs/accumulator.js
121
+ - assets/javascripts/fitjs/bit-stream.js
122
+ - assets/javascripts/fitjs/crc-calculator.js
123
+ - assets/javascripts/fitjs/decoder.js
124
+ - assets/javascripts/fitjs/fit.js
125
+ - assets/javascripts/fitjs/index.js
126
+ - assets/javascripts/fitjs/profile.js
127
+ - assets/javascripts/fitjs/stream.js
128
+ - assets/javascripts/fitjs/utils-hr-mesg.js
129
+ - assets/javascripts/fitjs/utils-internal.js
130
+ - assets/javascripts/fitjs/utils.js
89
131
  - bin/console
90
132
  - bin/setup
133
+ - bower.json
91
134
  - fit_js.gemspec
135
+ - lib/.DS_Store
92
136
  - lib/fitjs.rb
93
- - lib/fitjs/rails/version.rb
137
+ - lib/fitjs/.DS_Store
138
+ - lib/fitjs/engine.rb
139
+ - lib/fitjs/version.rb
94
140
  - sig/fitjs.rbs
95
- homepage: https://rubygems.org/gems/fit_js
141
+ - tasks/.DS_Store
142
+ - tasks/bower.rake
143
+ - tasks/converter.rb
144
+ - tasks/converter/js_conversion.rb
145
+ - templates/project/manifest.rb
146
+ homepage: https://github.com/justindunn/fit_js
96
147
  licenses:
97
148
  - MIT
98
149
  metadata: {}
@@ -1,5 +0,0 @@
1
- module Fitjs
2
- module Rails
3
- VERSION = "0.94.10"
4
- end
5
- end