inertia 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
  SHA256:
3
- metadata.gz: 9f8b81973d732449c9ab5c237d0535d50188f9a008106497ac1e8a199692fa54
4
- data.tar.gz: 586aa0b5554c730735b1ff73e1b9ce2884702a2a521962ddd30aa686581016fc
3
+ metadata.gz: 9d11084d0cf69efbb978d231f9635222f52c2663789482da7e0e07fd461b76a8
4
+ data.tar.gz: 75a061ab877f8276266438de7f7eb1f5933534bd3d8827cdbb9956402c9a8fb9
5
5
  SHA512:
6
- metadata.gz: 19229279bcd3629b89045d3252ee0d3acd87efb3f5d05220bc4da0dd4fc0c41b01e1a2823a3f4dd6a1e7997bc07cfe74794a7baa5d5f53e952aa029384aaa6f9
7
- data.tar.gz: aa0ba64caaea83a03c8fed07a6afbb4ab590857fc97d1f6c972c695558df56ede4158b9bf487e9939b2c9425888338ebc94052a18ce28a30d9d9a892efb11b81
6
+ metadata.gz: 1b2cffe4232da693d00d16159ced964d952cc4ac3b1f13fbbef586ac460795b8756f954e4f35edbc9df1d93cf9897f4bdf28cae22fc442b0e68ebbcdd8ea0bcb
7
+ data.tar.gz: 9165326ee8434cabfde7107c155994615530470b0e714a3dc65b3c243b16182f996fc93fe1198e5ab63b28fbd211dbfdb186b3d0a909ef0df3b1b8da5ad48981
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- inertia (0.1.4)
4
+ inertia (0.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/History.md CHANGED
@@ -1,3 +1,10 @@
1
+
2
+ 0.1.5 / 2018-10-21
3
+ ==================
4
+
5
+ * Add ability to ignore files
6
+ * Add configration
7
+ * Show total lines in output
1
8
  0.1.4 / 2018-10-21
2
9
  ==================
3
10
 
data/exe/in CHANGED
@@ -2,4 +2,8 @@
2
2
 
3
3
  require 'inertia'
4
4
 
5
+ Inertia.configure do |config|
6
+ config.ignore_scss = ARGV.include?('--ignore-scss')
7
+ end
8
+
5
9
  Inertia::Resistance.display
data/lib/inertia/mass.rb CHANGED
@@ -11,8 +11,12 @@ module Inertia
11
11
  @text ||= `file -b --mime #{path}`.match?('text')
12
12
  end
13
13
 
14
+ def scss?
15
+ @scss ||= File.extname(path) == 'scss'
16
+ end
17
+
14
18
  def lines
15
- return 0 unless text?
19
+ return 0 if ignored?
16
20
 
17
21
  @lines ||= `wc -l "#{path}" | awk '{print $1}'`.chomp.to_i
18
22
  end
@@ -28,5 +32,10 @@ module Inertia
28
32
  def to_s
29
33
  sprintf("%6.2f%%\t%s", percent_overall_lines, path)
30
34
  end
35
+
36
+ def ignored?
37
+ !text? ||
38
+ scss? && Inertia.config.ignore_scss
39
+ end
31
40
  end
32
41
  end
@@ -3,6 +3,7 @@ module Inertia
3
3
  # resistance.
4
4
  class Resistance
5
5
  def self.display
6
+ puts "#{total_lines} lines\n\n"
6
7
  puts grouped_masses.sort.reverse
7
8
  end
8
9
 
@@ -1,3 +1,3 @@
1
1
  module Inertia
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
data/lib/inertia.rb CHANGED
@@ -5,5 +5,16 @@ require 'inertia/grouped_mass'
5
5
  require 'inertia/resistance'
6
6
 
7
7
  module Inertia
8
- # Your code goes here...
8
+ class << self
9
+ attr_accessor :config
10
+ end
11
+
12
+ def self.configure
13
+ self.config ||= Configuration.new
14
+ yield(config)
15
+ end
16
+
17
+ class Configuration
18
+ attr_accessor :ignore_scss
19
+ end
9
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inertia
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
  - Andrew Hood