bruw 0.1.1

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.
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.1
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.3
6
+ - 2.7.1
7
+ before_install: gem install bundler -v 2.1.4
@@ -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 26109239+Quentinchampenois@users.noreply.github.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 [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in bruw.gemspec
6
+ gemspec
7
+
8
+ gem "byebug"
9
+ gem "colorize"
10
+ gem "rake", "~> 12.0"
11
+ gem "rspec", "~> 3.0"
12
+ gem "rubocop"
13
+ gem "tty-prompt"
data/Gemfile.lock ADDED
@@ -0,0 +1,77 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bruw (0.1.1)
5
+ thor
6
+ tty-prompt
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ byebug (11.1.3)
13
+ colorize (0.8.1)
14
+ diff-lcs (1.4.4)
15
+ parallel (1.20.1)
16
+ parser (3.0.0.0)
17
+ ast (~> 2.4.1)
18
+ pastel (0.8.0)
19
+ tty-color (~> 0.5)
20
+ rainbow (3.0.0)
21
+ rake (12.3.3)
22
+ regexp_parser (2.1.1)
23
+ rexml (3.2.4)
24
+ rspec (3.10.0)
25
+ rspec-core (~> 3.10.0)
26
+ rspec-expectations (~> 3.10.0)
27
+ rspec-mocks (~> 3.10.0)
28
+ rspec-core (3.10.1)
29
+ rspec-support (~> 3.10.0)
30
+ rspec-expectations (3.10.1)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.10.0)
33
+ rspec-mocks (3.10.2)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (~> 3.10.0)
36
+ rspec-support (3.10.2)
37
+ rubocop (1.11.0)
38
+ parallel (~> 1.10)
39
+ parser (>= 3.0.0.0)
40
+ rainbow (>= 2.2.2, < 4.0)
41
+ regexp_parser (>= 1.8, < 3.0)
42
+ rexml
43
+ rubocop-ast (>= 1.2.0, < 2.0)
44
+ ruby-progressbar (~> 1.7)
45
+ unicode-display_width (>= 1.4.0, < 3.0)
46
+ rubocop-ast (1.4.1)
47
+ parser (>= 2.7.1.5)
48
+ ruby-progressbar (1.11.0)
49
+ thor (1.1.0)
50
+ tty-color (0.6.0)
51
+ tty-cursor (0.7.1)
52
+ tty-prompt (0.23.0)
53
+ pastel (~> 0.8)
54
+ tty-reader (~> 0.8)
55
+ tty-reader (0.9.0)
56
+ tty-cursor (~> 0.7)
57
+ tty-screen (~> 0.8)
58
+ wisper (~> 2.0)
59
+ tty-screen (0.8.1)
60
+ unicode-display_width (2.0.0)
61
+ wisper (2.0.1)
62
+
63
+ PLATFORMS
64
+ ruby
65
+
66
+ DEPENDENCIES
67
+ bruw!
68
+ bundler (>= 1.0.0)
69
+ byebug
70
+ colorize
71
+ rake (~> 12.0)
72
+ rspec (~> 3.0)
73
+ rubocop
74
+ tty-prompt
75
+
76
+ BUNDLED WITH
77
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 quentinchampenois
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Makefile ADDED
@@ -0,0 +1,27 @@
1
+ .DEFAULT_GOAL := build
2
+
3
+ NAME=bruw-0.1.1.gem
4
+
5
+ install:
6
+ bundle install
7
+
8
+ install_pkg:
9
+ gem install pkg/$(NAME)
10
+
11
+ rake_build:
12
+ bundle exec rake build
13
+
14
+ build:
15
+ @make install
16
+ @make rake_build
17
+ @make install_pkg
18
+
19
+ cucumber:
20
+ bundle exec cucumber features/*.features
21
+
22
+ rspec:
23
+ bundle exec rspec spec
24
+
25
+ tests:
26
+ @make cucumber
27
+ @make rspec
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # Bruw
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bruw`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'bruw'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install bruw
22
+
23
+ Install gem locally using Makefile
24
+
25
+ $ make
26
+
27
+ If you use rbenv and you want to install it for several version, you will have to switch ruby version first
28
+
29
+ $ rbenv local [VERSION] && make
30
+ ## Usage
31
+
32
+ TODO: Write usage instructions here
33
+
34
+ ## Development
35
+
36
+ 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.
37
+
38
+ 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).
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bruw. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/bruw/blob/master/CODE_OF_CONDUCT.md).
43
+
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
48
+
49
+ ## Code of Conduct
50
+
51
+ Everyone interacting in the Bruw project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bruw/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "bruw"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bruw.gemspec ADDED
@@ -0,0 +1,32 @@
1
+ require_relative 'lib/bruw/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "bruw"
5
+ spec.version = Bruw::VERSION
6
+ spec.authors = ["quentinchampenois"]
7
+ spec.email = ["26109239+Quentinchampenois@users.noreply.github.com"]
8
+
9
+ spec.summary = 'Simple CLI for daily tasks'
10
+ spec.description = 'Bruw is a CLI designed to simplify daily tasks'
11
+ spec.homepage = 'https://github.com/quentinchampenois/bruw'
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["source_code_uri"] = 'https://github.com/quentinchampenois/bruw'
17
+
18
+ spec.add_development_dependency "bundler", ">= 1.0.0"
19
+ spec.add_development_dependency "rspec", "~> 2.6"
20
+
21
+ spec.add_dependency "thor"
22
+ spec.add_dependency "tty-prompt"
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
27
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+ end
@@ -0,0 +1,108 @@
1
+ # Add a subcommand to Bruw
2
+
3
+ All gem's logic is located under `lib/` folder.
4
+
5
+ For now there is no generator, but it could be an interesting feature. Furthermore, maybe the gem structure will change because I am not persuaded by the current structure.
6
+
7
+ ## Getting started
8
+
9
+ Let's imagine we create the subcommand `toto`.
10
+
11
+ ### Create library
12
+
13
+ First of all, I define the dedicated library for the `toto` logic.
14
+
15
+ $ touch lib/bruw/toto.rb
16
+
17
+ In `toto.rb`, I define the core of my library to be used in the following subcommand.
18
+
19
+ ```
20
+ #lib/bruw/toto.rb
21
+ # frozen_string_literal: true
22
+
23
+ module Bruw
24
+ class Toto
25
+ def self.my_name_is
26
+ "My name is Toto"
27
+ end
28
+ end
29
+ end
30
+ ```
31
+
32
+ ### Create subcommand
33
+
34
+ Then you can create the wanted subcommand under `lib/bruw/commands/` as following
35
+
36
+ $ touch lib/bruw/commands/toto.rb
37
+
38
+ And insert the Thor command you want
39
+
40
+ ```
41
+ #lib/bruw/commands/toto.rb
42
+ # frozen_string_literal: true
43
+
44
+ require 'thor'
45
+
46
+ module Bruw
47
+ module Commands
48
+ class Toto < Thor
49
+ desc "name", "Returns my current name"
50
+ long_desc <<-LONGDESC
51
+ Returns the current name
52
+ LONGDESC
53
+ def name
54
+ puts Bruw::Toto.my_name_is
55
+ end
56
+ end
57
+ end
58
+ end
59
+ ```
60
+
61
+ ### Register the library and subcommand
62
+
63
+ Now you can add your library to the current command
64
+
65
+ Add the following `require` to the file `lib/bruw.rb`
66
+ ```
67
+ require "bruw/toto"
68
+ require "bruw/commands/toto"
69
+ ```
70
+
71
+ And the create your new subcommand in `lib/bruw/cli.rb`
72
+
73
+ ```
74
+ #lib/bruw/cli.rb
75
+ # frozen_string_literal: true
76
+
77
+ require "bruw"
78
+
79
+ module Bruw
80
+ class CLI < Thor
81
+ desc "version", "Get the current cli version"
82
+ def version
83
+ puts VERSION
84
+ end
85
+
86
+ desc "toto SUBCOMMAND ...ARGS", "Simple toto subcommand !"
87
+ subcommand "toto", Bruw::Commands::Toto
88
+ end
89
+ end
90
+ ```
91
+
92
+ ## Congratulations !
93
+
94
+ You should now be able to run the command `bundle exec exe/bruw toto name` !
95
+
96
+ Example :
97
+
98
+ ```
99
+ $ bundle exec exe/bruw toto name
100
+ output: My name is Toto
101
+ ```
102
+
103
+ ## More information
104
+
105
+ You can install the gem without publishing it nor make a new release if you want to test the command line from outside project. To do so, just install the gem locally, for example
106
+
107
+ $ make
108
+
data/docs/ideas.md ADDED
@@ -0,0 +1,19 @@
1
+ # Commands that could be implemented in CLI
2
+
3
+ - [ ] Open current project's git repository in browser
4
+
5
+ - [ ] Create new PR from current branch
6
+
7
+ - [ ] heck ports (rails, redis, postgresql, etc) and kill
8
+
9
+ - [ ] Curl file from specific decidim version and save it in current project
10
+
11
+ - [ ] Check which files needs to be bumped (diff between local files and rawgithubcontent)
12
+
13
+ - [ ] Create generator of subcommands
14
+
15
+ - [ ] Clear all remote for a given repository
16
+
17
+ - [ ] Fetch all remote
18
+
19
+ - [ ] Add new remote and fetch repo
data/docs/testing.md ADDED
@@ -0,0 +1,23 @@
1
+ # Testing bruw gem
2
+
3
+ Bruw command is tested using [Rspec](https://github.com/rspec/rspec) and [Aruba](https://github.com/cucumber/aruba)
4
+
5
+ ## Functional tests
6
+
7
+ Functional tests are defined under `features` folder. To run this tests, use `cucumber` gem as following :
8
+
9
+ ```sh
10
+ bundle exec cucumber features/bruw.features
11
+ ```
12
+
13
+ ## Unit tests
14
+
15
+ Unit tests are defined under `spec` folder. There defined to work with `rspec` gem.
16
+
17
+ To run tests with rspec, use `rspec` as following:
18
+
19
+ ```sh
20
+ bundle exec rspec spec
21
+ ```
22
+
23
+
data/exe/bruw ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bruw/cli"
5
+ Bruw::CLI.start
data/lib/bruw/base.rb ADDED
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bruw
4
+ class Base
5
+ def self.version
6
+ "0.0.1"
7
+ end
8
+
9
+ def self.strip_path(path)
10
+ return if path.nil? || path.empty?
11
+ return path[0..-2] if path.end_with? "/"
12
+
13
+ path
14
+ end
15
+
16
+ def self.create_path(path)
17
+ return if Dir.exist?(path)
18
+
19
+ FileUtils.mkpath(path)
20
+ end
21
+ end
22
+ end
data/lib/bruw/cli.rb ADDED
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bruw"
4
+
5
+ module Bruw
6
+ class CLI < Thor
7
+ desc "version", "Get the current cli version"
8
+ def version
9
+ puts VERSION
10
+ end
11
+
12
+ desc "zip TARGET DESTINATION", "Compress target"
13
+ option :tar, required: false, banner: "Use tar, zip by default", aliases: "-t", type: :boolean, default: false
14
+ def zip(target, destination = ".")
15
+ target = Bruw::Base.strip_path(target)
16
+ dest = Bruw::Base.strip_path(destination)
17
+ extension = if options[:tar]
18
+ "tar.gz"
19
+ else
20
+ "zip"
21
+ end
22
+ final = "#{dest}/#{target}.#{extension}"
23
+
24
+ raise StandardError, "File already existing : #{final}" if File.exist?(final)
25
+
26
+ Bruw::Base.create_path(dest) unless Dir.exist?(dest)
27
+
28
+ `tar -zcf #{final} #{target}` if options[:tar]
29
+ `zip -r #{final} #{target}` unless options[:tar]
30
+
31
+ puts "Compression finished !".colorize(:green)
32
+ puts "> #{final}"
33
+ rescue StandardError => e
34
+ puts e.message.colorize(:red)
35
+ end
36
+
37
+ desc "unzip TARGET", "Decompress and unpack target"
38
+ option :zip, required: false, banner: "Force decompression with zip", aliases: "-z", type: :boolean, default: false
39
+ option :tar, required: false, banner: "Force decompression with tar", aliases: "-t", type: :boolean, default: false
40
+ def unzip(target)
41
+ raise StandardError, "File '#{target}' does not exists" unless File.exist?(target)
42
+
43
+ if target.end_with?(".zip") || options[:zip]
44
+ `unzip #{target}`
45
+ elsif target.end_with?(".tar.gz") || options[:tar]
46
+ `tar -zxf #{target}`
47
+ else
48
+ raise StandardError, "Unknown tool to use"
49
+ end
50
+
51
+ puts "Decompression finished !".colorize(:green)
52
+ rescue StandardError => e
53
+ puts e.message.colorize(:red)
54
+ end
55
+
56
+ desc "decidim SUBCOMMAND ...ARGS", "Manage Decidim projects"
57
+ subcommand "decidim", Bruw::Commands::Decidim
58
+
59
+ desc "git SUBCOMMAND ...ARGS", "Manage Git projects"
60
+ subcommand "git", Bruw::Commands::Git
61
+ end
62
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
4
+ require "net/http"
5
+
6
+ module Bruw
7
+ module Commands
8
+ class Decidim < Thor
9
+ desc "version", "Get the current decidim version"
10
+ long_desc <<-LONGDESC
11
+ Checks the Decidim version for the current project based on the bundler gem infos
12
+ LONGDESC
13
+ def version
14
+ puts "Current Decidim version is #{Bruw::Decidim.version&.colorize(:green)}"
15
+ rescue StandardError => e
16
+ puts e.message.colorize(:red)
17
+ end
18
+
19
+ desc "curl [RELATIVE_PATH]", "Curl given file against target github repository"
20
+ long_desc <<-LONGDESC
21
+ Allows to curl source code of specified path for a given version
22
+ LONGDESC
23
+ option :tag, required: false, banner: "Tag must have format vx.xx.x : Default current decidim version",
24
+ aliases: "-t", type: :string
25
+ option :branch, required: false, banner: "Remote branch to curl",
26
+ aliases: "-b", type: :string
27
+ option :owner, required: false, banner: "Owner name : Default 'decidim'", aliases: "-o", type: :string
28
+ option :repo, required: false, banner: "Repository name : Default 'decidim'", aliases: "-r", type: :string
29
+ option :save, required: false, banner: "Save output in relative path", aliases: "-s", type: :boolean
30
+ def curl(path)
31
+ options[:path] = path
32
+ options[:version] = find_version_for_curl options
33
+
34
+ response = Bruw::Decidim.curl(options)
35
+
36
+ if options[:save]
37
+ path = strip_path(path)
38
+ create_path(path)
39
+ save_file(path, response.chop)
40
+
41
+ puts "Curl finished, please see '#{path}'".colorize(:green)
42
+ else
43
+ puts response.chop
44
+ end
45
+ rescue StandardError => e
46
+ puts e.message.colorize(:red)
47
+ end
48
+
49
+ private
50
+
51
+ def save_file(path, content)
52
+ File.open(path, "w") do |f|
53
+ f.puts content
54
+ end
55
+
56
+ puts "File '#{path}' created.".colorize(:green)
57
+ end
58
+
59
+ def create_path(path)
60
+ return if Dir.exist?(path)
61
+
62
+ FileUtils.mkpath(File.dirname(path))
63
+ end
64
+
65
+ def strip_path(path)
66
+ return path unless Bruw::Decidim.osp_app?
67
+
68
+ path.split("/")[1..].join("/")
69
+ end
70
+
71
+ def find_version_for_curl(options)
72
+ if !options[:branch].nil? && !options[:branch].empty?
73
+ options[:branch]
74
+ elsif !options[:tag].nil? && !options[:tag].empty?
75
+ return options[:tag] if options[:tag].start_with?("v")
76
+
77
+ "v#{options[:tag]}"
78
+ else
79
+ "v#{Bruw::Decidim.version}"
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end