compressor 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -10
  3. data/lib/compressor.rb +9 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe6408879a8b5700850aa9cab175d3f3af75a669
4
- data.tar.gz: 1fe8fea3ba49445a9f2ce468aee76f2b7e9103fc
3
+ metadata.gz: 56886396eac0a46fc4a7548f55fdc76800308b33
4
+ data.tar.gz: bddd23186feed0228e3c334e0c210de10e0c1b26
5
5
  SHA512:
6
- metadata.gz: a8d91ccfadd2b7d8f973d039eefe74adf96f5c104ed78b8dc7229f526bea2dbdf10ec6790e581dbf0384d40761210eba0bd2f852b6e641761c16dfee7f483f0a
7
- data.tar.gz: 40018f8339521dacc20eeda4a780762b5fe00adb2dcf60eaded634245ce903dc51e8c2edd938fff2a2ccf98146425c48e7586adc074a127538e5f9acaf37a55d
6
+ metadata.gz: 4c3a278dc176b6ae6aa3442ae2ddd1db2ae15ee8c9fceaa8109f60b89672103c12b74b7973c85a31f4531d336c30852044ce487707c678209895da7780a37a73
7
+ data.tar.gz: 22ec027621afe42c3e3b5da334d092cacb50b37b8f62eeceafeb9c444b27b9968ceecbcefa62d722789c58f9679699af0bc5ec8157889803df6bab2a37de6224
data/README.md CHANGED
@@ -1,24 +1,52 @@
1
- # compressor
1
+ # Compressor
2
2
 
3
- TODO: Write a gem description
3
+ Compressor is a RubyMotion gem that speeds up your RubyMotion compile times by concatenating your source files. It typically speeds up your fresh builds by 70-95%.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
7
+ ```ruby
8
+ gem "compressor"
9
+ ```
8
10
 
9
- gem 'compressor'
11
+ ## Usage
10
12
 
11
- And then execute:
13
+ In your Rakefile, add the following to the bottom of your setup block:
12
14
 
13
- $ bundle
15
+ ```ruby
16
+ # ...
14
17
 
15
- Or install it yourself as:
18
+ Motion::Project::App.setup do |app|
19
+ # ...
16
20
 
17
- $ gem install compressor
21
+ app.concat_files
22
+ end
23
+ ```
18
24
 
19
- ## Usage
25
+ ### Options
26
+
27
+ Exclude files by passing in regex or strings:
28
+
29
+ ```ruby
30
+ app.concat_files exclude: [ /app/, "/app/" ]
31
+ ```
32
+
33
+ Choose the number of files to break into, for parallel builds (default is 4):
34
+
35
+ ```ruby
36
+ app.concat_files parallel: 3
37
+ ```
38
+
39
+ A typical setup is:
40
+
41
+ ```ruby
42
+ app.development do
43
+ app.concat_files exclude: [ "/app/" ], parallel: 3
44
+ end
20
45
 
21
- TODO: Write usage instructions here
46
+ app.release do
47
+ app.concat_files
48
+ end
49
+ ```
22
50
 
23
51
  ## Contributing
24
52
 
data/lib/compressor.rb CHANGED
@@ -16,6 +16,8 @@ module Motion::Project
16
16
  def extract_concatenated_files(excluded=[])
17
17
  @files.flatten!
18
18
  @concatenated_files = @files.select { |f| excluded.none? { |excluded_match| !!f.match(excluded_match) } }
19
+ old_dependencies = @dependencies
20
+ @dependencies = Dependency.new(@files - @exclude_from_detect_dependencies, @dependencies).run
19
21
  @files = @files - @concatenated_files
20
22
  @concatenated_files = order_concatenated_files(@concatenated_files)
21
23
  end
@@ -26,12 +28,16 @@ module Motion::Project
26
28
 
27
29
  def concatenate_files!(concat_files, parallel=4)
28
30
  group_number = 1
31
+ concatenated = []
29
32
  concat_files.in_groups(parallel, false) do |group|
30
33
  concat_path = File.join(File.expand_path(@project_dir), "build", "app-concatenated-#{group_number}.rb")
31
34
  File.delete(concat_path) if File.exist?(concat_path)
35
+ Dir.mkdir(File.dirname(concat_path)) unless File.exist?(File.dirname(concat_path))
32
36
  Motion::Project::App.info "Concat", concat_path
33
37
 
34
38
  File.open(concat_path, 'a') do |concat|
39
+ concat << "# File generated by 'Compressor' by Jamon Holmgren\n\n"
40
+ concat << "# "
35
41
  group.each do |filename|
36
42
  concat << "# #{"=" * filename.length}\n"
37
43
  concat << "# #{filename}\n"
@@ -40,10 +46,11 @@ module Motion::Project
40
46
  concat << "\n"
41
47
  end
42
48
  end
43
- @files << concat_path
49
+ concatenated << concat_path
44
50
  group_number += 1
45
51
  end
46
-
52
+ @files.unshift(concatenated)
53
+ @files.flatten!
47
54
  end
48
55
  end
49
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compressor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamon Holmgren