thin-ice 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +15 -0
  2. data/lib/thin-ice/core.rb +77 -0
  3. data/lib/thin-ice.rb +1 -0
  4. metadata +74 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OTkyOTk2MzcyZTdiMDIyNmNhOGEyYWYxNTAxYmY3NDRkYmY1YjIwZg==
5
+ data.tar.gz: !binary |-
6
+ ZjNmYzhjNjgyOTcxY2Y1M2UzN2I2OWYyZTYzMDI3NjZmZDY2YzEzYg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ODZiNmRkYjJlNzg4MGU0YjZhNzIwODAzYmFiZTA1ZTEzOTVkN2Q2YjVkMmVh
10
+ ZTUwZDU1YWUwM2YyNGYyMGYzODU2MmM5ODg3MDEzOGYyODE5MjQ3ODA0Nzky
11
+ MjhkMzk0YzlmNTgwZTM0OWQ4N2MyMjE2MmFlMWVhYTM0ZWJhYTI=
12
+ data.tar.gz: !binary |-
13
+ Y2ZkMzBhMzhlNmQ3MTZhZjNmZDRjYjYzMWYyNDZhMjlkOGM4OWQ4Yzk0OTk3
14
+ NjI4N2UzOGZmMzJhMDgyMjA1MjFkYTRjNzliMTRmMjJiMmNmYzUwM2Q0Y2Nj
15
+ MTY1OWNhZThhZjU3NGY3ZGM4MjQ4YTIyNzkzZTRkMmRlZjc1MGM=
@@ -0,0 +1,77 @@
1
+ require 'rake'
2
+
3
+ module ThinIce
4
+ extend Rake::DSL
5
+
6
+ class ThinCommandFailure < StandardError
7
+ end
8
+
9
+ # Helper method for invoking god commands
10
+ def self.invoke(args)
11
+ pid = Process.spawn(*args)
12
+ _, result = Process.wait2(pid)
13
+
14
+ s = result.exitstatus
15
+ if s != 0
16
+ raise ThinCommandFailure, "thin command exited with status #{s}"
17
+ end
18
+ end
19
+
20
+ class ThinManager
21
+
22
+ attr_accessor :env, :config_path, :thin_path, :rackup_path
23
+
24
+ def initialize(options = {})
25
+ @env = options[:env]
26
+ @thin_path = options[:thin_path]
27
+ @config_path = options[:config_path]
28
+ @rackup_path = options[:rackup_path]
29
+ end
30
+
31
+
32
+ # Helper methods for generating fragments of thin commands
33
+ def env_param
34
+ (env) ? [env] : []
35
+ end
36
+
37
+ def thin_exec_param
38
+ [thin_path || "thin"]
39
+ end
40
+
41
+ def config_path_param
42
+ (config_path) ? ["-C", config_path] : []
43
+ end
44
+
45
+ def rackup_path_param
46
+ (rackup_path) ? ["-R", rackup_path] : []
47
+ end
48
+
49
+ # Helper methods for generating thin commands
50
+
51
+ def start_cmd
52
+ env_param + thin_exec_param + rackup_path_param + config_path_param + ["start"]
53
+ end
54
+
55
+ def stop_cmd
56
+ env_param + thin_exec_param + rackup_path_param + config_path_param + ["stop"]
57
+ end
58
+
59
+ end
60
+
61
+ def self.create_tasks(options = {})
62
+
63
+ thin_manager = ThinManager.new(options)
64
+
65
+ desc "Start the thin server"
66
+ task :start do
67
+ invoke thin_manager.start_cmd
68
+ end
69
+
70
+ desc "Stop the thin server"
71
+ task :stop do
72
+ invoke thin_manager.stop_cmd
73
+ end
74
+
75
+ end
76
+
77
+ end
data/lib/thin-ice.rb ADDED
@@ -0,0 +1 @@
1
+ require 'thin-ice/core'
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: thin-ice
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Alex Bezobchuk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thin
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ description: Rake task generator for starting a thin server given a rackup file and
42
+ YML configuration file.
43
+ email: abezobchuk@jibe.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/thin-ice.rb
49
+ - lib/thin-ice/core.rb
50
+ homepage: https://github.com/Alexanderbez/thin-ice
51
+ licenses:
52
+ - MIT
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 2.2.2
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: Rake task generator for starting a thin server
74
+ test_files: []