thin-ice 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTkyOTk2MzcyZTdiMDIyNmNhOGEyYWYxNTAxYmY3NDRkYmY1YjIwZg==
4
+ ZDNjOTI2MWIwOGZmOGIwYTdhZWNmNmJhODM5NzUzYWE5ZWIwZDQ4OQ==
5
5
  data.tar.gz: !binary |-
6
- ZjNmYzhjNjgyOTcxY2Y1M2UzN2I2OWYyZTYzMDI3NjZmZDY2YzEzYg==
6
+ YTY2MDcwYzE0YjE1NjJhMjNlMWU3MjljZTM5ZTNkMzdkZTcyMmMxZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODZiNmRkYjJlNzg4MGU0YjZhNzIwODAzYmFiZTA1ZTEzOTVkN2Q2YjVkMmVh
10
- ZTUwZDU1YWUwM2YyNGYyMGYzODU2MmM5ODg3MDEzOGYyODE5MjQ3ODA0Nzky
11
- MjhkMzk0YzlmNTgwZTM0OWQ4N2MyMjE2MmFlMWVhYTM0ZWJhYTI=
9
+ MzBiYWY4YjNkNmE5YmNhNzQ3YmRlZWYxNTRiNDE1MjZjYTI2YWVhZjlkNDFh
10
+ NmU1MGI3ZjU1MTkyOWU0ZjQzMmQ4OGIxM2FhODliMDFlNWZmMWI3OTM3ZTM4
11
+ YjRiZmUxYWU3NTc2YWUwNDUzMWJlNzU4MjRmZTYzMzNiNTE0YTU=
12
12
  data.tar.gz: !binary |-
13
- Y2ZkMzBhMzhlNmQ3MTZhZjNmZDRjYjYzMWYyNDZhMjlkOGM4OWQ4Yzk0OTk3
14
- NjI4N2UzOGZmMzJhMDgyMjA1MjFkYTRjNzliMTRmMjJiMmNmYzUwM2Q0Y2Nj
15
- MTY1OWNhZThhZjU3NGY3ZGM4MjQ4YTIyNzkzZTRkMmRlZjc1MGM=
13
+ MTg0MmNlZDRkNjYyYWIwNzdkYWEwZTM5YTcwMzA0Mjg1MGQyNzExZGE1ZWU5
14
+ MDk3MDgyNjBhOWE1ZDc4NWU2MmM2MDkzMGEwMmJkZGZhYzg1YTkwYzk1ZWE1
15
+ YWUyMmRmZDk4OWI3OTVhZWY4YjA0MGFkZGY1MGExNTMyNzk4MzI=
data/lib/thin-ice/core.rb CHANGED
@@ -1,12 +1,18 @@
1
1
  require 'rake'
2
2
 
3
+ # @author Alex Bezobchuk
3
4
  module ThinIce
4
5
  extend Rake::DSL
5
6
 
6
- class ThinCommandFailure < StandardError
7
- end
7
+ # A custom Exception to be thrown when an undesired exit status
8
+ # is returned when spawning a process.
9
+ class ThinCommandFailure < StandardError; end
8
10
 
9
- # Helper method for invoking god commands
11
+ # Forks a process given a list of arguments and options
12
+ # @param args [String] list of command arguments and options
13
+ # @return [Integer] the resulting exit status
14
+ # @raise [ThinCommandFailure] if the exit status of the process
15
+ # is non-zero
10
16
  def self.invoke(args)
11
17
  pid = Process.spawn(*args)
12
18
  _, result = Process.wait2(pid)
@@ -17,47 +23,70 @@ module ThinIce
17
23
  end
18
24
  end
19
25
 
26
+ # ThinManager is designed to help construct the exact command to be excuted
27
+ # by the Rake task.
20
28
  class ThinManager
21
29
 
