motion-environment-settings 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/.gitignore +2 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +18 -0
- data/README.md +1 -0
- data/Rakefile +13 -0
- data/app/app_delegate.rb +9 -0
- data/config/development.yml +2 -0
- data/config/environments/development.yml +2 -0
- data/lib/motion-environment-settings.rb +27 -0
- data/lib/motion-environment-settings/generator.rb +25 -0
- data/lib/motion-environment-settings/version.rb +5 -0
- data/lib/tasks/settings_hooks.rake +14 -0
- data/motion-environment-settings.gemspec +17 -0
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 048641baab9d9579abceef5b7ab6be3a339a7f29
|
4
|
+
data.tar.gz: fa2ab1a579c50fa676a2d4e3eac17d9f7dd0b353
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd8a141d4ec87fb0ed426ff32b42dfd13b1759451fcbea24e06cc9a4f385604ad8094a4b04e401e718dc743029fe34e18b96923e562988df76c548797d689c4d
|
7
|
+
data.tar.gz: 29d6b952f5b2df17e7be84282301b0d49101ec973a6734f41351ed79a28830b16a7910cf0dbe42faa3675e69edea099948674d412de3623094126825a1504ff0
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# motion-environment-settings
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
$:.unshift("/Library/RubyMotion/lib")
|
2
|
+
require "motion/project/template/ios"
|
3
|
+
require "rake/hooks"
|
4
|
+
|
5
|
+
require "bundler"
|
6
|
+
Bundler.require
|
7
|
+
|
8
|
+
require "bundler/gem_tasks"
|
9
|
+
|
10
|
+
require "yaml"
|
11
|
+
require "./lib/motion-environment-settings"
|
12
|
+
|
13
|
+
Dir.glob("lib/tasks/*.rake").each { |r| import r }
|
data/app/app_delegate.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
unless defined?(Motion::Project::Config)
|
2
|
+
raise "This gem must be included in a RubyMotion project"
|
3
|
+
end
|
4
|
+
|
5
|
+
module Motion
|
6
|
+
module EnvironmentSettings
|
7
|
+
DEFAULT_CONFIG_PATH = "./config/environments"
|
8
|
+
|
9
|
+
def self.config_path
|
10
|
+
return @@config_path if defined?(@@config_path)
|
11
|
+
puts "===== motion-environment-settings ===="
|
12
|
+
puts "* No config path explicitly set, using default: #{DEFAULT_CONFIG_PATH}"
|
13
|
+
puts "* Set your config path using `Motion::EnvironmentSettings.config_path=(\"your/path\") in your project's Rakefile"
|
14
|
+
DEFAULT_CONFIG_PATH
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.config_path=(new_config_path)
|
18
|
+
@@config_path = new_config_path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Motion::Project::App.setup do |app|
|
24
|
+
Dir.glob(File.join(File.dirname(__FILE__), "motion-environment-settings/*.rb")).each do |file|
|
25
|
+
app.files.unshift(file)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Motion
|
2
|
+
module EnvironmentSettings
|
3
|
+
class Generator
|
4
|
+
def self.generate
|
5
|
+
ENV["ENV"] = "development" if ENV["ENV"].nil?
|
6
|
+
|
7
|
+
File.open("./app/settings.rb", "w") do |file|
|
8
|
+
file.puts("class Settings")
|
9
|
+
config.each do |k,v|
|
10
|
+
file.puts(" def self.#{k}; \"#{v}\"; end")
|
11
|
+
end
|
12
|
+
file.puts("end")
|
13
|
+
end
|
14
|
+
|
15
|
+
Motion::Project::App.setup do |app|
|
16
|
+
app.files += Dir.glob(File.join(app.project_dir, "app/settings.rb"))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.config
|
21
|
+
YAML.load(File.read(File.join(Motion::EnvironmentSettings.config_path, "#{ENV["ENV"]}.yml")))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
$:.unshift("./lib/")
|
2
|
+
require "./lib/motion-environment-settings/generator"
|
3
|
+
|
4
|
+
before :"build:simulator" do
|
5
|
+
create_configuration
|
6
|
+
end
|
7
|
+
|
8
|
+
before :"build:device" do
|
9
|
+
create_configuration
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_configuration
|
13
|
+
Motion::EnvironmentSettings::Generator.generate
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "motion-environment-settings/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "motion-environment-settings"
|
8
|
+
s.version = Motion::EnvironmentSettings::VERSION
|
9
|
+
s.summary = "Manage environment settings for a RubyMotion project"
|
10
|
+
s.description = "Manage environment settings for a RubyMotion project"
|
11
|
+
s.authors = ["Michael Berkowitz"]
|
12
|
+
s.email = ["michael.berkowitz@gmail.com"]
|
13
|
+
s.license = "MIT"
|
14
|
+
|
15
|
+
s.files = `git ls-files -z`.split("\x0")
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-environment-settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Berkowitz
|
@@ -16,7 +16,20 @@ email:
|
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
|
-
files:
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- Gemfile
|
22
|
+
- Gemfile.lock
|
23
|
+
- README.md
|
24
|
+
- Rakefile
|
25
|
+
- app/app_delegate.rb
|
26
|
+
- config/development.yml
|
27
|
+
- config/environments/development.yml
|
28
|
+
- lib/motion-environment-settings.rb
|
29
|
+
- lib/motion-environment-settings/generator.rb
|
30
|
+
- lib/motion-environment-settings/version.rb
|
31
|
+
- lib/tasks/settings_hooks.rake
|
32
|
+
- motion-environment-settings.gemspec
|
20
33
|
homepage:
|
21
34
|
licenses:
|
22
35
|
- MIT
|