Module: StackMob

Defined in:
lib/stackmob/push.rb,
lib/stackmob.rb,
lib/stackmob/client.rb,
lib/stackmob/helpers.rb,
lib/stackmob/railtie.rb,
lib/stackmob/sinatra.rb,
lib/stackmob/deployer.rb,
lib/stackmob/data_store.rb,
lib/stackmob/rack/simple_oauth_provider.rb

Overview

Copyright 2011 StackMob

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defined Under Namespace

Modules: Helpers, Rack Classes: Client, DataStore, Deployer, Push, Railtie

Constant Summary collapse

SANDBOX =
0
PRODUCTION =
1

Class Method Summary collapse

Class Method Details

.app_nameObject



42
43
44
# File 'lib/stackmob.rb', line 42

def self.app_name
  ENV['STACKMOB_APP_NAME'] || StackMob.config['sm_app_name']
end

.client_nameObject



46
47
48
# File 'lib/stackmob.rb', line 46

def self.client_name
  ENV['STACKMOB_CLIENT_NAME'] || StackMob.config['sm_client_name']
end

.configObject



30
31
32
# File 'lib/stackmob.rb', line 30

def self.config
  @config ||= YAML.load_file("config/stackmob.yml")
end

.dev_urlObject



50
51
52
# File 'lib/stackmob.rb', line 50

def self.dev_url
  "http://#{StackMob.client_name}.mob2.stackmob.com"
end

.envObject



54
55
56
# File 'lib/stackmob.rb', line 54

def self.env
  (is_production?) ? PRODUCTION : SANDBOX
end

.is_production?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/stackmob.rb', line 62

def self.is_production?
  ENV["RACK_ENV"] == "production"
end

.keyObject



38
39
40
# File 'lib/stackmob.rb', line 38

def self.key
  ENV[sm_env_key_str(:public_key)] || StackMob.config[sm_env_str]['key']
end

.secretObject



34
35
36
# File 'lib/stackmob.rb', line 34

def self.secret
  ENV[sm_env_key_str(:private_key)] || StackMob.config[sm_env_str]['secret']
end

.sm_env_key_str(suffix) ⇒ Object



66
67
68
# File 'lib/stackmob.rb', line 66

def self.sm_env_key_str(suffix)
  "STACKMOB_" + ((is_production?) ? "PROD" : "SAND") + "_#{suffix.upcase}"
end

.sm_env_strObject



58
59
60
# File 'lib/stackmob.rb', line 58

def self.sm_env_str
  env == PRODUCTION ? "production" : "development"
end