capistrano-rust 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ec18ffb9860bf10ca698d00c5ead6b989270cfe56f113aadfac7f349b7e07fb7
4
+ data.tar.gz: 286e9fe095583929b4262ea87aae73a2c4e91a469e7d2e5a097f471a9075b9a1
5
+ SHA512:
6
+ metadata.gz: d37048cef9af5e0b14ffd8640b89e8675ac8c0c471a44bd50623bc73af984751d8e0ed5ae5c47a35a1c8dc52071db738f9b88010552cc722e552fd712a796e7f
7
+ data.tar.gz: 434bd65bdbe472b880366630aed8bed540a9f64060faadbc9098338babee5884e2f75a71c6dcfeb7233d859f4a79fc9f2d4d05d101c323046c817b49d1eaed6f
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.5
7
+ before_install: gem install bundler -v 1.17.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at gregoire.lejeune@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-rust.gemspec
4
+ gemspec
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ capistrano-rust (0.1.0)
5
+ capistrano (~> 3.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ airbrussh (1.4.0)
11
+ sshkit (>= 1.6.1, != 1.7.0)
12
+ capistrano (3.13.0)
13
+ airbrussh (>= 1.0.0)
14
+ i18n
15
+ rake (>= 10.0.0)
16
+ sshkit (>= 1.9.0)
17
+ concurrent-ruby (1.1.6)
18
+ i18n (1.8.2)
19
+ concurrent-ruby (~> 1.0)
20
+ net-scp (2.0.0)
21
+ net-ssh (>= 2.6.5, < 6.0.0)
22
+ net-ssh (5.2.0)
23
+ rake (10.5.0)
24
+ sshkit (1.21.0)
25
+ net-scp (>= 1.1.2)
26
+ net-ssh (>= 2.8.0)
27
+
28
+ PLATFORMS
29
+ ruby
30
+
31
+ DEPENDENCIES
32
+ bundler (~> 1.17)
33
+ capistrano-rust!
34
+ rake (~> 10.0)
35
+
36
+ BUNDLED WITH
37
+ 1.17.2
@@ -0,0 +1,116 @@
1
+ # Capistrano::Rust
2
+
3
+ rustup/cargo/rustc support for Capistrano 3.x
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'capistrano', '~> 3.1.0'
11
+ gem 'capistrano-rust'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install capistrano-rust
21
+
22
+ ## Usage
23
+
24
+ Require in `Capfile` to use the default task:
25
+
26
+ ```ruby
27
+ require 'capistrano/rust'
28
+ ```
29
+
30
+ Configurable options:
31
+
32
+ ```ruby
33
+ set :rustup_custom_env, '$HOME/.cargo/env'
34
+ set :rustup_roles, :all
35
+ set :rustup_map_bins, %w{rustc cargo}
36
+ ```
37
+
38
+ ## Tasks
39
+
40
+ ### rustup:exec
41
+
42
+ Run command in the rustup environment.
43
+
44
+ You can override any of these defaults by setting the variables shown below.
45
+
46
+ ```ruby
47
+ set :cargo_target_path, nil
48
+ set :rustup_exec_roles, :all
49
+ set :rustup_exec_env_variables, {}
50
+ ```
51
+
52
+ This task is strictly opt-in. If you want to run it on every deployment
53
+ before you run cargo build, add the following to your deploy.rb.
54
+
55
+ ```ruby
56
+ set :rustup_map_bins, %w{rustc cargo diesel}
57
+
58
+ after 'cargo:install', :run_migration do
59
+ set :rustup_exec_cmd, 'diesel migration run'
60
+ invoke 'rustup:exec'
61
+ end
62
+ ```
63
+
64
+ ### cargo:install
65
+
66
+ Install cargo packages.
67
+
68
+ You can override any of these defaults by setting the variables shown below.
69
+
70
+ ```ruby
71
+ set :cargo_target_path, nil
72
+ set :cargo_install_roles, :all
73
+ set :cargo_install_env_variables, {}
74
+ set :cargo_install_crates, []
75
+ ```
76
+
77
+ `cargo_install_crates` is and Array of String or Hash :
78
+
79
+ ```ruby
80
+ set :cargo_install_crates, ['diesel_cli', {name: 'cargo-watch', flags: ['-f']}]
81
+ ```
82
+
83
+ This task is strictly opt-in. If you want to run it on every deployment
84
+ before you run cargo build, add the following to your deploy.rb.
85
+
86
+ ```ruby
87
+ before 'cargo:build', 'cargo:install'
88
+ ```
89
+
90
+ ### cargo:build
91
+
92
+
93
+ Install the project dependencies via cargo, and build the project.
94
+
95
+ You can override any of these defaults by setting the variables shown below.
96
+
97
+ ```ruby
98
+ set :cargo_target_path, nil
99
+ set :cargo_build_roles, :all
100
+ set :cargo_build_env_variables, {}
101
+ set :cargo_build_flags, ['--release']
102
+ ```
103
+
104
+ ## Development
105
+
106
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
107
+
108
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
109
+
110
+ ## Contributing
111
+
112
+ Bug reports and pull requests are welcome on GitHub at https://gitlab.com/glejeune/capistrano-rust. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
113
+
114
+ ## Code of Conduct
115
+
116
+ Everyone interacting in the Capistrano::Rust project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/glejeune/capistrano-rust/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'capistrano/rust/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'capistrano-rust'
9
+ spec.version = Capistrano::Rust::VERSION
10
+ spec.authors = ['Grégoire Lejeune']
11
+ spec.email = ['gregoire.lejeune@gmail.com']
12
+
13
+ spec.summary = 'Rustup/Rustc/Cargo support for Capistrano 3.x'
14
+ spec.description = 'Rustup/Rustc/Cargo support for Capistrano 3.x'
15
+ spec.homepage = 'https://gitlab.com/glejeune/capistrano-rust'
16
+
17
+ spec.license = 'BSD-3-Clause'
18
+
19
+ spec.files = `git ls-files`.split($/)
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_dependency 'capistrano', '~> 3.1'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.17'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ load File.expand_path('tasks/rust.rake', __dir__)
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Capistrano
4
+ module Rust
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,131 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :rustup do
4
+ task :wrapper do
5
+ on release_roles(fetch(:rustup_roles)) do
6
+ execute :mkdir, '-p', "#{fetch(:tmp_dir)}/#{fetch(:application)}/"
7
+ upload! StringIO.new(
8
+ "#!/bin/bash -e\nsource \"#{fetch(:rustup_env)}\"\nexec \"$@\""
9
+ ), "#{fetch(:tmp_dir)}/#{fetch(:application)}/rustup-exec.sh"
10
+ execute :chmod, '+x', "#{fetch(:tmp_dir)}/#{fetch(:application)}/rustup-exec.sh"
11
+ end
12
+ end
13
+
14
+ task :map_bins do
15
+ rustup_prefix = fetch(:rustup_prefix, -> {
16
+ "#{fetch(:tmp_dir)}/#{fetch(:application)}/rustup-exec.sh"
17
+ })
18
+ fetch(:rustup_map_bins).each do |command|
19
+ SSHKit.config.command_map.prefix[command.to_sym].unshift(rustup_prefix)
20
+ end
21
+ end
22
+
23
+ desc <<-DESC
24
+ Run command in the rustup environment.
25
+
26
+ You can override any of these defaults by setting the variables shown below.
27
+
28
+ set :cargo_target_path, nil
29
+ set :rustup_exec_roles, :all
30
+ set :rustup_exec_env_variables, {}
31
+
32
+ This task is strictly opt-in. If you want to run it on every deployment \
33
+ before you run cargo build, add the following to your deploy.rb.
34
+
35
+ after 'cargo:install', :run_migration do
36
+ set :rustup_exec_cmd, 'diesel migration run'
37
+ invoke 'rustup:exec'
38
+ end
39
+ DESC
40
+ task :exec do
41
+ on roles fetch(:rustup_exec_roles, :all) do
42
+ within fetch(:cargo_target_path, release_path) do
43
+ with fetch(:rustup_exec_env_variables, {}) do
44
+ rustup_exec_cmd = fetch(:rustup_exec_cmd).split(' ')
45
+ unless rustup_exec_cmd.empty?
46
+ execute(*rustup_exec_cmd)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ Capistrano::DSL.stages.each do |stage|
55
+ after stage, 'rustup:wrapper'
56
+ after stage, 'rustup:map_bins'
57
+ end
58
+
59
+ namespace :cargo do
60
+ desc <<-DESC
61
+ Install cargo packages.
62
+
63
+ You can override any of these defaults by setting the variables shown below.
64
+
65
+ set :cargo_target_path, nil
66
+ set :cargo_install_roles, :all
67
+ set :cargo_install_env_variables, {}
68
+ set :cargo_install_crates, []
69
+
70
+ cargo_install_crates is and Array or String or Hash :
71
+
72
+ set :cargo_install_crates, ['diesel_cli', {name: 'cargo-watch', flags: ['-f']}]
73
+
74
+ This task is strictly opt-in. If you want to run it on every deployment \
75
+ before you run cargo build, add the following to your deploy.rb.
76
+
77
+ before 'cargo:build', 'cargo:install'
78
+ DESC
79
+ task :install do
80
+ on roles fetch(:cargo_install_roles, :all) do
81
+ cargo_crates = fetch(:cargo_install_crates, [])
82
+ unless cargo_crates.empty?
83
+ within fetch(:cargo_target_path, release_path) do
84
+ with fetch(:cargo_install_env_variables, {}) do
85
+ cargo_crates.each do |crates_def|
86
+ if crates_def.is_a? String
87
+ crates_def = { name: crates_def, flags: [] }
88
+ end
89
+ execute :cargo, 'install', *crates_def[:flags], '--', crates_def[:name]
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
96
+
97
+ desc <<-DESC
98
+ Install the project dependencies via cargo, and build the project.
99
+
100
+ You can override any of these defaults by setting the variables shown below.
101
+
102
+ set :cargo_target_path, nil
103
+ set :cargo_build_roles, :all
104
+ set :cargo_build_env_variables, {}
105
+ set :cargo_build_flags, ['--release']
106
+ DESC
107
+ task :build do
108
+ on roles fetch(:cargo_build_roles, :all) do
109
+ within fetch(:cargo_target_path, release_path) do
110
+ with fetch(:cargo_build_env_variables, {}) do
111
+ cargo_build_flags = fetch(:cargo_build_flags, ['--release'])
112
+ execute :cargo, 'build', *cargo_build_flags
113
+ end
114
+ end
115
+ end
116
+ end
117
+
118
+ before 'deploy:updated', 'cargo:build'
119
+ end
120
+
121
+ namespace :load do
122
+ task :defaults do
123
+ set :rustup_env, -> {
124
+ rustup_env = fetch(:rustup_custom_path)
125
+ rustup_env || '$HOME/.cargo/env'
126
+ }
127
+
128
+ set :rustup_roles, fetch(:rustup_roles, :all)
129
+ set :rustup_map_bins, %w{rustc cargo}
130
+ end
131
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-rust
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Grégoire Lejeune
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-04-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.17'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.17'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Rustup/Rustc/Cargo support for Capistrano 3.x
56
+ email:
57
+ - gregoire.lejeune@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - CODE_OF_CONDUCT.md
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - README.md
69
+ - Rakefile
70
+ - capistrano-rust.gemspec
71
+ - lib/capistrano/rust.rb
72
+ - lib/capistrano/rust/version.rb
73
+ - lib/capistrano/tasks/rust.rake
74
+ homepage: https://gitlab.com/glejeune/capistrano-rust
75
+ licenses:
76
+ - BSD-3-Clause
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubygems_version: 3.0.3
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Rustup/Rustc/Cargo support for Capistrano 3.x
97
+ test_files: []