woro 0.3.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -3
- data/bin/woro +14 -77
- data/features/configuration.feature +2 -0
- data/features/manage_tasks.feature +1 -1
- data/lib/woro.rb +1 -0
- data/lib/woro/adapters/base.rb +1 -1
- data/lib/woro/task.rb +9 -4
- data/lib/woro/task_helper.rb +76 -15
- data/lib/woro/task_list.rb +82 -0
- data/lib/woro/tasks/capistrano.rake +1 -1
- data/lib/woro/tasks/mina.rake +1 -1
- data/lib/woro/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e496d238bdfd9af7ef5e6efb03bf657c0ea32467
|
4
|
+
data.tar.gz: 5285f1b393d35dc22a4f3b3365beaae5a3fddb31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 290e81096f82aae9ecb49ab2a134e01d89efb4b8b8f08558684f00dd8032d0ba0861801884b06e2df4a9d4f4e32e0c05d7ab3a3c86872f319f7f97dd6f93cdd2
|
7
|
+
data.tar.gz: f1737428a46edf86bfad5d033c552ce52ae87d73c89b4b359011de6d276a9890339f82d2345918559a2d00abe55d16c43b9496ef86160e10559a5bfe23643b8d
|
data/README.md
CHANGED
@@ -2,8 +2,12 @@
|
|
2
2
|
|
3
3
|
Write once, run once.
|
4
4
|
|
5
|
+
[](https://rubygems.org/gems/woro)
|
6
|
+
[](https://rubygems.org/gems/woro)
|
7
|
+
[](http://rubydoc.info/github/dahie/woro)
|
8
|
+
|
5
9
|
Manage one-time remote tasks in your Rails project.
|
6
|
-
Plugins with Mina and Capistrano to add support for rake tasks hosted in remote collection, such as Gist.
|
10
|
+
Plugins with Mina and Capistrano to add support for rake tasks hosted in remote collection, such as FTP, Gist or S3.
|
7
11
|
|
8
12
|
Say you have a data migration to perform on a remote server. The procedure is too complex to just do it in the remote console and using database migrations would be evil. A rake task would be nice, but checking this in with the source code repository adds clutter, as you know you will only run this once.
|
9
13
|
Woro offers a quick way of pushing rake tasks onto the remote server, execute them and delete them instantly.
|
@@ -19,6 +23,8 @@ By default Woro comes with support for FTP, but additional adapters are availabl
|
|
19
23
|
* [woro-gist](https://github.com/github/woro-gist)
|
20
24
|
* [woro-s3](https://github.com/github/woro-s3)
|
21
25
|
|
26
|
+
Add them as dependency to your `Gemfile` and they become available in woro.
|
27
|
+
|
22
28
|
## Installation
|
23
29
|
|
24
30
|
Add this line to your application's Gemfile:
|
@@ -52,6 +58,12 @@ Gist id.
|
|
52
58
|
It also creates the `lib/woro_tasks/` folder and `lib/tasks/woro.rake`.
|
53
59
|
Here the Woro task files are stored, edited locally and run using rake.
|
54
60
|
|
61
|
+
_The idea of the Woro tasks is, that these are a one time thing and are
|
62
|
+
not required to be checked in with the repository. Therefore,
|
63
|
+
`lib/woro_tasks/` includes a `.gitignore` file to ignore rake tasks in
|
64
|
+
this directory._
|
65
|
+
|
66
|
+
|
55
67
|
### for use with Mina
|
56
68
|
|
57
69
|
Require `mina/woro` in your `config/deploy.rb`:
|
@@ -80,6 +92,7 @@ require 'capistrano/woro'
|
|
80
92
|
|
81
93
|
```shell
|
82
94
|
$ woro new cleanup_users
|
95
|
+
$ woro create cleanup_users
|
83
96
|
```
|
84
97
|
|
85
98
|
Can be used to create the template for a new task in `lib/woro_tasks/`.
|
@@ -134,8 +147,7 @@ The project classes are tested through rspec.
|
|
134
147
|
$ rspec
|
135
148
|
```
|
136
149
|
|
137
|
-
The command line interface
|
138
|
-
is tested through cucmber/aruba.
|
150
|
+
The command line interface is tested through cucmber/aruba.
|
139
151
|
|
140
152
|
```shell
|
141
153
|
$ cucumber
|
data/bin/woro
CHANGED
@@ -23,47 +23,6 @@ executed by rake and cleaned up afterwards.'
|
|
23
23
|
|
24
24
|
default_command :list
|
25
25
|
|
26
|
-
def create_directory_unless_existing(directory)
|
27
|
-
unless File.exists? directory
|
28
|
-
FileUtils.mkdir_p directory
|
29
|
-
say "Created `#{directory}`"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def create_required_files
|
34
|
-
create_directory_unless_existing Woro::Configuration.woro_task_dir
|
35
|
-
create_directory_unless_existing Woro::Configuration.rake_task_dir
|
36
|
-
create_directory_unless_existing File.dirname(Woro::Configuration.config_file)
|
37
|
-
|
38
|
-
unless File.exists? File.join(Woro::Configuration.rake_task_dir, 'woro.rake')
|
39
|
-
FileUtils.cp(File.dirname(__FILE__) + '/../lib/woro/templates/woro.rake',
|
40
|
-
Woro::Configuration.rake_task_dir)
|
41
|
-
say "Created `woro.rake` in `#{Woro::Configuration.rake_task_dir}`"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def woro_environment_setup?
|
46
|
-
File.exists?(Woro::Configuration.woro_task_dir) &&
|
47
|
-
File.exists?(File.join('config', 'woro.yml')) &&
|
48
|
-
File.exists?(Woro::Configuration.rake_task_dir) &&
|
49
|
-
File.exists?(File.join(Woro::Configuration.rake_task_dir, 'woro.rake'))
|
50
|
-
end
|
51
|
-
|
52
|
-
def select_choice(choices)
|
53
|
-
choose do |menu|
|
54
|
-
menu.prompt = 'Please choose a service to use with Woro:'
|
55
|
-
menu.choices(*choices) do |choice|
|
56
|
-
return choice.to_s.strip
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def choose_and_build_adapter_config(available_adapters)
|
62
|
-
adapter_name = select_choice available_adapters
|
63
|
-
adapter = Object.const_get "Woro::Adapters::#{adapter_name}"
|
64
|
-
{ adapter_name.downcase => adapter.setup }
|
65
|
-
end
|
66
|
-
|
67
26
|
command :init do |c|
|
68
27
|
c.syntax = 'woro init [options]'
|
69
28
|
c.description = 'Initialize Woro in the current Rails directory and setup Gist collection'
|
@@ -72,13 +31,12 @@ command :init do |c|
|
|
72
31
|
available_adapters = Woro::Adapters.constants.reject { |name| name == :Base }
|
73
32
|
adapters = {}
|
74
33
|
begin
|
75
|
-
adapters.merge! choose_and_build_adapter_config(available_adapters)
|
34
|
+
adapters.merge! Woro::TaskHelper.choose_and_build_adapter_config(available_adapters)
|
76
35
|
end while agree('Do you want to configure another service?')
|
77
36
|
options.default('adapters' => adapters )
|
78
37
|
|
79
|
-
create_required_files
|
80
|
-
|
81
|
-
config = Woro::Configuration.save(options.__hash__)
|
38
|
+
Woro::TaskHelper.create_required_files
|
39
|
+
Woro::Configuration.save(options.__hash__)
|
82
40
|
end
|
83
41
|
end
|
84
42
|
|
@@ -90,15 +48,15 @@ command :new do |c|
|
|
90
48
|
c.example 'Creates tasks called "cleanup", "fix1" and "fix2"', 'woro new cleanup fix1 fix2'
|
91
49
|
c.option '--[no-]force', 'force overwrite of existing task file'
|
92
50
|
c.action do |args, options|
|
93
|
-
|
51
|
+
Woro::TaskHelper.check_environment
|
94
52
|
|
95
|
-
|
53
|
+
Woro::Configuration.load
|
96
54
|
force_overwrite = options.force
|
97
55
|
args.each do |task_name|
|
98
56
|
task = Woro::Task.new(task_name)
|
99
57
|
if !task.exists? || force_overwrite || agree("Overwrite existing #{task.file_path}?")
|
100
58
|
task.create_from_task_template
|
101
|
-
say "Created
|
59
|
+
say "Created `#{task.file_path}`"
|
102
60
|
end
|
103
61
|
end
|
104
62
|
end
|
@@ -111,7 +69,7 @@ command :push do |c|
|
|
111
69
|
c.description = 'Pushes one or more local tasks to the remote collection. Existing tasks by this name in the remote connection will be updated.'
|
112
70
|
c.example 'Pushes the task "cleanup" to the remote collection', 'woro push ftp:cleanup'
|
113
71
|
c.action do |args, options|
|
114
|
-
|
72
|
+
Woro::TaskHelper.check_environment
|
115
73
|
|
116
74
|
config = Woro::Configuration.load
|
117
75
|
args.each do |arg|
|
@@ -125,9 +83,9 @@ command :push do |c|
|
|
125
83
|
if task.exists?
|
126
84
|
adapter = config.adapter adapter_name
|
127
85
|
result = adapter.push(task)
|
128
|
-
say "Uploaded `#{task.file_path} to #{result['url']}"
|
86
|
+
say "Uploaded `#{task.file_path}` to #{result['url']}"
|
129
87
|
else
|
130
|
-
|
88
|
+
say_error "Task `#{task.task_name}` not found at `#{task.file_path}`"
|
131
89
|
end
|
132
90
|
end
|
133
91
|
end
|
@@ -140,7 +98,7 @@ command :pull do |c|
|
|
140
98
|
c.example 'Pulls the task "cleanup" from the remote collection', 'woro pull ftp:cleanup'
|
141
99
|
c.option '--[no-]force', 'force overwrite of existing task file'
|
142
100
|
c.action do |args, options|
|
143
|
-
|
101
|
+
Woro::TaskHelper.check_environment
|
144
102
|
|
145
103
|
config = Woro::Configuration.load
|
146
104
|
args.each do |arg|
|
@@ -153,8 +111,8 @@ command :pull do |c|
|
|
153
111
|
task = Woro::Task.new(task_name)
|
154
112
|
force_overwrite = options.force
|
155
113
|
if !task.exists? || force_overwrite || agree("Overwrite existing #{task.file_path}?")
|
156
|
-
system "cd '#{config.woro_task_dir}' && curl -
|
157
|
-
say "Downloaded
|
114
|
+
system "cd '#{config.woro_task_dir}' && curl -sSO #{adapter.raw_url(task.file_name)}" # > #{task.file_path}"
|
115
|
+
say "Downloaded `#{task.task_name}` to `#{task.file_path}`"
|
158
116
|
end
|
159
117
|
end
|
160
118
|
end
|
@@ -167,29 +125,8 @@ command :list do |c|
|
|
167
125
|
#c.example 'List all tasks', 'woro list --all'
|
168
126
|
#c.option '-a', '--all', 'List all tasks'
|
169
127
|
c.action do |args, options|
|
170
|
-
|
171
|
-
|
172
|
-
config = Woro::Configuration.load
|
173
|
-
config.adapter_settings.each do |adapter_setting|
|
174
|
-
say "#{adapter_setting[0]} ---"
|
175
|
-
adapter = config.adapter(adapter_setting[0])
|
176
|
-
files = adapter.list_contents || {}
|
177
|
-
tasks = files.map do |file_name, data|
|
178
|
-
if file_name.include? '.rake'
|
179
|
-
OpenStruct.new(name_with_args: file_name.split('.rake').first,
|
180
|
-
comment: adapter.extract_description(data[:data]))
|
181
|
-
end
|
182
|
-
end
|
183
|
-
tasks.compact!
|
184
|
-
Woro::TaskHelper.print_task_list(tasks)
|
185
|
-
end
|
186
|
-
say "local ---"
|
187
|
-
tasks = Woro::TaskHelper.woro_task_files(config.woro_task_dir) do |file_name, data|
|
188
|
-
OpenStruct.new(name_with_args: file_name.split('.rake').first,
|
189
|
-
comment: Woro::TaskHelper.extract_description(data))
|
190
|
-
end
|
191
|
-
Woro::TaskHelper.print_task_list(tasks)
|
128
|
+
Woro::TaskHelper.check_environment
|
129
|
+
Woro::TaskList.new(Woro::Configuration.load).fill.print
|
192
130
|
end
|
193
131
|
end
|
194
132
|
alias_command :ls, :list
|
195
|
-
|
@@ -20,6 +20,7 @@ Feature: Configure woro
|
|
20
20
|
Please choose a service to use with Woro:
|
21
21
|
FTP Host: FTP User: FTP Passwod: FTP Folder: |/| Do you want to configure another service?
|
22
22
|
Created `lib/woro_tasks`
|
23
|
+
Created `lib/woro_tasks/.gitignore`
|
23
24
|
Created `lib/tasks`
|
24
25
|
Created `config`
|
25
26
|
Created `woro.rake` in `lib/tasks`
|
@@ -31,6 +32,7 @@ Feature: Configure woro
|
|
31
32
|
| lib/tasks |
|
32
33
|
And the following files should exist:
|
33
34
|
| lib/tasks/woro.rake |
|
35
|
+
And the file "lib/woro_tasks/.gitignore" should contain "*.rake"
|
34
36
|
|
35
37
|
Scenario: Initialize configuration (no clobber)
|
36
38
|
Given a file named "config/woro.yml" with:
|
@@ -41,7 +41,7 @@ Feature: Manage Woro task
|
|
41
41
|
Scenario: Create local task
|
42
42
|
Given the Woro environment is set up
|
43
43
|
When I run `woro new cleanup`
|
44
|
-
And the output should contain "Created lib/woro_tasks/cleanup.rake"
|
44
|
+
And the output should contain "Created `lib/woro_tasks/cleanup.rake`"
|
45
45
|
|
46
46
|
Scenario: Push local task to remote without environment
|
47
47
|
When I run `woro push stub:cleanup`
|
data/lib/woro.rb
CHANGED
data/lib/woro/adapters/base.rb
CHANGED
@@ -8,7 +8,7 @@ module Woro
|
|
8
8
|
# @param content [String] content of task file
|
9
9
|
# [String] description string
|
10
10
|
def extract_description(content)
|
11
|
-
Woro::
|
11
|
+
Woro::TaskList.extract_description content
|
12
12
|
end
|
13
13
|
|
14
14
|
# Returns the list of files included in the Gist
|
data/lib/woro/task.rb
CHANGED
@@ -10,6 +10,8 @@ module Woro
|
|
10
10
|
@task_name = Woro::Task.sanitize_task_name task_name
|
11
11
|
end
|
12
12
|
|
13
|
+
# Create new Task, creates vanilla task file in the woro
|
14
|
+
# task directory.
|
13
15
|
# @param task_name [String] sanitized name of the task, used
|
14
16
|
# throughout the further processing
|
15
17
|
# @return [Task] the created task
|
@@ -24,25 +26,28 @@ module Woro
|
|
24
26
|
end
|
25
27
|
|
26
28
|
# File name based on the task's name.
|
27
|
-
# @return [String]
|
29
|
+
# @return [String] taskname with extension
|
28
30
|
def file_name
|
29
31
|
"#{task_name}.rake"
|
30
32
|
end
|
31
33
|
|
32
34
|
# File name based on the task's filename (see #file_name).
|
33
|
-
# @return [String]
|
35
|
+
# @return [String] taskname with extension and relative path
|
34
36
|
def file_path
|
35
37
|
File.join 'lib', 'woro_tasks', file_name
|
36
38
|
end
|
37
39
|
|
38
|
-
# Returns true if a task of this name exists locally
|
40
|
+
# Returns true, if a task of this name exists locally
|
41
|
+
# @return [boolean] task file exists locally
|
39
42
|
def exists?
|
40
43
|
File.exist? file_path
|
41
44
|
end
|
42
45
|
|
46
|
+
# Read template and inject new name
|
47
|
+
# @return [String] source code for new task
|
43
48
|
def build_task_template
|
44
49
|
b = binding
|
45
|
-
|
50
|
+
ERB.new(Woro::TaskHelper.read_template_file).result(b)
|
46
51
|
end
|
47
52
|
|
48
53
|
# Creates a new rake task file at the file path (see #file_path).
|
data/lib/woro/task_helper.rb
CHANGED
@@ -1,14 +1,84 @@
|
|
1
|
+
require 'commander'
|
2
|
+
|
1
3
|
module Woro
|
4
|
+
# Set of helper methods used in the woro executable
|
2
5
|
class TaskHelper
|
6
|
+
include Commander::UI
|
3
7
|
class << self
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
# Check if woro environment is available in project
|
9
|
+
def check_environment
|
10
|
+
return if woro_environment_setup?
|
11
|
+
abort 'Woro environment is not set up. Call `woro init` to do so.'
|
12
|
+
end
|
13
|
+
|
14
|
+
# Create the given directory, unless it already exists.
|
15
|
+
# @param directory [String] directory to create
|
16
|
+
def create_directory_unless_existing(directory)
|
17
|
+
return if File.exist? directory
|
18
|
+
FileUtils.mkdir_p directory
|
19
|
+
say "Created `#{directory}`"
|
20
|
+
end
|
21
|
+
|
22
|
+
# Write a file at a given path with the given content, unless
|
23
|
+
# it already exists.
|
24
|
+
# @param file_path [String] save the new file here
|
25
|
+
# @param content [String] write this into the file
|
26
|
+
def create_file_unless_existing(file_path, content)
|
27
|
+
return if File.exist? file_path
|
28
|
+
File.open(file_path, 'w') do |f|
|
29
|
+
f.puts content
|
8
30
|
end
|
31
|
+
say "Created `#{file_path}`"
|
32
|
+
end
|
33
|
+
|
34
|
+
# Creates all files required for a setup woro environment.
|
35
|
+
def create_required_files
|
36
|
+
create_directory_unless_existing Woro::Configuration.woro_task_dir
|
37
|
+
create_file_unless_existing File.join(Woro::Configuration.woro_task_dir, '.gitignore'), '*.rake'
|
38
|
+
create_directory_unless_existing Woro::Configuration.rake_task_dir
|
39
|
+
create_directory_unless_existing File.dirname(Woro::Configuration.config_file)
|
40
|
+
|
41
|
+
return if File.exist? File.join(Woro::Configuration.rake_task_dir, 'woro.rake')
|
42
|
+
|
43
|
+
woro_task_file = File.join(File.dirname(__FILE__),
|
44
|
+
'templates', 'woro.rake')
|
45
|
+
FileUtils.cp(woro_task_file, Woro::Configuration.rake_task_dir)
|
46
|
+
say "Created `woro.rake` in `#{Woro::Configuration.rake_task_dir}`"
|
47
|
+
end
|
48
|
+
|
49
|
+
# Returns true, if all requirements of a woro setup are met.
|
50
|
+
# @return [boolean] all configurations, all directories exist
|
51
|
+
def woro_environment_setup?
|
52
|
+
File.exist?(Woro::Configuration.woro_task_dir) &&
|
53
|
+
File.exist?(File.join('config', 'woro.yml')) &&
|
54
|
+
File.exist?(Woro::Configuration.rake_task_dir) &&
|
55
|
+
File.exist?(File.join(Woro::Configuration.rake_task_dir, 'woro.rake'))
|
56
|
+
end
|
57
|
+
|
58
|
+
# Display choice of adapter and return name of the chosen one.
|
59
|
+
# @param choices [Array] list of choices
|
60
|
+
# @return [String] Name of chosen adapter
|
61
|
+
def select_choice(choices, message)
|
62
|
+
choose do |menu|
|
63
|
+
menu.prompt = message
|
64
|
+
menu.choices(*choices) do |choice|
|
65
|
+
return choice.to_s.strip
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Choose adapter and return its settings.
|
71
|
+
# @param task_name [String] sanitized name of the task, used
|
72
|
+
# @return [Hash] Hash with adapter name and its settings
|
73
|
+
def choose_and_build_adapter_config(available_adapters)
|
74
|
+
adapter_name = select_choice available_adapters, 'Please choose a service to use with Woro:'
|
75
|
+
adapter = Object.const_get "Woro::Adapters::#{adapter_name}"
|
76
|
+
{ adapter_name.downcase => adapter.setup }
|
9
77
|
end
|
10
78
|
|
11
79
|
# Perform an action over all files within the woro task directory
|
80
|
+
# @param directory [String] directory
|
81
|
+
# @return [Array] List of rake tasks in the directory
|
12
82
|
def woro_task_files(directory)
|
13
83
|
tasks = []
|
14
84
|
Dir.foreach(directory) do |file_name|
|
@@ -20,19 +90,10 @@ module Woro
|
|
20
90
|
tasks
|
21
91
|
end
|
22
92
|
|
23
|
-
# Extract description from gist's data content string.
|
24
|
-
# @param data [Hash] gist data hash
|
25
|
-
# [String] description string
|
26
|
-
def extract_description(task_content)
|
27
|
-
# regex from http://stackoverflow.com/questions/171480/regex-grabbing-values-between-quotation-marks
|
28
|
-
match = task_content.match(/desc (["'])((?:(?!\1)[^\\]|(?:\\\\)*\\[^\\])*)\1/)
|
29
|
-
match && match[2] || 'No description'
|
30
|
-
end
|
31
|
-
|
32
93
|
# Read the rake task template
|
33
|
-
# @return [String]
|
94
|
+
# @return [String] Content of template file
|
34
95
|
def read_template_file
|
35
|
-
File.read
|
96
|
+
File.read File.join(File.dirname(__FILE__), 'templates', 'task.rake.erb')
|
36
97
|
end
|
37
98
|
end
|
38
99
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
require 'commander'
|
3
|
+
include Commander::UI
|
4
|
+
|
5
|
+
module Woro
|
6
|
+
# Generates the list of all tasks for printout to console.
|
7
|
+
class TaskList
|
8
|
+
attr_reader :config, :list
|
9
|
+
|
10
|
+
def initialize(config)
|
11
|
+
@config = config
|
12
|
+
@list = []
|
13
|
+
end
|
14
|
+
|
15
|
+
# Determine the max count of characters for all task names.
|
16
|
+
# @return [integer] count of characters
|
17
|
+
def width
|
18
|
+
@width ||= list.map { |t| t.name_with_args ? t.name_with_args.length : 0 }.max || 10
|
19
|
+
end
|
20
|
+
|
21
|
+
# Fill task list by loading tasks from the configured adapters and locally.
|
22
|
+
# @return [Object] task_list
|
23
|
+
def fill
|
24
|
+
fill_list_from_adapters
|
25
|
+
fill_list_from_local
|
26
|
+
self
|
27
|
+
end
|
28
|
+
|
29
|
+
# Print the current task list to console.
|
30
|
+
def print
|
31
|
+
list.each do |entry|
|
32
|
+
entry.headline ? print_headline(entry) : print_task_description(entry)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Extract description from gist's data content string.
|
37
|
+
# @param data [Hash] gist data hash
|
38
|
+
# [String] description string
|
39
|
+
def self.extract_description(task_content)
|
40
|
+
# regex from http://stackoverflow.com/questions/171480/regex-grabbing-values-between-quotation-marks
|
41
|
+
match = task_content.match(/desc (["'])((?:(?!\1)[^\\]|(?:\\\\)*\\[^\\])*)\1/)
|
42
|
+
match && match[2] || 'No description'
|
43
|
+
end
|
44
|
+
|
45
|
+
protected
|
46
|
+
|
47
|
+
def fill_list_from_local
|
48
|
+
list << OpenStruct.new(headline: 'local')
|
49
|
+
Woro::TaskHelper.woro_task_files(config.woro_task_dir) do |file_name, data|
|
50
|
+
list << OpenStruct.new(name_with_args: file_name.split('.rake').first,
|
51
|
+
comment: Woro::TaskList.extract_description(data))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def fill_list_from_adapters
|
56
|
+
adapter_settings.each do |adapter_setting|
|
57
|
+
list << OpenStruct.new(headline: adapter_setting[0])
|
58
|
+
adapter = config.adapter(adapter_setting[0])
|
59
|
+
files = adapter.list_contents || {}
|
60
|
+
files.map do |file_name, data|
|
61
|
+
if file_name.include? '.rake'
|
62
|
+
list << OpenStruct.new(name_with_args: file_name.split('.rake').first,
|
63
|
+
comment: adapter.extract_description(data[:data]))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
list.compact!
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def adapter_settings
|
71
|
+
config.adapter_settings
|
72
|
+
end
|
73
|
+
|
74
|
+
def print_headline(headline)
|
75
|
+
say "#{headline.headline} ---"
|
76
|
+
end
|
77
|
+
|
78
|
+
def print_task_description(task)
|
79
|
+
say " %-#{width}s # %s" % [task.name_with_args, task.comment]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -17,7 +17,7 @@ namespace :woro do
|
|
17
17
|
|
18
18
|
info "Execute #{task.task_name} remotely"
|
19
19
|
within File.join(release_path, 'lib', 'tasks') do
|
20
|
-
execute :curl, "'#{adapter.raw_url(task.file_name)}'", '-o', "woro_#{task.file_name}"
|
20
|
+
execute :curl, '-sS', "'#{adapter.raw_url(task.file_name)}'", '-o', "woro_#{task.file_name}"
|
21
21
|
end
|
22
22
|
within release_path do
|
23
23
|
with rails_env: fetch(:rails_env) do
|
data/lib/woro/tasks/mina.rake
CHANGED
@@ -15,7 +15,7 @@ namespace :woro do
|
|
15
15
|
task = Woro::Task.new(task_name)
|
16
16
|
print_status "Execute #{task.task_name} remotely"
|
17
17
|
in_directory "#{app_path}" do
|
18
|
-
queue! "curl '#{adapter.raw_url(task.file_name)}' -o lib/tasks/woro_#{task.file_name}"
|
18
|
+
queue! "curl -sS '#{adapter.raw_url(task.file_name)}' -o lib/tasks/woro_#{task.file_name}"
|
19
19
|
queue! "#{bundle_prefix} rake woro:#{task.task_name}"
|
20
20
|
queue! "rm lib/tasks/woro_#{task.file_name}"
|
21
21
|
end
|
data/lib/woro/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: woro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Senff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- lib/woro/configuration.rb
|
163
163
|
- lib/woro/task.rb
|
164
164
|
- lib/woro/task_helper.rb
|
165
|
+
- lib/woro/task_list.rb
|
165
166
|
- lib/woro/tasks/capistrano.rake
|
166
167
|
- lib/woro/tasks/mina.rake
|
167
168
|
- lib/woro/templates/task.rake.erb
|
@@ -192,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
193
|
version: '0'
|
193
194
|
requirements: []
|
194
195
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.4.
|
196
|
+
rubygems_version: 2.4.6
|
196
197
|
signing_key:
|
197
198
|
specification_version: 4
|
198
199
|
summary: Write once, run once. One-time migration task management on remote servers
|