compressor 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -10
- data/lib/compressor.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56886396eac0a46fc4a7548f55fdc76800308b33
|
4
|
+
data.tar.gz: bddd23186feed0228e3c334e0c210de10e0c1b26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c3a278dc176b6ae6aa3442ae2ddd1db2ae15ee8c9fceaa8109f60b89672103c12b74b7973c85a31f4531d336c30852044ce487707c678209895da7780a37a73
|
7
|
+
data.tar.gz: 22ec027621afe42c3e3b5da334d092cacb50b37b8f62eeceafeb9c444b27b9968ceecbcefa62d722789c58f9679699af0bc5ec8157889803df6bab2a37de6224
|
data/README.md
CHANGED
@@ -1,24 +1,52 @@
|
|
1
|
-
#
|
1
|
+
# Compressor
|
2
2
|
|
3
|
-
|
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
|
-
|
7
|
+
```ruby
|
8
|
+
gem "compressor"
|
9
|
+
```
|
8
10
|
|
9
|
-
|
11
|
+
## Usage
|
10
12
|
|
11
|
-
|
13
|
+
In your Rakefile, add the following to the bottom of your setup block:
|
12
14
|
|
13
|
-
|
15
|
+
```ruby
|
16
|
+
# ...
|
14
17
|
|
15
|
-
|
18
|
+
Motion::Project::App.setup do |app|
|
19
|
+
# ...
|
16
20
|
|
17
|
-
|
21
|
+
app.concat_files
|
22
|
+
end
|
23
|
+
```
|
18
24
|
|
19
|
-
|
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
|
-
|
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
|
-
|
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
|