stairs 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -10
- data/lib/stairs/script.rb +1 -1
- data/lib/stairs/step.rb +51 -11
- data/lib/stairs/version.rb +1 -1
- data/lib/stairs.rb +1 -0
- data/stairs.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7065dce0f1a914961380b69ee67aeab6ca1a3633
|
4
|
+
data.tar.gz: b9adf5378fc447b10dd8a4cb9e349b2d56faff3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8838ad2217b046c6fcc40fa578df6ce8e6b282d1752224d76aab26ee437e08e72dc0b5d02af85cfddca0c9f103eedc4aebf907429928dd6c05ac94bc7d8b5cfc
|
7
|
+
data.tar.gz: f6ba56450cf0aafb9156f0ca625eadf3d3c4fa8374b6a25e3ea8a23489b5a932c6949b5c18a48062eb666c7df25a35e0e7218fd0429d7b863149ebb91881e281
|
data/README.md
CHANGED
@@ -30,14 +30,20 @@ A script composes many steps that setup a project. __Note:__ optional steps are
|
|
30
30
|
not yet implemented.
|
31
31
|
|
32
32
|
```ruby
|
33
|
+
bundle
|
34
|
+
|
33
35
|
setup :secret_token
|
34
36
|
|
35
37
|
setup :s3
|
36
38
|
setup :zencoder, required: false
|
37
39
|
|
38
|
-
|
40
|
+
setup :misc do
|
41
|
+
env "CHECK_IT", provide "Cool check it value"
|
42
|
+
end
|
43
|
+
|
44
|
+
rake "db:setup"
|
39
45
|
|
40
|
-
|
46
|
+
finish "Just run rails s and sidekiq to get rolling!"
|
41
47
|
```
|
42
48
|
|
43
49
|
### Example CLI
|
@@ -47,20 +53,32 @@ is desired future functionality (bundle/db tasks, spacing, last words).
|
|
47
53
|
|
48
54
|
```
|
49
55
|
$ rake newb
|
50
|
-
|
51
|
-
|
56
|
+
Looks like you're using rbenv to manage environment variables. Is this correct? (Y/N): Y
|
57
|
+
|
58
|
+
= Running script setup.rb
|
59
|
+
|
60
|
+
== Running bundle
|
61
|
+
...
|
62
|
+
== Completed bundle
|
52
63
|
|
53
|
-
==
|
64
|
+
== Running S3
|
54
65
|
AWS access key: 39u39d9u291
|
55
66
|
AWS secret: 19jd920i10is0i01i0s01ks0kfknkje
|
56
67
|
Do you have an existing bucket? (Y/N): Y
|
57
68
|
Bucket name (leave blank for app-dev): my-cool-bucket
|
69
|
+
== Completed S3
|
58
70
|
|
59
71
|
== Starting Zencoder
|
60
72
|
This step is optional, would you like to perform it? (Y/N): N
|
73
|
+
== Completed Zencoder
|
61
74
|
|
62
|
-
== Starting
|
75
|
+
== Starting Misc
|
63
76
|
Cool check it value: w00t
|
77
|
+
== Completed Misc
|
78
|
+
|
79
|
+
== Running db:setup
|
80
|
+
...
|
81
|
+
== Completed db:setup
|
64
82
|
|
65
83
|
== All done!
|
66
84
|
Run rails s and sidekiq to get rolling!
|
@@ -95,14 +113,28 @@ write "awesome: true", "config/settings.yml"
|
|
95
113
|
write_line "more: false", "config/settings.yml"
|
96
114
|
```
|
97
115
|
|
98
|
-
###
|
116
|
+
### Misc helpers
|
99
117
|
|
100
|
-
|
101
|
-
|
118
|
+
Run bundle to install gems
|
119
|
+
```ruby
|
120
|
+
bundle
|
121
|
+
```
|
122
|
+
|
123
|
+
Run rake tasks
|
124
|
+
```ruby
|
125
|
+
rake "task_name"
|
126
|
+
```
|
127
|
+
|
128
|
+
Display a message when setup completes
|
129
|
+
```ruby
|
130
|
+
finish "Now that you're done, go have a drink!"
|
131
|
+
```
|
132
|
+
|
133
|
+
### Defining setup steps
|
102
134
|
|
103
135
|
```ruby
|
104
136
|
setup :a_cool_service do
|
105
|
-
|
137
|
+
# ...
|
106
138
|
end
|
107
139
|
```
|
108
140
|
|
data/lib/stairs/script.rb
CHANGED
data/lib/stairs/step.rb
CHANGED
@@ -3,20 +3,31 @@ require "highline/import"
|
|
3
3
|
module Stairs
|
4
4
|
class Step
|
5
5
|
def run!
|
6
|
-
|
6
|
+
stairs_info "== Running #{step_title}"
|
7
7
|
run
|
8
|
+
stairs_info "== Completed #{step_title}"
|
8
9
|
end
|
9
10
|
|
11
|
+
attr_writer :step_title, :step_description
|
12
|
+
|
10
13
|
private
|
11
14
|
|
12
|
-
class_attribute :
|
15
|
+
class_attribute :step_title, :step_description
|
13
16
|
|
14
17
|
def self.title(title)
|
15
|
-
self.
|
18
|
+
self.step_title = title
|
16
19
|
end
|
17
20
|
|
18
21
|
def self.description(description)
|
19
|
-
self.
|
22
|
+
self.step_description = description
|
23
|
+
end
|
24
|
+
|
25
|
+
def step_title
|
26
|
+
@step_title || self.class.step_title
|
27
|
+
end
|
28
|
+
|
29
|
+
def step_description
|
30
|
+
@step_description || self.class.step_description
|
20
31
|
end
|
21
32
|
|
22
33
|
# Prompt user to provide input
|
@@ -27,7 +38,7 @@ module Stairs
|
|
27
38
|
prompt << " (leave blank for #{options[:default]})" if options[:default]
|
28
39
|
prompt << ": "
|
29
40
|
|
30
|
-
response = ask(prompt) { |q| q.validate = /\S+/ if required }
|
41
|
+
response = ask(prompt.blue) { |q| q.validate = /\S+/ if required }
|
31
42
|
response.present? ? response : options[:default]
|
32
43
|
end
|
33
44
|
|
@@ -35,7 +46,7 @@ module Stairs
|
|
35
46
|
# TODO shouldn't care about case
|
36
47
|
def choice(question, choices=["Y", "N"])
|
37
48
|
prompt = "#{question} (#{choices.join("/")}): "
|
38
|
-
response = ask(prompt) { |q| q.in = choices }
|
49
|
+
response = ask(prompt.blue) { |q| q.in = choices }
|
39
50
|
|
40
51
|
case response
|
41
52
|
when "Y"
|
@@ -48,7 +59,19 @@ module Stairs
|
|
48
59
|
response
|
49
60
|
end
|
50
61
|
|
51
|
-
|
62
|
+
def bundle
|
63
|
+
stairs_info "== Running bundle"
|
64
|
+
system "bundle"
|
65
|
+
stairs_info "== Completed bundle"
|
66
|
+
end
|
67
|
+
|
68
|
+
def rake(task)
|
69
|
+
stairs_info "== Running #{task}"
|
70
|
+
system "rake #{task}"
|
71
|
+
stairs_info "== Completed #{task}"
|
72
|
+
end
|
73
|
+
|
74
|
+
# Set or update env var
|
52
75
|
def env(name, value)
|
53
76
|
Stairs.configuration.env_adapter.set name, value
|
54
77
|
end
|
@@ -64,10 +87,27 @@ module Stairs
|
|
64
87
|
end
|
65
88
|
|
66
89
|
# Embed a step where step_name is a symbol that can be resolved to a class
|
67
|
-
# in Stairs::Steps
|
68
|
-
|
69
|
-
|
70
|
-
|
90
|
+
# in Stairs::Steps or a block is provided to be executed in an instance
|
91
|
+
# of Step
|
92
|
+
def setup(step_name, &block)
|
93
|
+
if block_given?
|
94
|
+
Step.new.tap do |step|
|
95
|
+
step.define_singleton_method :run, &block
|
96
|
+
step.step_title = step_name.to_s.titleize
|
97
|
+
end.run!
|
98
|
+
else
|
99
|
+
klass = "Stairs::Steps::#{step_name.to_s.camelize}".constantize
|
100
|
+
klass.new.run!
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def finish(message)
|
105
|
+
puts "== All done!".green
|
106
|
+
puts message.green
|
107
|
+
end
|
108
|
+
|
109
|
+
def stairs_info(message)
|
110
|
+
puts message.light_black
|
71
111
|
end
|
72
112
|
end
|
73
113
|
end
|
data/lib/stairs/version.rb
CHANGED
data/lib/stairs.rb
CHANGED
data/stairs.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stairs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- patbenatar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 3.2.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: colorize
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.6.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.6.0
|
69
83
|
description: A DSL and collection of plugins for easy setup of projects on new development
|
70
84
|
environments.
|
71
85
|
email:
|