motion-gradle 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab7bf0fb48a2a11c7185f459e73eb4c29a8cd5ed
4
- data.tar.gz: ec1558bda34ca51e8685eff54ff71162b26c2975
3
+ metadata.gz: 39b4a42fbe8c34267f2f47de45c2757d9dbb1951
4
+ data.tar.gz: 033579f979e473691b7473e5111608ed9486c31c
5
5
  SHA512:
6
- metadata.gz: 86af7c01d52090e405c6a59b6e1ce264f9900981c6eb3407c22d39bacf7826b7d15fa0bfa653ec729f5bd83288140e7faa069507ecdfb493fa89821b769b33cc
7
- data.tar.gz: 31a5aefb68bfd69046c44daeae47fda97a780d857bdd03ded26f63436f531a948783360681a2d346299d57558ec73aad76894be1a50150eb52deeb3d6553c115
6
+ metadata.gz: ae45d3fdf2ca007820c94270b2925caa9452f40aefb372d776e9ce06547d5250a76c5b689b925189b3d8f4c6ce8b80611bc2a3ad819cd12691d5fe48e223ee4b
7
+ data.tar.gz: bc48780d63289ab320aee9d106dbe1f87fd2045a759759d4de0f00f3df33a5e5792eca8780a39b7e8ade5bcfe9ded8e5f80a255d5d43209485b76795a5a368a2
data/README.md CHANGED
@@ -76,6 +76,15 @@ Motion::Project::App.setup do |app|
76
76
  end
77
77
  ```
78
78
 
79
+ ## Support for local libraries
80
+
81
+ app.gradle do
82
+ library 'mylib', path: '/Users/joffreyjaffeux/Projects/mylib'
83
+ end
84
+
85
+ If you don’t specify the path option, the library will be searched in the vendor folder.
86
+
87
+
79
88
  ## Tasks
80
89
 
81
90
  To tell motion-gradle to download your dependencies, run the following rake
@@ -9,12 +9,12 @@ task generateDependencies(type: Copy) {
9
9
  repositories {
10
10
  <% if android_repository %>
11
11
  maven {
12
- url "<%= ENV['RUBYMOTION_ANDROID_SDK'] %>/extras/android/m2repository/"
12
+ url "<%= ENV['RUBYMOTION_ANDROID_SDK'].shellescape %>/extras/android/m2repository/"
13
13
  }
14
14
  <% end %>
15
15
  <% if google_repository %>
16
16
  maven {
17
- url "<%= ENV['RUBYMOTION_ANDROID_SDK'] %>/extras/google/m2repository/"
17
+ url "<%= ENV['RUBYMOTION_ANDROID_SDK'].shellescape %>/extras/google/m2repository/"
18
18
  }
19
19
  <% end %>
20
20
  <% @repositories.each do |url| %>
@@ -24,8 +24,11 @@ repositories {
24
24
  <% end %>
25
25
  mavenCentral()
26
26
  }
27
-
27
+
28
28
  dependencies {
29
+ <% @libraries.each do |library| %>
30
+ compile project(':<%= library[:name] %>')
31
+ <% end %>
29
32
  <% @dependencies.each do |dependency| %>
30
33
  <% if dependency.is_a?(String) %>
31
34
  compile '<%= dependency %>'
@@ -22,12 +22,14 @@ module Motion::Project
22
22
  class Gradle
23
23
  GRADLE_ROOT = 'vendor/Gradle'
24
24
  attr_reader :dependencies
25
+ attr_reader :libraries
25
26
 
26
27
  def initialize(config)
27
28
  @gradle_path = '/usr/bin/env gradle'
28
29
  @config = config
29
30
  @dependencies = []
30
31
  @repositories = []
32
+ @libraries = []
31
33
  configure_project
32
34
  end
33
35
 
@@ -49,11 +51,16 @@ module Motion::Project
49
51
  end
50
52
  end
51
53
 
54
+ def library(library_name, options = {})
55
+ @libraries << {name: library_name, path: options.fetch(:path, "../../vendor/#{library_name}")}
56
+ end
57
+
52
58
  def repository(url)
53
59
  @repositories << url
54
60
  end
55
61
 
56
62
  def install!(update)
63
+ generate_gradle_settings_file
57
64
  generate_gradle_build_file
58
65
  system("#{gradle_command} --build-file #{gradle_build_file} generateDependencies")
59
66
 
@@ -128,6 +135,14 @@ module Motion::Project
128
135
  end
129
136
  end
130
137
 
138
+ def generate_gradle_settings_file
139
+ template_path = File.expand_path("../settings.erb", __FILE__)
140
+ template = ERB.new(File.new(template_path).read, nil, "%")
141
+ File.open(gradle_build_file, 'w') do |io|
142
+ io.puts(template.result(binding))
143
+ end
144
+ end
145
+
131
146
  def generate_gradle_build_file
132
147
  template_path = File.expand_path("../gradle.erb", __FILE__)
133
148
  template = ERB.new(File.new(template_path).read, nil, "%")
@@ -0,0 +1,4 @@
1
+ <% @libraries.each do |library| %>
2
+ include '<%= library[:name] %>'
3
+ project(':<%= library[:name] %>').projectDir = new File('<%= library[:path].shellescape %>')
4
+ <% end %>
@@ -1,5 +1,5 @@
1
1
  module Motion::Project
2
2
  class Gradle
3
- VERSION = '1.1.1'
3
+ VERSION = '1.2.1'
4
4
  end
5
5
  end
data/lib/motion-gradle.rb CHANGED
@@ -1,2 +1,3 @@
1
+ require 'shellwords'
1
2
  require 'motion/project/gradle'
2
3
  require 'motion/project/version'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-gradle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joffrey Jaffeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-18 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: motion-gradle allows RubyMotion Android projects to have access to the
14
14
  Gradle dependency manager.
@@ -22,6 +22,7 @@ files:
22
22
  - lib/motion-gradle.rb
23
23
  - lib/motion/project/gradle.erb
24
24
  - lib/motion/project/gradle.rb
25
+ - lib/motion/project/settings.erb
25
26
  - lib/motion/project/version.rb
26
27
  homepage: http://www.rubymotion.com
27
28
  licenses: