Class: Strobe

Inherits:
Object
  • Object
show all
Defined in:
lib/strobe.rb,
lib/strobe/ui.rb,
lib/strobe/cli.rb,
lib/strobe/http.rb,
lib/strobe/user.rb,
lib/strobe/deploy.rb,
lib/strobe/errors.rb,
lib/strobe/server.rb,
lib/strobe/account.rb,
lib/strobe/version.rb,
lib/strobe/settings.rb

Defined Under Namespace

Modules: UI Classes: Account, AccountError, ApplicationError, CLI, Deploy, Error, HTTP, Server, Settings, User

Constant Summary collapse

VERSION =
"0.0.1"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#uiObject



49
50
51
# File 'lib/strobe.rb', line 49

def ui
  @ui ||= UI::Basic.new
end

Class Method Details

.accountObject



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

def 
  main.
end

.app_rootObject



26
27
28
# File 'lib/strobe.rb', line 26

def app_root
  main.app_root
end

.config_dirObject



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

def config_dir
  main.config_dir
end

.Error(code) ⇒ Object



4
5
6
7
8
# File 'lib/strobe/errors.rb', line 4

def self.Error(code)
  Class.new(Error) do
    define_method(:status_code) { code }
  end
end

.local_config_dirObject



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

def local_config_dir
  main.local_config_dir
end

.mainObject

this isn’t currently needed, but why start with globals when you could just as easily start with a singleton instance, which may be helpful later



10
11
12
# File 'lib/strobe.rb', line 10

def main
  @main ||= new
end

.rootObject



22
23
24
# File 'lib/strobe.rb', line 22

def root
  main.root
end

.settingsObject



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

def settings
  main.settings
end

.uiObject



14
15
16
# File 'lib/strobe.rb', line 14

def ui
  main.ui
end

.ui=(ui) ⇒ Object



18
19
20
# File 'lib/strobe.rb', line 18

def ui=(ui)
  main.ui = ui
end

Instance Method Details

#app_rootObject



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

def app_root
  @app_root ||= Pathname.new(Dir.pwd)
end

#config_dirObject



62
63
64
65
66
67
68
# File 'lib/strobe.rb', line 62

def config_dir
  @config_dir ||= begin
    dir = Pathname.new(File.join(Strobe.user_home, ".strobe"))
    FileUtils.mkdir_p(dir) unless dir.exist?
    dir
  end
end

#local_config_dirObject



70
71
72
73
74
75
76
# File 'lib/strobe.rb', line 70

def local_config_dir
  @local_config_dir ||= begin
    dir = Pathname.new(File.join(app_root, ".strobe"))
    FileUtils.mkdir_p(dir) unless dir.exist?
    dir
  end
end

#rootObject



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

def root
  sproutcore = "#{app_root}/tmp/build"
  File.directory?(sproutcore) ? sproutcore : app_root
end

#settingsObject



78
79
80
# File 'lib/strobe.rb', line 78

def settings
  @settings ||= Settings.new
end