amirrajan / rubymotion-applied

RubyMotion documentation provided by the community. Submit a pull request to the docs for a free one year indie subscription.
Apache License 2.0
49 stars 10 forks source link

Moving "the rest of the templates" to rubymotion-templates. #70

Closed amirrajan closed 6 years ago

amirrajan commented 6 years ago

There are a lot of starter templates. There need to be more. But I (and hopefully you) will want to be able to iterate on them quickly and update them independent of a RubyMotion release.

So, aside from the gem, osx, ios, watchos, tvos, and android templates. I want to move the rest of them here.

When you run motion create with no parameters. Here is the new list you'll get:

┌── [ ~/projects  ]
└─» motion create
[!] A name for the new project is required.

Usage:

    $ motion create APP-NAME

      Create a new RubyMotion project from one of the following templates:

      RubyMotion Templates:

        * ios (default)
        * osx
        * android
        * tvos
        * watchos
        * gem

      Community Templates (http://github.com/amirrajan/rubymotion-templates):

        * ios-action-extension
        * ios-audio-unit-extension
        * ios-share-extension
        * ios-notification-content-extension
        * ios-intents-ui-extension
        * ios-document-provider-extension
        * ios-custom-keyboard-extension
        * ios-call-directory-extension
        * ios-photo-editing-extension
        * ios-notification-service-extension
        * ios-today-extension
        * ios-broadcast-ui-extension
        * ios-content-blocker-extension
        * ios-spotlight-index-extension
        * ios-intents-extension
        * ios-shared-links-extension
        * ios-admob-rewarded-ads

Options:

    --template=[NAME|URL]   A built-in template or from a file/git URL
    --version               Show the version of RubyMotion
    --no-ansi               Show output without ANSI codes
    --verbose               Show more debugging information
    --help                  Show help banner of specified command
hboon commented 6 years ago

(If we can have https://github.com/hipbyte/rubymotion up to date :) )

Presuming that the idea is for the community to write more templates like ios-admob-rewarded-ads, I think it's worth considering keeping the templates for extensions within the RubyMotion repo and separate out non-"standard" ones like ios-admob-rewarded-ads into https://github.com/amirrajan/rubymotion-templates. Extension templates tend to be harder to get right and are more time-sensitive. We can still run our own fork of the rubymotion tools anyway if we want to tweak the "standard" templates and then submit a PR like before?

Is there a particular reason to want to push those into rubymotion-templates too?

amirrajan commented 6 years ago

(If we can have https://github.com/hipbyte/rubymotion up to date :) )

Yes definitely, but I just think it may be better if templates were always updated from a git repo when you run the motion create action. So the hipbyte/rubymotion public repo would be updated, but the templates directory would be (essentially) removed and all future templates would come from rubymotion-templates.

Extension templates tend to be harder to get right and are more time-sensitive.

Agreed. Definitely not saying that RubyMotion will stop supporting these. The reason I want to have them pull from a GH repo is so they can be quickly updated (as opposed to me having to push a release). Here's how lib/motion/project/template.rb would be updated:

    community_templates = File.expand_path(File.join("~", '.rubymotion-community-templates'))
    begin
      unless File.directory?(community_templates)
        puts "Cloning approved community templates. Feel free to browse ~/.rubymotion-community-templates to see how their built."
        `git clone https://github.com/amirrajan/rubymotion-templates #{community_templates}`
      else
        Dir.chdir(community_templates) do
          `git pull`
        end
      end
    rescue => exception
      puts "#{exception}"
      puts "Retrieval of community templates from https://github.com/amirrajan/rubymotion-templates didn't work. Skipping for now."
    end

    Paths = [
      local_templates,
      community_templates,
      File.expand_path(File.join(ENV['HOME'], 'Library/RubyMotion/template'))
    ]
hboon commented 6 years ago

Ok, makes sense 💯

andrewhavens commented 6 years ago

💯% on board with moving ALL templates into a git repo. I’d love for the templates to auto-update like homebrew does.

amirrajan commented 6 years ago

I'm totally okay with moving everything over too actually. @hboon ?

In essense, RubyMotion wont technically "ship" with any templates. They will all download when you type motion create. This will allow extremely fast updates to templates w/o having to do an RM release.

hboon commented 6 years ago

Just 1 thought: would the templates ever need to be tied to an RM version?

But I suppose if we have a command like motion update-project-templates <commit-or-tag>, that would fix it.

Otherwise sounds good!

wndxlori commented 6 years ago

New features will result in new templates. Templates should indicate the first iOS/RM version in which they are supported, so they don't appear when using older versions (and you can add stuff during betas without confusing everyone on the officially supported release).

amirrajan commented 6 years ago

@hboon @wndxlori Not to worried about that honestly. Specifically: You're creating a new project.... why would you want to use an old template/old version of RM/old version of XCode?

I think it's better to answer this question (very specifically), and figure out a solution around that. I'm still leaning towards "lets just do it, what's the worst that could happen?"

hboon commented 6 years ago

Yes, let's do it! (or make it so :P )

amirrajan commented 6 years ago

git commit -m "make it so"