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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5370863134574b999c7b648ae78bc714564d81d
4
- data.tar.gz: 89f7bdc09676c2841135e0e02e80343d6a2c08d6
3
+ metadata.gz: 048641baab9d9579abceef5b7ab6be3a339a7f29
4
+ data.tar.gz: fa2ab1a579c50fa676a2d4e3eac17d9f7dd0b353
5
5
  SHA512:
6
- metadata.gz: 69830602e5e6e5a6c34961482e29ced1c94b5bbb7d497db92c0909d534e9983242d071a1823fb80db4835852a5606fb11919d805d3b10aee06b7cda1bd93aa39
7
- data.tar.gz: 661d362a5478bacb1e471e438010cb20582e707fb6c944c86be6d48935517c0ce0e2370770f57446366e6ad058a27976c11e78ee7ccef9416df902d97f76a174
6
+ metadata.gz: bd8a141d4ec87fb0ed426ff32b42dfd13b1759451fcbea24e06cc9a4f385604ad8094a4b04e401e718dc743029fe34e18b96923e562988df76c548797d689c4d
7
+ data.tar.gz: 29d6b952f5b2df17e7be84282301b0d49101ec973a6734f41351ed79a28830b16a7910cf0dbe42faa3675e69edea099948674d412de3623094126825a1504ff0
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ app/settings.rb
2
+ pkg/
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rake"
4
+ gem "rake-hooks"
5
+ gem "motion-yaml", "1.4"
data/Gemfile.lock ADDED
@@ -0,0 +1,18 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ motion-yaml (1.4)
5
+ rake (10.4.2)
6
+ rake-hooks (1.2.3)
7
+ rake
8
+
9
+ PLATFORMS
10
+ ruby
11
+
12
+ DEPENDENCIES
13
+ motion-yaml (= 1.4)
14
+ rake
15
+ rake-hooks
16
+
17
+ BUNDLED WITH
18
+ 1.10.6
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 }
@@ -0,0 +1,9 @@
1
+ class AppDelegate
2
+ def application(application, didFinishLaunchingWithOptions:launchOptions)
3
+ @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
4
+
5
+ puts Settings.test_value
6
+
7
+ true
8
+ end
9
+ end
@@ -0,0 +1,2 @@
1
+ ---
2
+ test_value: "THIS ALSO WORKS!"
@@ -0,0 +1,2 @@
1
+ ---
2
+ test_value: "HUZZAH!"
@@ -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,5 @@
1
+ module Motion
2
+ module EnvironmentSettings
3
+ VERSION = "0.0.2"
4
+ end
5
+ 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.1
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