middleman-deploy pushes from root instead of build dir - ruby

Background
I'm using middleman-deploy to deploy to a github page for an organization.
It's my understanding that the middleman build dir (/build in this case) is what will get deployed to github. That is, the directory that contains files after a bundle exec middleman build, including the index.html file.
What I'm getting in my github repo is the root of the project. I'm using bundle exec middleman deploy --build-before
config.rb
activate :deploy do |deploy|
deploy.method = :git
deploy.remote = 'https://github.com/FiercePunchStudios/fiercepunchstudios.github.io.git'
deploy.branch = 'master'
end
Question
How do I deploy my middleman site to a github organization page, using middleman-deploy?

Thanks to #robinbortlik, there's a handy little extension right on the github issue. https://github.com/middleman-contrib/middleman-deploy/issues/114#issuecomment-168139237
#lib/build_cleaner.rb
class BuildCleaner < Middleman::Extension
def initialize(app, options_hash={}, &block)
super
FileUtils.rm_rf app.config[:build_dir]
end
end
::Middleman::Extensions.register(:build_cleaner, BuildCleaner)
#config.rb
require_relative "./lib/build_cleaner"
configure :build do
activate :build_cleaner
end
This deletes the build directory before the build action. Now you can just do a single command, like bundle exec middleman deploy --build-before
It's still not something I'd consider a fix, because I'd like to not have to add boilerplate to every middleman project I start. However, it's a convenient workaround that smooths out the deploy process for now.

Related

Ruby Xcodeproj: Add file to non-group folder

I am trying to add the Google-Service.json (for Google Social Login) to my Xcode Project. As the project is build in a CI machine I cannot do it through Xcode.
I used Cocoapod's Xcodeproj package in order to help me add the json to my Xcode proj. The Runner folder seen below is not a group folder as Fluter or Products. With my created script I only achieve for the file to be added to the root of the project as seen in the picture. Can anyone tell me what to change so the project gets inside the Runner folder (as requested from Google_sign_in flutter plugin)
Here is my script:
require "xcodeproj"
project_path = "Runner.xcodeproj"
project = Xcodeproj::Project.open(project_path)
file = project.new_file("Google.json", "Runner")
main_target = project.targets.first
main_target.add_resources([file])
project.save
Thanks for any inputs
Don't know if it is still relevant. BUT i stumbled upon the same issue.
You need to add them inside the project root with ruby's FileUtils first.
FileUtils.cp(File.path(config_path), 'Runner')
I made a GitHub Gist with the whole script. With an example of my Run script also.

Calling fastlane with its actions from another directory

I am working on a ruby project that its intention, at the moment, is to automate the deploy process for an iOS project. In the future, android will be considered.
The ruby deploy file will take a JSON url that contains information about the apps intended to release. The Fastlane actions will do the job.
{
"version":1.0,
"build":2,
"git":{
"name":"appName",
"url":"git#gitlab.com:me/myapp.git"
},
"apps":[
{
"bundle_id":"com.myapp1",
"app_name":"App1",
"username":"me#kmail.com",
"password":"1234",
"team_name":"TeamName"
},
{
"bundle_id":"com.App2",
"app_name":"App2",
"username":"me#kmail.com",
"password":"1234",
"team_name":"TeamName"
}
]
}
The initial idea for the project was to have:
The deploy project (Gemfile, files, dependencies ...) with its own git repository.
The Xcode project with its own repository.
A Fastlane project (with all the fastlane files) with its own repository
Correct setup
Xcode and Fastlane projects as submodules of deploy project.
This whole project is intended to be in a CI machine.
NOTE Ask for more info if needed.
Question
The deploy project calls fastlane actions using exec(). Since the fastlane folder now is in
./XcodeProject/fastlane, How can I call the actions? My first approach was:
exec("fastlane ./XcodeProject/MyAction")
but I am wrong...
Any ideas?
Thank you
You may be able to temporarily change your working directory using a shell script, where you enclose your cd and fastlane commands in parentheses, like so:
(cd XcodeProject && fastlane MyAction)
I'm not sure if that will work within your exec(...) call but you could write an external script that does the above, and then run that within an exec call.
See this post for more information.

Rspec don't show me the its

I have this repository on bitbucket
bitbucket.org/alu0100786330/prct08
And when I clone it in my cloud 9, the Rspec don't show me the its
I have this workspace that containt the repository and here it works right:
ide.c9.io/alu0100786330/lpp_67
Expected output:
[
BUT in the second workspace dont show me the results.
The commands that I made:
git clone bitbucket.org/alu0100786330/prct08
bundle install
And when I execute the rspec with the rake show me this, without its:
[]
What can I do to show the its?
RSpec reads from the .rspec configuration file in the directory you run it from. It sounds like in one workspace, that contains --format documentation, and in the other, it contains --format progress (or nothing, progress is default). You just need to add a .rspec file to your second workspace, or run rspec with the options you want (See rspec --help).
If you or your team has an .rspec you like, check it into the repository. Individuals can still create a .rspec-local that doesn't go in the repository if they want to override some settings just for themselves.

Ignore folder when build using Middleman App

I want to ignore samples/ folder when build. I used this
configure :build do
activate :asset_hash, :ignore => [/^samples\//]
end
It didn't work and that folder was still included during build process. Could anyone advise?
Add the following code to your config.rb file:
ignore 'samples/*'
#ignore accepts regular expressions as well. See the specs.

How to push changes for an Octopress blog on GitHub?

I've gone through the Octopress setup and deploy instructions, and I have Octopress running on Github: http://wmerydith.github.com
My repo is set to the default branch of Master.
I now want to push changes to the config file, like changing the url:, title: and subtitle:. I made these changes, committed them, and then did a rake deploy, but the changes are not showing up.
What's unclear to me is the difference in process for pushing config changes, content changes and at some point, new updates to the Octopress blog.
For instance, will I use rake deploy to push config and content changes?
Will I ever need to run rake generate or rake deploy again? How do I push source changes when Octopress updates?
From the documentation, you might want to do a:
rake generate
before the rake deploy.
This will:
generate your blog,
copy the generated files into _deploy/,
add them to git,
commit and push them up to the master branch.
In a few seconds you should get an email from Github telling you that your commit has been received and will be published on your site.
The OP Will Merydith comments:
I am unclear on is if 'rake deploy' is enough to push content changes to the blog.
I'm seeing some issue with content not making it to the blog and am unclear if the error is how I am deploying or something else
I confirm the Rakefile task :deploy will execute default_deploy which will execute task :push.

Resources