22
- attr_accessor :env, :config_path, :thin_path, :rackup_path
23
-
30
+ # @!attribute env [String] Environment
31
+ # @!attribute config_path [String] Path to YML configuration file
32
+ # @!attribute thin_path [String] Path to Thin executable
33
+ # @!attribute rackup_path [String] Path to Rackup configuration
34
+ attr_reader :env, :config_path, :thin_path, :rackup_path
35
+
36
+ # Creates a [ThinManager] object that is used to to aid rake task
37
+ # generation
38
+ # @param options [Hash] Hash containing various configuration
39
+ # options
40
+ # @return [ThinManager] ThinManager object
24
41
  def initialize(options = {})
25
42
  @env = options[:env]
26
- @thin_path = options[:thin_path]
43
+ @thin_path = options[:thin_path]
27
44
  @config_path = options[:config_path]
28
45
  @rackup_path = options[:rackup_path]
29
46
  end
30
47
 
31
-
32
- # Helper methods for generating fragments of thin commands
48
+ # @return [Array] An Array cotaining the environment string. May be
49
+ # empty
33
50
  def env_param
34
51
  (env) ? [env] : []
35
52
  end
36
53
 
54
+ # @return [Array] An Array cotaining the Thin executable location. Uses
55
+ # local Thin gem by default
37
56
  def thin_exec_param
38
57
  [thin_path || "thin"]
39
58
  end
40
59
 
60
+ # @return [Array] An Array cotaining the path to a YML configuration file.
61
+ # Empty by default
41
62
  def config_path_param
42
63
  (config_path) ? ["-C", config_path] : []
43
64
  end
44
65
 
66
+ # @return [Array] An Array cotaining the path to a Rackup configuration file.
67
+ # Empty by default
45
68
  def rackup_path_param
46
69
  (rackup_path) ? ["-R", rackup_path] : []
47
70
  end
48
71
 
49
- # Helper methods for generating thin commands
50
-
72
+ # @return [String] A concatination of strings resulting in the Thin
73
+ # start command to be invoked by Rake
51
74
  def start_cmd
52
75
  env_param + thin_exec_param + rackup_path_param + config_path_param + ["start"]
53
76
  end
54
77
 
78
+ # @return [String] A concatination of strings resulting in the Thin
79
+ # stop command to be invoked by Rake
55
80
  def stop_cmd
56
81
  env_param + thin_exec_param + rackup_path_param + config_path_param + ["stop"]
57
82
  end
58
83
 
59
84
  end
60
85
 
86
+ # Generates a set of Rake tasks to be used within a specific namespace
87
+ # that handle starting and stoping a Thin server instance
88
+ # @param options [Hash] Hash containing various configuration
89
+ # options
61
90
  def self.create_tasks(options = {})
62
91
 
63
92
  thin_manager = ThinManager.new(options)
@@ -73,5 +102,4 @@ module ThinIce
73
102
  end
74
103
 
75
104
  end
76
-
77
105
  end
@@ -0,0 +1,3 @@
1
+ module ThinIce
2
+ VERSION = "1.0.0"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thin-ice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Bezobchuk
@@ -38,15 +38,58 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
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
41
+ - !ruby/object:Gem::Dependency
42
+ name: bump
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 0.5.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.5.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '0.8'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '0.8'
69
+ - !ruby/object:Gem::Dependency
70
+ name: redcarpet
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '3.1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '3.1'
83
+ description: Rake task generator for spinning up a thin server with easy to use configuration
84
+ options.
85
+ email: abezobchuk@gmail.com
44
86
  executables: []
45
87
  extensions: []
46
88
  extra_rdoc_files: []
47
89
  files:
48
- - lib/thin-ice.rb
49
90
  - lib/thin-ice/core.rb
91
+ - lib/thin-ice/version.rb
92
+ - lib/thin-ice.rb
50
93
  homepage: https://github.com/Alexanderbez/thin-ice
51
94
  licenses:
52
95
  - MIT
@@ -67,8 +110,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
110
  version: '0'
68
111
  requirements: []
69
112
  rubyforge_project:
70
- rubygems_version: 2.2.2
113
+ rubygems_version: 2.1.11
71
114
  signing_key:
72
115
  specification_version: 4
73
- summary: Rake task generator for starting a thin server
116
+ summary: Rake task generator for spinning up a thin server.
74
117
  test_files: []
118
+ has_rdoc: